In the DM mode how to prohibit players to use the command -
oppo1234 - 04.06.2015
In the DM mode how to prohibit players to use the command
Re: In the DM mode how to prohibit players to use the command -
RaeF - 04.06.2015
Use if statement.
Re: In the DM mode how to prohibit players to use the command -
Gammix - 04.06.2015
If you are using OnPlayerCommandText, then simply return 0 or 1 whenever a player types one, must be on the top.
Example:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(dm_check[playerid]) return SendClientMessage(playerid, -1, "You cannot use commands while you are in DM.");
return 1;
}
SendClientMessage always return 1, so no Unknown Command error will appear. In case you want to enable some commands. Declare this code under those commands. Make sure you have a returning value in those commands.
In case of zcmd, we'll do same but in zcmd's custom callback:
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if(dm_check[playerid]) return SendClientMessage(playerid, -1, "You cannot use commands while you are in DM.");
return 1;
}
NOTE:
dm_check[playerid] is your variable or boolean which checks if the player is in deathmatch or not.
You can also perform those checks in each command.
Re: In the DM mode how to prohibit players to use the command -
oppo1234 - 04.06.2015
Quote:
Originally Posted by Gammix
If you are using OnPlayerCommandText, then simply return 0 or 1 whenever a player types one, must be on the top.
Example:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if(dm_check[playerid]) return SendClientMessage(playerid, -1, "You cannot use commands while you are in DM."); return 1; }
SendClientMessage always return 1, so no Unknown Command error will appear. In case you want to enable some commands. Declare this code under those commands. Make sure you have a returning value in those commands.
In case of zcmd, we'll do same but in zcmd's custom callback:
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[]) { if(dm_check[playerid]) return SendClientMessage(playerid, -1, "You cannot use commands while you are in DM."); return 1; }
NOTE: dm_check[playerid] is your variable or boolean which checks if the player is in deathmatch or not.
You can also perform those checks in each command.
|
Thankes you
Re: In the DM mode how to prohibit players to use the command -
oppo1234 - 04.06.2015
D:\samp037_svr_R1_win32\gamemodes\pickup.pwn(103) : error 029: invalid expression, assumed zero
D:\samp037_svr_R1_win32\gamemodes\pickup.pwn(103) : warning 215: expression has no effect
D:\samp037_svr_R1_win32\gamemodes\pickup.pwn(103) : error 001: expected token: ";", but found "]"
D:\samp037_svr_R1_win32\gamemodes\pickup.pwn(103) : error 029: invalid expression, assumed zero
D:\samp037_svr_R1_win32\gamemodes\pickup.pwn(103) : fatal error 107: too many error messages on one line
Appear such errors?How do