Posts: 484
Threads: 189
Joined: Jun 2016
Reputation:
0
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.
Posts: 180
Threads: 3
Joined: Mar 2018
08.04.2018, 13:45
(
Последний раз редактировалось kovac; 08.04.2018 в 14:39.
)
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(playerid, cmdtext[ ], 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.