OnplayerCommandReceived... Help here :( - 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: OnplayerCommandReceived... Help here :( (
/showthread.php?tid=538933)
OnplayerCommandReceived... Help here :( -
kesarthakur - 25.09.2014
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if(PlayerInfo[ playerid ][ isAFK ] == 1 && strcmp(cmdtext,"/back",true) && strcmp(cmdtext,"/unjail",true) && strcmp(cmdtext,"/uncage",true))
{
SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You are Now in AFK/BRB Mode! Try /back to use this cmd!");
return 0;
}
if((GetTickCount() - GetPVarInt(playerid, "SpamCMD")) < 1000*2)
{
GameTextForPlayer(playerid, "~r~Please wait 2 seconds", 1000, 3);
return 0;
}
SetPVarInt(playerid, "SpamCMD", GetTickCount());
return 1;
}
This is my code
and i wanted to get all the cmds written there to be working in that condition but only /back is working
please help me to fix this
thanks in advance
Re: OnplayerCommandReceived... Help here :( -
Vince - 25.09.2014
I don't see how that statement could ever work. If you type either of those commands, the value returned by strcmp will be 0, instantly rendering the whole statement false. This should be the correct logic:
pawn Код:
if(PlayerInfo[ playerid ][ isAFK ] == 1 && (!strcmp(cmdtext,"/back",true) || !strcmp(cmdtext,"/unjail",true) || !strcmp(cmdtext,"/uncage",true)))
Re: OnplayerCommandReceived... Help here :( -
kesarthakur - 25.09.2014
Thanks man