Problem with rob - 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: Problem with rob (
/showthread.php?tid=615519)
Problem with rob -
Hunud - 23.08.2016
I have problem when i rob bank cash is going to another player not me who rob
Код:
public RobTime(playerid)
{
new string[128];
new cash = random(100000);
GivePlayerMoney(playerid, cash);
gPlayerRobbing[playerid] = false;
KillTimer(general_timer);
format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash);
SendClientMessage(playerid, red, string);
}
Re: Problem with rob -
Shinja - 23.08.2016
Show the part where you start the timer
Re: Problem with rob -
Hunud - 23.08.2016
Код:
CMD:rob(playerid, params[])
{
if(IsPossible == 1)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 2309.3491,-14.6412,26.7422))
{
}
else return SendClientMessage(playerid, red, "You must be inside");
{
IsPossible = 0;
SetTimer("Waittimer", 300000, false);
general_timer = SetTimer("RobTime", 60000, false);
SendClientMessage(playerid, red, "You are robbing the bank!");
SendClientMessage(playerid, red, "You gonna stay 19 seconds in the bank in order to rob it!");
gPlayerRobbing[playerid] = true;
}
} else {
SendClientMessage(playerid, red, "You can't rob the bank right now!");
}
return 1;
}
Re: Problem with rob -
Shinja - 23.08.2016
Change your timers to SetTimerEx, and your
new general_timer; to
new general_timer[MAX_PLAYERS];
PHP код:
SetTimerEx("Waittimer", 300000, false, "i", playerid);
general_timer[playerid] = SetTimerEx("RobTime", 60000, false, "i", playerid);
And in public RobTime and everywhere else where you used general_timer, add playerid like
PHP код:
public RobTime(playerid)
//KillTimer(general_timer);
KillTimer(general_timer[playerid]);
Re: Problem with rob -
DarkSkull - 23.08.2016
Try:
PHP код:
general_timer = SetTimerEx("RobTime", 60000, false, "i", playerid);
EDIT: Shinja was faster
Re: Problem with rob -
Shinja - 23.08.2016
Quote:
Originally Posted by DarkSkull
Try:
PHP код:
general_timer = SetTimerEx("RobTime", 60000, false, "i", playerid);
EDIT: Shinja was faster
|
Yeah and bro you forgot, general_timer[MAX_PLAYERS]
Re: Problem with rob -
DarkSkull - 23.08.2016
Quote:
Originally Posted by Shinja
Yeah and bro you forgot, general_timer[MAX_PLAYERS]
|
Oh yeah My bad. Now I'm glad you were faster