Small problem with commands - 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: Small problem with commands (
/showthread.php?tid=565764)
Small problem with commands -
FunnyBear - 01.03.2015
Hey,
I made an AFK system, and I wanted to block players who are AFK from using
ANY commands at all. But I have a problem. I added it so you can't use any commands whilst AFK, and you can still use the command but the message will come up.
For e.g, if I'm AFK and I use /kill, a message will be sent saying "You cannot use commands whilst AFK", but the command still works. I use ZCMD
Here is the code,
Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
if(!success )
return SendClientMessage( playerid, 0xFF0000FF, "Command not found! Please try again, or use /cmds to view a list of working commands." );
if(afk[playerid] == 1)
return Error(playerid, "You cannot use any commands whilst AFK"), 0;
return 1;
}
Thanks
Re: Small problem with commands -
ATGOggy - 01.03.2015
Try putting it in OnCommandReceived. I'm not familiar with ZCMD as I use DCMD.
Re: Small problem with commands -
FunnyBear - 01.03.2015
Quote:
Originally Posted by ATGOggy
Try putting it in OnCommandReceived. I'm not familiar with ZCMD as I use DCMD.
|
Thanks, it works.