[Tutorial] [SC] Simple Commands 1 - 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] [SC] Simple Commands 1 (
/showthread.php?tid=319359)
[SC] Simple Commands 1 -
mikeeee - 18.02.2012
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
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;
}
}
Re: [SC] Simple Commands 1 -
[XST]O_x - 18.02.2012
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.
Re: [SC] Simple Commands 1 -
Vince - 18.02.2012
Horrible "tutorial". The code you posted won't even work.
Re: [SC] Simple Commands 1 -
emokidx - 19.02.2012
you haven't explained anything. i don't even know what the code will do.
Re: [SC] Simple Commands 1 -
Mr.Fames - 19.02.2012
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
Re: [SC] Simple Commands 1 -
mikeeee - 20.02.2012
Quote:
Originally Posted by Vince
Horrible "tutorial". The code you posted won't even work.
|
it works for me