[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
#2

In a tutorial You Must Explain steps.
Reply
#3

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.
Reply
#4

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

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.
Reply
#6

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"
Reply
#7

you should explain everything!
Reply
#8

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

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)