Disable user from using all commands but one
#1

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

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

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

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.
Reply
#4

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)" );
Reply
#5

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;

Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)