help - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help (
/showthread.php?tid=275471)
help -
omer5198 - 09.08.2011
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...
Re: help -
Tookie - 09.08.2011
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.
Re: help -
omer5198 - 09.08.2011
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...
Re : help -
Soumi - 09.08.2011
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.
Re: help -
omer5198 - 09.08.2011
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");
Re: help -
MadeMan - 09.08.2011
You want to disable all cmds except /bank when player is in bank?
Re : help -
Soumi - 09.08.2011
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.
Re: help -
omer5198 - 09.08.2011
Quote:
Originally Posted by MadeMan
You want to disable all cmds except /bank when player is in bank?
|
yes! finally someone who understands me!
Re: help -
MadeMan - 09.08.2011
What command processing system you use? strcmp? dcmd? zcmd?
Re: help -
omer5198 - 10.08.2011
strcmp
Re: help -
MadeMan - 10.08.2011
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.