SA-MP Forums Archive
[Tutorial] Simple "/kill", "/heal" and "/tp" commands - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Simple "/kill", "/heal" and "/tp" commands (/showthread.php?tid=297947)



Simple "/kill", "/heal" and "/tp" commands - KosmasRego - 18.11.2011

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.


Re: Simple "/kill", "/heal" and "/tp" commands - CSSI - 18.11.2011

In a tutorial You Must Explain steps.


Re: Simple "/kill", "/heal" and "/tp" commands - Kostas' - 18.11.2011

A tutorial is one method of transferring knowledge and may be used as a part of a learning process.
You should explain every line to people what it does. By copy paste the commands, no one will gonna learn it.


Re: Simple "/kill", "/heal" and "/tp" commands - KosmasRego - 18.11.2011

Who told you I copied then pasted the cmds? the tutorial is saying it all.


Re: Simple "/kill", "/heal" and "/tp" commands - Kostas' - 18.11.2011

I didn't tell that you copied and paste the commands. But the people will read it , they will just copy the commands and paste them on their Gamemode or FS. The point is that tutorial needs to explain every line, so the people can understand it, how it works, what it does and try to make it.


Re: Simple "/kill", "/heal" and "/tp" commands - Vince - 18.11.2011

Sigh. Another total failure.
  1. Nothing explained
  2. Still using strcmp and ignoring its length parameter
  3. This won't even work as it'll give an error (undefined symbol 'cmd')
  4. Didn't bother to read Y_Less' sticky topic
  5. Didn't bother to search for similar "tutorials"



Re: Simple "/kill", "/heal" and "/tp" commands - Astralis - 18.11.2011

you should explain everything!


Re: Simple "/kill", "/heal" and "/tp" commands - SmiT - 18.11.2011

https://sampforum.blast.hk/showthread.php?tid=65567


Re: Simple "/kill", "/heal" and "/tp" commands - Max_Coldheart - 18.11.2011

Fail tutorial.

Why?
  1. Don't use STRCMP anymore. (use ZCMD or Y_CMD instead)
  2. You aren't explaining anything (which you should do in tutorial)
  3. You most probably just copy-pasted this tutorial.



Re: Simple "/kill", "/heal" and "/tp" commands - NessaHD - 18.11.2011

Guys, the tutorial says 'simple' commands. Zcmd and Ycmd is more advanced. But i agree with the other, explain a lot more..