Robbery
#1

Hello guys i want to ask that how to make only one player rob the store or big robbery places like bank cause at this moment in my server if a player is robbing other player can also rob at that particular time so please help me?
Reply
#2

Just create a new variable which checks with the server if the bank is being robbed. If someone robs the bank the variable is set to 1 (true) and when the next player comes to rob the bank the script checks if the variable is true or false. If it's true, then just send a message saying that it's being robbed already.
Reply
#3

Can you make that for me cause i'm not that good in making variables still a noobish scripter
Reply
#4

As explained above, assign a variable for example

Код:
new Bankrob = 0;
CMD:robbank(playerid,params[]) // or whatever Command Processor are you using.
{
if(Bankrob = 0)
{
 // do your code when player can rob bank.
Bankrob = 1; // THIS IS THE MAIN!!!!
} else { SendClientMessage(playerid,-1,"The bank is already being robbed.");
}
That's just an example, sorry for not explaining enough im on my phone.
Reply
#5

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
As explained above, assign a variable for example

Код:
new Bankrob = 0;
CMD:robbank(playerid,params[])
{
if(Bankrob = 0)
{
 // do your code when player can rob bank.
Bankrob = 1; // THIS IS THE MAIN!!!!
} else { SendClientMessage(playerid,-1,"The bank is already being robbed.");
}
That's just an example, sorry for not explaining enough im on my phone.
As explained but you obviously need to create some kind of timer aswell so that when the time finnishes the variable is set to 0.
Reply
#6

Quote:
Originally Posted by Mystique
Посмотреть сообщение
As explained but you obviously need to create some kind of timer aswell so that when the time finnishes the variable is set to 0.
This ^
Reply
#7

Yes but i use Mysql DB will this work on there?
Reply
#8

Quote:
Originally Posted by Crazydriver
Посмотреть сообщение
Yes but i use Mysql DB will this work on there?
As long as you don't want the variable to be saved when restarting the server and continue after the restart you won't need mysql. Just use the SetTimer function. Search the forum about how to use it.
Reply
#9

I just lend the topic a bit, I have a similar question..

How to make so you can't rob it again if you already robbed it recently?.

I think it will work with a timer and a variable?
Reply
#10

Quote:
Originally Posted by davve95
Посмотреть сообщение
I just lend the topic a bit, I have a similar question..

How to make so you can't rob it again if you already robbed it recently?.

I think it will work with a timer and a variable?

If you mean that if you rob the bank you can't rob it again for example 1 hour. Yes, then it works with a player variable and a timer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)