Understanding Custom Commands menu

Shout-Out

User Tag List

Results 1 to 5 of 5
  1. #1
    Osaid1's Avatar Banned
    Reputation
    45
    Join Date
    Apr 2008
    Posts
    49
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Understanding Custom Commands

    Custom Commands are quite tricky to understand, and also difficult to make if you do not know what your doing. We're going to be using a command "#rezz" Author: Dark Alex.
    First, just take a look through his script, study it.

    Code:
    //---------------------
    // Name: Playercommands
    // Author: Darkalex
    //---------------------
    
    #include "StdAfx.h"
    #include "Setup.h"
    
    static string rezzcmd = "#rezz"; //Revive Player-command
    bool rezzon = true; //Will be switchable later ingame via GMCommand
    
    void EventPlayerCommands(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
    {
     //#rezz-Command - Start
      if(Message == rezzcmd)
       {
          if(rezzon)
    if( rezzon ) { //You can add parameters where reviing is enabled here. e.g. for allowing it only on kalimdor and in Zone 123: (pPlayer->GetMapId() == 1 || pPlayer->GetZoneId() == 123)
            if (pPlayer->GetUInt32Value(PLAYER_FIELD_COINAGE)>=7500)  //Will cost 75 Silver (check if enough money)
            {
    pPlayer->SetUInt32Value(PLAYER_FIELD_COINAGE,(pPlayer->GetUInt32Value(PLAYER_FIELD_COINAGE) - 7500)); //Here 75 Silver is removed
                     sEventMgr.AddEvent(pPlayer, &Player::RemoteRevive, EVENT_PLAYER_REST, 1, 1,0);
            } else pPlayer->BroadcastMessage("You don't have 75 silver in your backpack.");
             } else
                pPlayer->BroadcastMessage("You can't revive here!");
          else
             pPlayer->BroadcastMessage("You can't revive here!.");
       }
      //#rezz-Command end.
    }
    
    
    void SetupPlayerCommands(ScriptMgr * mgr)
    {
       mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, (void *) EventPlayerCommands);
    }
    Now, the first bit is pretty much the starting bit, mostly all scripts start with "StdAfx.h" and "Setup.h" (Dont forget to put these in!"

    #include "StdAfx.h"
    #include "Setup.h"

    static string rezzcmd = "#rezz";
    bool rezzon = true;


    Now You see "#rezz"?? Thats what you type into game. Yes! Sure the scripting is difficult but easy for the players!
    Dont need to mess around with true and false there, but say if you wanted to make a command that will enable you to use a command whilst in combat you can type something like Bypasscombat = false will make it so you cant use the command in combat, but placing false with true will make it so you can use it.

    void EventPlayerCommands(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)

    Now this part is everything you need to include for your script (Cant really explain it) But if you didnt want to explain anything You could write void EventPlayerCommands() the () is where you can place thing's like uint32 pPlayer etc.

    if(Message == rezzcmd)
    {
    if(rezzon)
    if( rezzon ) {
    if (pPlayer->GetUInt32Value(PLAYER_FIELD_COINAGE)>=7500
    {
    Player->SetUInt32Value(PLAYER_FIELD_COINAGE,(pPlayer->GetUInt32Value(PLAYER_FIELD_COINAGE) - 7500));
    sEventMgr.AddEvent(pPlayer, &Player::RemoteRevive, EVENT_PLAYER_REST, 1, 1,0);
    } else pPlayer->BroadcastMessage("You don't have 75 silver in your backpack.");


    Your probably thinking wow... I don't understand a word of this.. But it's actually quite simple.
    Just ignore this part:

    if(Message == rezzcmd)
    {
    if(rezzon)
    if( rezzon ) {


    You may add parameters if you wish, but if your a begginer just keep it simple!

    if (pPlayer->GetUInt32Value(PLAYER_FIELD_COINAGE)>=7500
    {
    Player->SetUInt32Value(PLAYER_FIELD_COINAGE,(pPlayer->GetUInt32Value(PLAYER_FIELD_COINAGE) - 7500));

    Now what this part does is tells the system to take 75 silver from your backpack, and throw it into mid-air! Well it just pays for your rezzing cost.

    sEventMgr.AddEvent(pPlayer, &Player::RemoteRevive, EVENT_PLAYER_REST, 1, 1,0);
    } else pPlayer->BroadcastMessage("You don't have 75 silver in your backpack.");


    Oh NO! You don't have 75 silver in your backpack! Now you can't use your command.. That's pretty much what all that garbage does if you didnt have this it would take 75 silver regardless of you having enough money and the command would work!

    } else
    pPlayer->BroadcastMessage("You can't revive here!");
    else
    pPlayer->BroadcastMessage("You can't revive here!.");
    }
    }


    This should be pretty simple to understand "You can't revive here!"

    And the ending of the script..

    void SetupPlayerCommands(ScriptMgr * mgr)
    {
    mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, (void *) EventPlayerCommands);
    }


    Now.. Where it has PlayerCommands in the script change that to what ever you like! the SERVER_HOOK_EVENT_ON_CHAT will find the "#rezz" command and when you type this in game it will say.. hey that player just said #rezz to me.. I know what to do.. Ill rezz him at no cost to myself but charge him 75 silver !! MWahaaaaa
    Now thats all! Post any questions/feedback you have!


    Credits to descending.

    Originally Posted by descending
    Feel free to post it anywhere but remember to give credits
    Last edited by Osaid1; 09-05-2008 at 02:49 AM.

    Understanding Custom Commands
  2. #2
    runiker's Avatar Contributor
    Reputation
    105
    Join Date
    Nov 2007
    Posts
    501
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sweet u get 1 rep cookie today!

  3. #3
    Moffeman's Avatar Contributor

    Reputation
    277
    Join Date
    Sep 2007
    Posts
    731
    Thanks G/R
    1/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    +Repzoore from me x2

  4. #4
    *~Descending~*'s Avatar Member
    Reputation
    25
    Join Date
    Sep 2008
    Posts
    71
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for posting this and giving correct credits

  5. #5
    Osaid1's Avatar Banned
    Reputation
    45
    Join Date
    Apr 2008
    Posts
    49
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by *~Descending~* View Post
    Thank you for posting this and giving correct credits
    my pleasure ^^

Similar Threads

  1. Customizing Commands in Ascent
    By troy23 in forum World of Warcraft Emulator Servers
    Replies: 13
    Last Post: 06-25-2008, 09:35 AM
  2. CUstom Commands (HELP)
    By lol88998 in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 04-26-2008, 02:21 PM
  3. create custom commands
    By wowsc4p3 in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 04-23-2008, 06:59 AM
  4. [idea] Custom command for adding SQL codes?
    By Barlas the Death Knight in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 04-01-2008, 07:54 PM
  5. Custom Commands?
    By Illidan1 in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 10-31-2007, 09:18 PM
All times are GMT -5. The time now is 05:47 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search