[Tutorial] Simple "/kill", "/heal" and "/tp" commands
#1

In this tutorial I will show you some simple commands such as heal, kill and tp. Those commands are useful for a beginer scripter and let him learn some of scripting basics. Follow the following steps:

1. Open your server's folder.
2. Go to the "Pawno" folder and run pawno.exe file.
3. Click the folder icon in the pawno and browse your .pwn GM.
4. Hit CTRL + F.
5. A searching tool windown should pop-up. Search for OnPlayerCommandText and do the following:

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp, "/kill", cmd, true, 10) == 0)
    {
         SetPlayerHealth(playerid, 0);
         SendClientMessage(playerid, [COLORHERE], "You died.");
         return 1;
    }
    if(strcmp, "/heal", cmd, true, 10) == 0)
    {
         GivePlayerMoney(playerid, -100); // Edit the money if you want
         SetPlayerHealth(playerid, 100); // You can also edit the health healing here
         SendClientMessage(playerid, [COLORHERE], "You have healed yourself for $100.");
         return 1;
    }
    if(strcmp, "/tp", cmd, true, 10) == 0)
    {
         SetPlayerPos(playerid, [PosX], [PosY], [PosZ]);
         SendClientMessage(playerid, [COLORHERE], "You have been teleported.");
         return 1;
    }
    return 0;
}
The end of the tutorial. For any questions feel free to post a comment.
Reply


Messages In This Thread
Simple "/kill", "/heal" and "/tp" commands - by KosmasRego - 18.11.2011, 15:54
Re: Simple "/kill", "/heal" and "/tp" commands - by CSSI - 18.11.2011, 15:57
Re: Simple "/kill", "/heal" and "/tp" commands - by Kostas' - 18.11.2011, 16:00
Re: Simple "/kill", "/heal" and "/tp" commands - by KosmasRego - 18.11.2011, 16:02
Re: Simple "/kill", "/heal" and "/tp" commands - by Kostas' - 18.11.2011, 16:07
Re: Simple "/kill", "/heal" and "/tp" commands - by Vince - 18.11.2011, 16:07
Re: Simple "/kill", "/heal" and "/tp" commands - by Astralis - 18.11.2011, 16:11
Re: Simple "/kill", "/heal" and "/tp" commands - by SmiT - 18.11.2011, 16:42
Re: Simple "/kill", "/heal" and "/tp" commands - by Max_Coldheart - 18.11.2011, 17:11
Re: Simple "/kill", "/heal" and "/tp" commands - by NessaHD - 18.11.2011, 22:03

Forum Jump:


Users browsing this thread: 7 Guest(s)