Maybe you want to make custom commands sometime for your server. Look here and learn:
void onCommand(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
{
if(Message == "#command") //If player message is #command do followning
{
pPlayer->EventTeleport(MAPID, X, Y, Z);
}
}
void SetupCommand(ScriptMgr * Mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, &onCommand); //Register the command
}
Here is the Explanation: (sorry, couldn't write it before, hadn't the time)
This is for the first a C++ script, just compile it to make it work.
void onCommand(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
this line over here, You declare the void OnCommand, so you can call this function later in any other function. This line is much more interesting:
if(Message == "#command")
so If player Message is (==) #command, then we do followning between these two { }
so it should look like this by now
void onCommand(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
{
if(Message == "#command")
{
Here we can code anything you want the player to do when entering the command. In this case we use an Teleport Event.
pPlayer->EventTeleport(MAPID, X, Y, Z);
MapID = The mapid of the map.
X = the X location.
Y = the Y location.
Z = the Z location.
just type .gps ingame to get these Coordinates at the spot your standing.
So this far we have declared an function, and if the player says: #command, you get teleported to your location.
But it ain't far from done yet, so we end the IF section with this character:
}
The script should look like this now :
void onCommand(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
{
if(Message == "#command")
{
pPlayer->EventTeleport(MAPID, X, Y, Z);
}
but now we have to finish the Function by another { letter:
void onCommand(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
{
if(Message == "#command")
{
pPlayer->EventTeleport(MAPID, X, Y, Z);
}
}
So now we just did a simple function. Now we only have to Register the function so it works ingame, we do that by another function:
void SetupCommand(ScriptMgr * Mgr)
{
The server call this function inside the DLL, just to register the #command event.
Now we have to register the command event. Do that by typing this in the SetupCommand function:
mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, &onCommand);
Note the white text, this text right here calls our earlier function OnCommand, just by placing character & in front of it.
Now we have done the command event, and soon the SetupCommand event, just by finishing it with this character }
}
Now it should look like this :
void onCommand(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
{
if(Message == "#command")
{
pPlayer->EventTeleport(MAPID, X, Y, Z);
}
}
void SetupCommand(ScriptMgr * Mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, &onCommand);
}
We have just written an .cpp script, hurray!
You just have to compile it to get it ingame. It is a bunch of compiler guides here at mmowned. Here is one of them:
http://www.mmowned.com/forums/emulat...r-own-dll.html