SA-MP Forums Archive
DM[playerid] = 1; - 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: DM[playerid] = 1; (/showthread.php?tid=387067)



DM[playerid] = 1; - xplor09edy - 23.10.2012

Solved!


Re: DM[playerid] = 1; - newbienoob - 23.10.2012

Put
Код:
if(DM[playerid] == 1) return SendClientMessage(playerid,-1,"You can't use this command since you are dm'ing!");
at your commands. Example:
Код:
CMD:heal(playerid,params[])
{
     if(DM[playerid] == 1) return SendClientMessage(playerid,-1,"You can't use this command since you are dm'ing!);
     SetPlayerHealth(playerid,100);
     return 1;
}



Re: DM[playerid] = 1; - xplor09edy - 23.10.2012

solved but wihtour your help newbien noob :P because with your idee i need muccch time, because i have 100+ commands!


Re: DM[playerid] = 1; - denNorske - 23.10.2012

If you want only one command to work, you could check out this:

Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(DM[playerid] == 1 && strfind(cmdtext,"exitdm",true) == -1) //That will make only "/exitdm" to work, and none of the other commands.
    {
        SendClientMessage(playerid,-1,EMBED_RED"[ERROR]: "EMBED_WHITE"You can not use commands inside of a DM, please use "EMBED_RED"/exitdm"EMBED_WHITE".");
        return 0;
    }
	return 1;
}
only an Example