Question DM - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Question DM (
/showthread.php?tid=652336)
Question DM -
Hunud - 08.04.2018
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.
Re: Question DM -
kovac - 08.04.2018
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.