SA-MP Forums Archive
Block commands in dm zone - 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: Block commands in dm zone (/showthread.php?tid=496160)



Block commands in dm zone - Tadas - 20.02.2014

Hello, how can I block commands in dm zone?


Re: Block commands in dm zone - Tadas - 20.02.2014

Anyone ? Please guys :/


Re: Block commands in dm zone - MattTucker - 20.02.2014

Can you explain "block commands"?

If you mean like if he the player is inside DM he can't use a command? If so, create a new variable

pawn Код:
new inDM[MAX_PLAYERS];
Add it on top of your script and check the command that the player uses to join deathmatch

And add this inside the code

pawn Код:
inDM[playerid] = 1;
After that, check the command you want to block, for example "/hi" (just for illustration)

pawn Код:
CMD:hi(playerid, params[])
{
    if(inDM[playerid] == 1) return SendClientMessage(playerid, -1, "You can't use this command while being in dm zone!");
    GivePlayerMoney(playerid, 1000);
    return 1;
}
Full code:
pawn Код:
new inDM[MAX_PLAYERS]; // On top of the script

CMD:joindm(playerid, params[])
{
    // bla bla bla bla
    inDM[playerid] = 1; // You will need to place this line inside the code of the "joindm" or "dmzone" whatever it is
    // bla bla bla bla     ------- To define that the player is inside the DM zone.
    return 1;
}

CMD:hi(playerid, params[])
{
    if(inDM[playerid] == 1) return SendClientMessage(playerid, -1, "You can't use this command while being in dm zone!");
    // The above line is simple, if the player inside the DM zone, it will "return" (A.K.A stopping the command for him)
    // Sending that message.
    GivePlayerMoney(playerid, 1000);
    return 1;
}



Re: Block commands in dm zone - Unfriendly - 20.02.2014

You could try doing this using gangzones. Make invisible gangzones for the dm areas. Then check if a player is in any of those zones each time they do a command.


Re: Block commands in dm zone - Tadas - 21.02.2014

Thank you very much MattTucker!

+Rep for you


Re: Block commands in dm zone - MattTucker - 22.02.2014

Quote:
Originally Posted by Tadas
Посмотреть сообщение
Thank you very much MattTucker!

+Rep for you
Thank you