Block commands in dm zone
#1

Hello, how can I block commands in dm zone?
Reply
#2

Anyone ? Please guys :/
Reply
#3

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;
}
Reply
#4

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.
Reply
#5

Thank you very much MattTucker!

+Rep for you
Reply
#6

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

+Rep for you
Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)