SA-MP Forums Archive
How to prevent this - 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: How to prevent this (/showthread.php?tid=499002)



How to prevent this - Dipto - 06.03.2014

Hi,
In my gamemode i have weapon spawner, and now when i made dm, i m getting a problem. The problem is, when i go to dm, player can spawn another weapon. but how to prevent this. i want something like, when u do /dm, you are not allowed to use any command withour /leave . Any idea ? please reply


Re: How to prevent this - GalaxyHostFree - 06.03.2014

REDIT:


Re: How to prevent this - Dipto - 06.03.2014

What ... i got no clue


Re: How to prevent this - rangerxxll - 06.03.2014

You'd need to add a variable such as:
pawn Код:
if(InDM[playerid] == 1) return SencDlientMessage(playerid,COLOR, "You can't use cmds in a death match.");
under every server command you have. To create the variable for a playerid, do this.
pawn Код:
new InDM[MAX_PLAYERS];
EDIT: If you have zcmd, I "think" you may be able to do this. Just add this callback.
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
       if(InDM[playerid] == 1) return SendClientMessage(playerid,COLOR, "You can't use commands while in a DM.");
       return 0;
}



Re: How to prevent this - SwisherSweet - 06.03.2014

Or you can make it a global variable...


Re: How to prevent this - rangerxxll - 06.03.2014

Well of course. If I didn't make it clear enough, I apologize. But yes, a global variable - which means placing it outside of a callback, usually at the top of your mode.


Re: How to prevent this - Dipto - 06.03.2014

yo guys, thanks a lot , speacially rangerxxll


Re: How to prevent this - rangerxxll - 06.03.2014

Not a problem buddy.


Re: How to prevent this - Dipto - 06.03.2014

You always help me, thanks one more time