SA-MP Forums Archive
Disable user from using all commands but one - 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: Disable user from using all commands but one (/showthread.php?tid=569896)



Disable user from using all commands but one - Sellize - 03.04.2015

I am using ZCMD and want to prevent the user from using all commands but one. How can I do this?


Re: Disable user from using all commands but one - JeaSon - 03.04.2015

i suggest you to use threshold block and unblock command system which simple but dynamic

https://sampforum.blast.hk/showthread.php?tid=568459


Re: Disable user from using all commands but one - Sellize - 03.04.2015

Quote:
Originally Posted by JeaSon
Посмотреть сообщение
i suggest you to use threshold block and unblokc command system which simple but dynamic

https://sampforum.blast.hk/showthread.php?tid=568459
This is not what I need.
I need the player to be able to join a deathmatch and in the deathmatch the only command he can use is /exit.


Re: Disable user from using all commands but one - JeaSon - 03.04.2015

than i suggest you to use hash


pawn Код:
at top of your script and then use NocommandInMinigame() in every command

#define NoCommandInMinigame() if(IsPlayerInMinigame[playerid] == 1) return SendClientMessage(playerid, -1, "use /kill to exit ( only kill cmd will work in deathmatch)" );



Re: Disable user from using all commands but one - Sellize - 03.04.2015

Actually I found the answer myself:

PHP код:
public OnPlayerCommandReceived(playeridcmdtext[])
{
    if(
specBoxing[playerid] == 1)
    {
        if(
strcmp(cmdtext"/exit"15)) return 1;
        
SendClientMessage(playerid, -1"{FF0000}You are currently spectating the boxing arena. Use /exit to leave it.");
        return 
0;
    }
    return 
1;




Re: Disable user from using all commands but one - CalvinC - 03.04.2015

That's not needed, you can just use OnPlayerCommandReceived.
Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/mycommand", true)) return 0;
	return 1;
}
Where /mycommand is the only command you can use.

EDIT: Oops, posted at the same time.