[C++] Donator Commands (No Core Edits) menu

Shout-Out

User Tag List

Page 1 of 3 123 LastLast
Results 1 to 15 of 33
  1. #1
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C++] Donator Commands (No Core Edits)

    Donator Commands

    This is a script i wrote in an attempt to create some donator commands without the hassle of having to perform a core edit. With all honesty this is probably really sloppy code. I Hope you guys like it, i created 4 commands.

    Code:
    #AddItem <ItemId>
    #Announce <Message>
    #Teleport <PlayerName>
    #Port <mapid> <x> <y> <z>
    Here is the Code

    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    #include <string>
    
    /*
    ###############################
    #####Created by Mager1794######
    ######Donator Commands#########
    ###############################
    
    Command List
    
    #AddItem <ItemId>
    #Announce <Message>
    #Teleport <PlayerName>
    #Port <mapid> <x> <y> <z>
    
    */
    
    bool FindCommand(string Message, string Command)
    {
        int i = Message.find(Command);
        if(i != string::npos)
        {
            return true;
        }else{
            return false;
        }
    }
    
    bool IsDonator(Player * pPlayer)
    {
        QueryResult * qres = CharacterDatabase.Query("SELECT * FROM `accounts` WHERE `acct` = '%s' and `gm` = 'Donator';", pPlayer->GetSession()->GetAccountId());
        if(!qres == NULL)
            return true;
        else
            return false;
    }
    
    bool CommandCheck(const char * Message)
    {
        if(Message[0]=='#')
            return true;
        else
            return false;
    }
    
    void DonorAnnounceCommand(const char* Message, Player * pPlayer)
    {
        string commandname = "#Announce";
        string command = Message;
        if(!FindCommand(command, commandname))
            return;
        string Variable = command.replace(command.find(command),commandname.size()+1,"");
        const char * announce = (const char *)Variable.c_str();
        if(announce == NULL)
            return;
    
        char * msg;
        sprintf(msg, "[Donator]%s: %s", pPlayer->GetName(), announce);
    
        sWorld.SendWorldText(msg);
    }
    
    void DonorPort(const char* Message, Player * pPlayer)
    {
        string commandname = "#Port";
    
        string command = Message;
        if(!FindCommand(command, commandname))
            return;
        string Variable = command.replace(command.find(command),commandname.size()+1,"");
        const char * args = (const char *)Variable.c_str();
        float x, y, z;
        uint32 mapid;
        if(sscanf(args, "%u %f %f %f", (unsigned int*)&mapid, &x, &y, &z) != 4)
            return;
        if(x >= _maxX || x <= _minX || y <= _minY || y >= _maxY)
            return;
    
        LocationVector vec(x, y, z);
        pPlayer->SafeTeleport(mapid, 0, vec);
    }
    
    void TeleportToFriendCommand(const char* Message, Player * pPlayer)
    {
        string commandname = "#Teleport";
        string command = Message;
        if(!FindCommand(command, commandname))
            return;
        string Variable = command.replace(command.find(command),commandname.size()+1,"");
        const char * charname = (const char *)Variable.c_str();
    
        Player * Target = objmgr.GetPlayer(charname, false);
        if(!Target)
        {
            pPlayer->BroadcastMessage("Player doesn't exist");
            return;
        }
        if(pPlayer->GetTeam() != Target->GetTeam())
        {
            pPlayer->BroadcastMessage("That player is not the same faction as you");
            return;
        }
        if(Target->GetSession()->HasGMPermissions())
        {
            pPlayer->BroadcastMessage("You cannot teleport to a GM");
            return;
        }
        if(Target->GetName() == pPlayer->GetName())
        {
            pPlayer->BroadcastMessage("You cannot teleport to yourself");
            return;
        }
        float nx = pPlayer->GetPositionX();
        float ny = pPlayer->GetPositionY();
        float nz = pPlayer->GetPositionZ();
        Target->BroadcastMessage("%s is teleporting to you...", pPlayer->GetName());
        pPlayer->EventTeleport(Target->GetMapId(), Target->GetPositionX(), Target->GetPositionY(), Target->GetPositionZ());
        if(nx == pPlayer->GetPositionX()|| ny == pPlayer->GetPositionY()|| nz == pPlayer->GetPositionZ())
        {
            pPlayer->BroadcastMessage("Teleportation failed...");
        }
    }
    
    void AddItemCommand(const char * Message, Player * pPlayer)
    {
        string commandname = "#AddItem";
        string command = Message;
        if(!FindCommand(command, commandname))
            return;
        string Variable = command.replace(command.find(command),commandname.size()+1,"");
        const char * strid = (const char *)Variable.c_str();
        uint32 id = strlen(strid);
    
        pPlayer->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(id, pPlayer));
    }
    
    void DonatorCommands(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
    {
        if(CommandCheck(Message))
        {
        if(IsDonator(pPlayer) || pPlayer->GetSession()->HasGMPermissions())
        {
        if(Config.MainConfig.GetBoolDefault("DonatorCommands", "AddItem", true))
        {
            AddItemCommand(Message, pPlayer);
        }
        if(Config.MainConfig.GetBoolDefault("DonatorCommands", "Tele2Friend", true))
        {
            TeleportToFriendCommand(Message, pPlayer);
        }
        if(Config.MainConfig.GetBoolDefault("DonatorCommands", "Announce", true))
        {
            DonorAnnounceCommand(Message,pPlayer);
        }
        if(Config.MainConfig.GetBoolDefault("DonatorCommands", "Port", true))
        {
            DonorPort(Message,pPlayer);
        }
        }
        else
        {
            pPlayer->BroadcastMessage("You must be a donator to use this command");
        }
        }
    }
    
    void SetupDonatorCommands(ScriptMgr * mgr)
    {
        mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, &DonatorCommands);
    }
    Config File

    Add this to the bottom of your ArcEmu-World.conf file
    Code:
    #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
    # Donator Command Settings
    #
    #    AddItem    
    #        Set to 1 if you wish to allow donators to 
    #        use the '#AddItem' command and to 0 if
    #        if you don't want them to.
    #                Default: 1    
    #
    #    Tele2Friend
    #        Set to 1 if you wish to allow donators to 
    #        use the '#Teleport' command and to 0 if
    #        if you don't want them to.
    #                Default: 1
    #
    #
    #    Announce    
    #        Set to 1 if you wish to allow donators to 
    #        use the '#Announce' command and to 0 if
    #        if you don't want them to.
    #                Default: 1    
    #
    #    Port    
    #        Set to 1 if you wish to allow donators to 
    #        use the '#Port' command and to 0 if
    #        if you don't want them to.
    #                Default: 1            
    #
    #
    #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
    
    <DonatorCommands AddItem = "1"
             Tele2Friend = "1"
             Announce = "1"
              Port = "1">

    Credits To Link_S for helping me out a on a few things =D
    Last edited by mager1794; 06-13-2009 at 05:14 PM. Reason: Made Editable in Config Files
    Lunar Gaming - Reaching For The Stars

    [C++] Donator Commands (No Core Edits)
  2. #2
    Performer's Avatar Contributor
    Reputation
    212
    Join Date
    Nov 2007
    Posts
    874
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks pretty good mager, i just dont support the add command +rep if i can.


  3. #3
    Vindicated's Avatar Contributor
    Reputation
    226
    Join Date
    Aug 2008
    Posts
    1,067
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice work mager. +Rep if I can as well.


  4. #4
    Hellgawd's Avatar Account not activated by Email
    Reputation
    710
    Join Date
    Jun 2007
    Posts
    2,480
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Moar nice C++ goodies! There should be a entire forum category devoted to you. :P
    +5, since I don't think i've repped you for all your other stuff

  5. #5
    Glorianglorre's Avatar Active Member
    Reputation
    40
    Join Date
    Feb 2009
    Posts
    340
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is amazing +Rep

  6. #6
    bsod-staff14's Avatar Member
    Reputation
    35
    Join Date
    Nov 2008
    Posts
    443
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sweet thanks Mager +Rep if I can
    Immortal GamerZ Under Development!

  7. #7
    Dr. Livingstone's Avatar Member
    Reputation
    113
    Join Date
    Mar 2008
    Posts
    290
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    +Rep yet again. Very nice work Mager

  8. #8
    y2kss66's Avatar Member
    Reputation
    104
    Join Date
    Jan 2008
    Posts
    778
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree with Hellgawd!

    another nice release mager1794

  9. #9
    Obsideon's Avatar Member
    Reputation
    8
    Join Date
    Mar 2009
    Posts
    56
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    +Rep this is awesome! Could you possibly add a modify stat command?

  10. #10
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys i'm glad you guys like it, I could try to make a stat changing one.

    I made the features editable in configs okay guys
    Lunar Gaming - Reaching For The Stars

  11. #11
    Linkn's Avatar Contributor
    Reputation
    90
    Join Date
    Mar 2009
    Posts
    296
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice as always, your deserved +Rep.

  12. #12
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Creative! +Rep
    Why do I need a signature?

  13. #13
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks guys =D glad you all enjoy this
    Lunar Gaming - Reaching For The Stars

  14. #14
    slipknotking's Avatar Member
    Reputation
    1
    Join Date
    Sep 2007
    Posts
    22
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where do i put the code?

  15. #15
    Dr. Livingstone's Avatar Member
    Reputation
    113
    Join Date
    Mar 2008
    Posts
    290
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have to compile it.

Page 1 of 3 123 LastLast

Similar Threads

  1. [Updating] Materful Ascent Core Edits
    By SectorSeven in forum World of Warcraft Emulator Servers
    Replies: 39
    Last Post: 06-07-2008, 03:53 PM
  2. [Request] Morph Command into Core
    By Madara Uchiha in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 04-24-2008, 06:57 AM
  3. Core edits that are asked a lot for lately [All in 1 Post]
    By latruwski in forum World of Warcraft Emulator Servers
    Replies: 21
    Last Post: 03-03-2008, 05:50 PM
  4. [Guide] donation command
    By Denelly in forum WoW EMU Guides & Tutorials
    Replies: 8
    Last Post: 02-16-2008, 12:18 PM
  5. Changing .announce color (no core edits)
    By Le Froid in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 01-07-2008, 04:44 PM
All times are GMT -5. The time now is 12:26 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search