command ? - 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: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: command ? (
/showthread.php?tid=65926)
command ? -
luxeon - 17.02.2009
pawn Код:
if (strcmp("/cmd", cmdtext, true) == 0)
{
new var;
new tmp[256];
tmp = strtok(cmdtext, idx);
var = strval(tmp);
if(!strlen(tmp) || (var < 0 || var > 1))
{
SendClientMessage(playerid,COLOR_WHITE,"USAGE: /cmd [1/0]");
return 1;
}
else if(housestuff == 0)
{
print("zero");
return 1;
}
else if(housestuff == 1)
{
print("one");
return 1;
}
}
If i type /cmd <something> - nothing happens.
If i type /cmd - gives me tutorial how to write.
Any Ideas..?
Re: command ? -
luxeon - 17.02.2009
up
Re: command ? -
luxeon - 18.02.2009
up
Re: command ? -
DaRkDeViiL - 19.02.2009
Use this:
Код:
if(strcmp(cmd, "/cmd", true) == 0)
{
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_WHITE,"USAGE: /cmd [1/0]");
return 1;
}
if(strcmp(tmp,"0",true) == 0)
{
print("zero");
return 1;
}
else if(strcmp(tmp,"1",true) == 0)
{
print("one");
return 1;
}
else // Other = Error message
{
SendClientMessage(playerid, COLOR_WHITE, "ERROR: /cmd [1/0]");
return 1;
}
}