/togphone command not working - 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)
+--- Thread: /togphone command not working (
/showthread.php?tid=568737)
/togphone command not working -
Denis1 - 24.03.2015
Here's the code:
http://pastebin.com/gk1iqd9i
Sorry I didn't bother to copy the code and place it here, on the forums. (line 65 anyway)
If anyone could help me figure out what is the problem, that would make really happy.
Re: /togphone command not working -
CalvinC - 24.03.2015
First, instead of all this:
pawn Код:
if(isnull(params)) return SendClientMessage(playerid, LIGHT_GRAY, "{EE7181}USAGE{C0C0C0}: /togphone [on/off]");
new input[8] = "on off";
sscanf(input, "ss", PHONE_STATUS_ON, PHONE_STATUS_OFF);
You should just use the isnull, there's really no reason to use new input or sscanf.
Second, use strcmp to compare 2 strings.
Etc instead of:
pawn Код:
if(params[4] == PHONE_STATUS_ON)
It should be:
pawn Код:
if(!strcmp(params, "PHONE_STATUS_ON", true))
And same with the PHONE_STATUS_OFF.
Re: /togphone command not working -
Denis1 - 24.03.2015
Thanks for the answer.