[Tutorial] Simple Commands+Explain
#1

i know that there was many spams on this but anyway i will try to explain.
pawn Код:
// lets try a simple command like heal
if(strcmp, "/heal", cmd, true, 10) == 0)
 SetPlayerHealth(playerid, 100); // so what is this thing? set player heal? what does it mean? it means that when player command /heal its setting hes hp 100
// so if you want to do that command it will look like that:
if(strcmp, "/heal", cmd, true, 10) == 0)
    {
         SetPlayerHealth(playerid, 100); // Do you see the set player health? we explaind it up there :)
         return 1;
    }
// now do think how do we do /kill? so its very easy! just copy the whole heal command and on the playerid, 100 you
// replace the 100 with 0 and the /heal with kill. easy right?
// got it?
// now lets do some other commads.
// here is a command that if player wants a kick, he will get if for sure :).
}
    if (strcmp("/kickme", cmdtext, true, 10) == 0) {
        {SendClientMessage(playerid, 0x33FF33AA, "you wanted a kick and got it :D");
Kick(playerid);return 1;}
}
// now you want pepole to see those commands right? very simple!
if (strcmp("/commands", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, 0xFFBB00,"Commands: /kickme /heal ");
return 1;
}
// sendclinetmessage? what the hell is that?
// it means that it sends the player (playerid) what that you wrote there!
well i dont have time to add more but i will try to add more and explain more......
hope that it will help new scriptrs...
noder51
or as my scripting name Ninjaa
thanks for looking at this
Reply
#2

Perhaps you could also explain under what callback those commands should go. Another thing - I don't see the part where you have declared the variable "cmd" so probably the user who follows this tutorial will get an error telling him the "cmd" symbol is undefined - I suggest you ident your code better.

pawn Код:
if (strcmp("/kickme", cmdtext, true, 10) == 0) {
        {SendClientMessage(playerid, 0x33FF33AA, "you wanted a kick and got it :D");
Kick(playerid);return 1;}
}
Why are you using two blocks since 1 is enough? -

pawn Код:
if ( strcmp ( "/kickme", cmdtext, true, 10 ) == 0 ) {
        SendClientMessage( playerid, 0x33FF33AA, "you wanted a kick and got it :D" );
        Kick(playerid); return 1;
    }
Reply
#3

lol you edit
Reply
#4

What are you talking about? Also, why would you teach new people creating those "simple" commands using strcmp which is old and slow rather then using a faster method?

Quote:
Originally Posted by noder51
Посмотреть сообщение
well i dont have time to add more but i will try to add more and explain more......
Well, if you don't have time why did you created this thread now when you could "add" more and "explain" more in your free time? I suggest you to read How to write a tutorial.
Reply
#5

i told you its my first tut.....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)