17.06.2014, 02:32
Try this.
pawn Код:
new RobCount[MAX_PLAYERS];
CMD:robstore(playerid, params[])
{
if(robpossible == 1) //If the bank can be robbed we continue below
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 374.8841,-118.8026,1001.4995))
{//Next thing we do is, we check if we are at the bank interior ^^
robpossible = 0; //Then we set the bank so it cannot be robbed
SetTimer("waittimer", 900000, false); //Normal Mode 5 minutes
/*We run the timer(5 minutes) for the function that is going to make the
bank available for robbing again
*/
//SetTimer("waittimer", 65000, false); //Test Mode 65 seconds
SetTimer("robtimer", 15000, false);
SetTimerEx("robcount", 1000, false, "i", playerid);
RobCount[playerid] = 15;
SendClientMessage(playerid, -1, "INFO: 15 seconds remaining.");
/* We also run another timer(1 minute) for the function that is
actually going to give us the money and a user friendly message.
*/
/*
Add a function that would notify the police.
*/
SendClientMessage(playerid, COLOR_WHITE, "{FF0000}You are now Robbing {EAEA15}Well Stacked Pizza.");
GameTextForPlayer(playerid,"~Y~ROBBERY STARTED",3000,3);
SendClientMessage(playerid, COLOR_WHITE, "{1A94E6}You gotta stay here for 15 seconds.");
}
} else {
SendClientMessage(playerid, COLOR_WHITE, "You can't rob the bank right now!");
}
return 1;
}
forward robcount(playerid);
public robcount(playerid)
{
if(RobCount[playerid] != 0)
{
RobCount[playerid]--;
SetTimerEx("robcount", 1000, false, "i", playerid);
format(string, sizeof(string), "INFO: %d seconds remaining.", RobCount[playerid]);
SendClientMessage(playerid, -1, string);
}
// Send message that timer end or whatever.
return 1;
}