SA-MP Forums Archive
Disable command while in deathmatch - 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: Disable command while in deathmatch (/showthread.php?tid=470518)



Disable command while in deathmatch - gotwarzone - 18.10.2013

Hi I have duel system and at the same time deathmatch command.

I want to disable the command /duel command while im in deathmatch. And if im in duel I want to disable the deathmatch command.

Please any idea how?


Re: Disable command while in deathmatch - Jankingston - 18.10.2013

it can be like

pawn Код:
if(PlayerInfo[playerid][pDeathmatch]  > 1 // if in deathmatch
{
       if(strcmp(cmd, "/duel", true) == 0)
       {
             SendClientMessage(playerid, "You can't use this while in deathmatch!");
               return 1;
}



Re: Disable command while in deathmatch - DanishHaq - 18.10.2013

pawn Код:
#include <a_samp>

new pDeathmatch[MAX_PLAYERS];
new pDuel[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    pDeathmatch[playerid] = 0;
    pDuel[playerid] = 0;
    return 1;
}

// Under your deathmatch command

if(pDuel[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "You're in a deathmatch, so you can't duel with anyone.");

// Under your duel command

if(pDeathmatch[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "You're in a duel, so you can't deathmatch at the moment.");

// Where your deathmatch command is successfull

pDeathmatch[playerid] = 1;

// Where your duel command is successfull

pDuel[playerid] = 1;

// Where the leave duel or the duel finishes

pDuel[playerid] = 0;

// Where the leave deathmatch or the deathmatch finishes

pDeathmatch[playerid] = 0;



Re: Disable command while in deathmatch - Jankingston - 18.10.2013

oops...i thought something wrong :P