Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Results 1 to 5 of 5
  1. #1
    Grunt

    Join Date
    Aug 2008
    Posts
    41
    Post Thanks / Like
    Rep Power
    16
    Reputation
    41

    Understanding Custom Commands


    Register to remove this ad
    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!





    › See More: Understanding Custom Commands
    Last edited by Crux; 02-09-08 at 01:08 AM.



  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

  3. #2
    Scout
    Synthetic's Avatar
    Join Date
    Aug 2008
    Posts
    25
    Post Thanks / Like
    Rep Power
    16
    Reputation
    13
    That's so nice, very usefull for many people. Cus! it is VERY hard to make custom abilities without High-Script Knowledge.
    Synth's Scripting


    If u need somekind of help scripting? ask me! i'll gladly make u and simple script for free. These script lang's i know. C++ Blua Lua

  4. #3
    Grunt
    Hephaestus's Avatar
    Join Date
    Aug 2008
    Location
    Denmark
    Posts
    41
    Post Thanks / Like
    Rep Power
    16
    Reputation
    43
    Thanks for the share.


  5. #4
    Contributor
    StickyIcky's Avatar
    Join Date
    Jul 2008
    Location
    127.0.0.1
    Posts
    747
    Post Thanks / Like
    Rep Power
    18
    Reputation
    188
    for youuu

  6. #5
    Grunt

    Join Date
    Aug 2008
    Posts
    41
    Post Thanks / Like
    Rep Power
    16
    Reputation
    41

    Register to remove this ad
    Thanks for feedback.
    EDIT: You may post this guide on any forums as you wish, but don't forget the credits
    Last edited by Crux; 02-09-08 at 11:02 PM.

 

 

Visitors found this page by searching for:

WoW core commands

SEO Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 12:54 PM.
Powered by vBulletin® Copyright ©2000-2024, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org