Question DM
#1

Hi.

How do i prevent using any command while in DM by using 'OnPlayerCommandReceived' . But i'll be only able to use command to leave dm. Any example ? I'm tired of repeating if(x == 1 in every command.
Reply
#2

PHP код:
new bool:IsInDM[MAX_PLAYERS];
//You can create a variable and make it true when player enters DM, and false on exit and disconnect.
//So the code should be like this;
public OnPlayerCommandPerformed(playeridcmdtext[ ], success)
{
    if(
success == 0) return SendClientMessage(playerid, -1"ERROR: This command does not exist.");
    if(
IsInDM[playerid]) return SendClientMessage(playerid, -1"ERROR: You can't use commands while in DM.");
    return 
1;

I don't know if there is a way to make an exception for a command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)