Small problem with commands
#1

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
Reply
#2

Try putting it in OnCommandReceived. I'm not familiar with ZCMD as I use DCMD.
Reply
#3

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
Try putting it in OnCommandReceived. I'm not familiar with ZCMD as I use DCMD.
Thanks, it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)