#1

i have:
Код:
new InBank[MAX_PLAERS];
but how can i check if the player is in the bank and *not* writing the command "/bank"... because i want him to be able to use /bank for getting out of the bank but not any other command...
Reply
#2

pawn Код:
COMMAND:bank(playerid, params[])
{
    If(InBank == 1)
    {
         //Your shit here.
    }
    else
    {
        //Other shit.
    }
    return 1;
}
Hope that this works, and please could I get +1 rep.
Reply
#3

you didn't understand me... i don't want to check if the player is in the bank while he doing the command... i want to check if he is in the bank and *not* doing the command... b.t.w: you forgot: InBank[playerid]...
i ment for something like this:
if(InBank[playerid] == 1 && strcmp(cmd, "/bank", true) == 0) return ... but i want to check if he doesn't do the command...
Reply
#4

When a player enters the bank you need to make
Код:
InBank[playerid] = 1
and when he's not inside the bank make the variable value must be set to 0. and here's your command.

pawn Код:
COMMAND:bank(playerid, params[])
{
    If(InBank[playerid] == 0) SendClientMessage(playerid, COLOR_WHITE, "You're not inside the bank");
    return 1;
}
If this didn't help you please explain more.
Reply
#5

its pretty hard to explain... but i want to check if the player is in the bank before i do the command... like if he IS in the bank AND typing the command /BANK it will do something... else... return
Код:
SendClientMessage(playerid, COLOR, "You cannot do command while in the bank");
Reply
#6

You want to disable all cmds except /bank when player is in bank?
Reply
#7

pawn Код:
COMMAND:bank(playerid, params[])
{
    If(InBank[playerid] == 0) SendClientMessage(playerid, COLOR_WHITE, "You're not inside the bank");
    else
    {
         SendClientMessage(COLOR_RED, "Someone started a robbery!");
         GivePlayerMoney(playerid, 5000);
         SendClientMessage(playerid, COLOR_WHITE, "You have successfully robbed the bank, be careful from cops!");
    }
    return 1;
}
Here's an example. this will send "You're not inside the bank" if the player types the command while not being in the bank otherwise, it send this message to all the players "Someone started a robbery!" and give this player $5000.
Reply
#8

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
You want to disable all cmds except /bank when player is in bank?
yes! finally someone who understands me!
Reply
#9

What command processing system you use? strcmp? dcmd? zcmd?
Reply
#10

strcmp
Reply
#11

pawn Код:
if(InBank[playerid] == 1 && strcmp(cmd, "/bank", true) != 0)
{
    SendClientMessage(playerid, COLOR, "You cannot do command while in the bank");
    return 1;
}
Put this at the beginning of OnPlayerCommandText.
Reply


Forum Jump:


Users browsing this thread: