Disabling Cmds
#1

Hi Guys,

Can Anybody tell me how to disable cmds with zcmd formula in races and DMs ?

Regards,
Compiler.
Reply
#2

Hello There,
So for disabling commands in Races and DM's
First create a variable
Код:
new IsPlayerInDMRACE[MAX_PLAYERS];
Then add the following
Код:
if(IsPlayerInDMRACE[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF,"/exit before you can use this command");
Now let's create a /exit command
Код:
CMD:exit(playerid, params[])
{
IsPlayerInDM[playerid] = 0;
SpawnPlayer(playerid);
return 1;
}
And now in your /race and /dm commands add the following
Код:
IsPlayerInDM[playerid] = 1;
Hope it works for you!
Reply
#3

first at the top of your script
Код:
new IsPlayerInDm[MAX_PLAYERS];
new IsPlayerInRace[MAX_PLAYERS];
then
PHP код:
OnPlayerCommandReceived(playeridcmdtext[])//this is a zcmd callback
{
    if(!
strcmp(cmdtext"/exit"true))//so  player can use exit to exit the DM/Race change if required
    
{
         return 
1;
    }
     if(
IsPlayerInRace[playerid]) return SendClientMessage(playerid,-1,"You cannot use commands in race");
     if(
IsPlayerInRace[playerid]) return SendClientMessage(playerid,-1,"Yo bro, you are in Race, cant use commands sorry");
return 
1;

EDIT: put this in the DM join command
Код:
IsPlayerInDM[playerid] = 1;
and this on race join
Код:
IsPlayerInRace[playerid] = 1;
Also put this on OnPlayerConnect and OnPlayerDisconnect
Код:
IsPlayerInDM[playerid] = 0;
IsPlayerInRace[playerid] = 0;
and you are done
Reply
#4

Secret , Deleted lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)