[Tutorial] [SC] Simple Commands 1
#1

Hello it's ya boy Jay here for a simple command tut

ZCMDS i cant help you and this is a simple command promote not a ruff ryder style

ok lets start with
pawn Код:
#include <a_samp>
ok now we have that out the way lets make a couple commands

pawn Код:
public OnPlayerText(playerid, text[]) //if you use this we will need to add a cmd[256] to make it right
{
        new cmd[256];
    if (strcmp(cmd, "/player1", true)==0)
    {
    return 1;
    }
}
pawn Код:
public OnPlayerText(playerid, text[]) //Ok now if your using a different name for the same command and you need to save space
{
        new cmd[256];
    if (strcmp(cmd, "/player1", true)==0 || strcmp(cmd, "/player2", true)==0)
    {
    return 1;
    }
}
pawn Код:
public OnPlayerText(playerid, text[]) //Ok now your trying to add [ON/OFF] or [1/2/3/4/5] or something
{
        new cmd[256];
    if (strcmp(cmd, "/player1", true)==0 || strcmp(cmd, "/player2", true)==0)
    {
        if (strcmp(cmd, "1", true)==0)//if
        {
        }
        else if (strcmp(cmd, "2", true)==0)//else if
        {
        }
    return 1;
    }
}
Reply
#2

What?
There's a callback called OnPlayerCommandText for this.

And the cmd array variable is null, you didn't even format anything in it so how can you compare it to the command "/player1" ?

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext,"/player1"))
    {
        return 1;
    }
    return 0;
}
Save a whole lot of time and space, and also works.
Reply
#3

Horrible "tutorial". The code you posted won't even work.
Reply
#4

you haven't explained anything. i don't even know what the code will do.
Reply
#5

1.Tutorial Not explained you didn't put it there for people to learn i think (you put it there for rep+)
2.Do you even know what the code does
3.strcmp is old Use ZCMD
Reply
#6

Quote:
Originally Posted by Vince
Посмотреть сообщение
Horrible "tutorial". The code you posted won't even work.
it works for me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)