2019-09-24, 12:37 PM
PHP Code:
// Bank Robbery
new robbing[MAX_PLAYERS];
new alreadyrobbed[MAX_PLAYERS];
new robbingTimer[MAX_PLAYERS];
forward bankrob(playerid);
forward robbedoff(playerid);
public bankrob(playerid)
{
? ?new robcash = random(25000) 35000;
? ?SendClientMessage(playerid, COLOR_WHITE, " Your finished robbing the bank, Run now");
? ?GiveMoney(playerid, robcash);
? ?//SendClientMessage(playerid, COLOR_WHITE, "You've been rob {33CC33}%s{FFFFFF}Dollars from the bank vault.", FormatNumber(robcash));
? ?alreadyrobbed[playerid] = 1;
? ?robbing[playerid] = 0;
? ?robbingTimer[playerid] = SetTimerEx("robbedoff", 3600000, false, "i", playerid);
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
? ?SendClientMessageToAll(COLOR_WHITE, " It looks like the bankrobber got the cash.");
? ?SendClientMessageToAll(COLOR_WHITE, " The cops is currently waiting outside.");
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
? ?return 1;
}
public robbedoff(playerid)
{
? ?alreadyrobbed[playerid] = 0;
? ?SendClientMessage(playerid, COLOR_WHITE, " You can now rob the bank again [/report to ask an admin to approve.]");
? ?return 1;
}
PHP Code:
public OnPlayerDeath(playerid, killerid, reason)
{
? ?// Bank Robbey
? ?KillTimer(robbingTimer[playerid]);
? ?robbing[playerid] = 0;
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
? ?SendClientMessageToAll(COLOR_WHITE, " Los Santos Police have been caught the suspect. ");
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
return 1;
}
PHP Code:
public OnPlayerDisconnect(playerid, reason)
{
? ?/*// Bank Robbey
? ?KillTimer(robbingTimer[playerid]);
? ?robbing[playerid] = 0;
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
? ?SendClientMessageToAll(COLOR_WHITE, " Los Santos Police have been caught the suspect. ");
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");*/
PHP Code:
CMD:robbank(playerid, params[])
{
if(robbing[playerid] == 1)
? ? ? return SendErrorMessage(playerid, " You are already robbing the bank, please slow down");
? ?if(alreadyrobbed[playerid] == 1)
? ? ? return SendErrorMessage(playerid, "You already robbed the bank! Wait 1 hour.");
? ? ? ? ? ? ?
? if (!Inventory_HasItem(playerid, "C4"))
? ? ? return SendErrorMessage(playerid, "You don't have a C4.");
? ? ? ? ? ?
? ?if(!IsPlayerInRangeOfPoint(playerid, 5.0, 1435.3354,-981.6418,983.6462)) return SendErrorMessage(playerid, "You are not at the bank !");
? ?SendClientMessage(playerid, COLOR_WHITE, " You started to rob the bank, This will take 10 minutes");
? ?SetTimerEx("bankrob", 600000, false, "i", playerid);
? ?robbing[playerid] = 1;
? ?Inventory_Remove(playerid, "C4");
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
? ?SendClientMessageToAll(COLOR_WHITE, " The bank is currently getting robbed.");
? ?SendClientMessageToAll(COLOR_WHITE, " Los Santos Police units are on the way.");
? ?SendClientMessageToAll(COLOR_WHITE, " We will report more when we get more information");
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
? ?return 1;
}
when player die/quit its gives the msg of the suspect is down but if he stays online for 10min he still get the cash and also if he's relog after quiting he still get the cash after 10 minutes.
Also sometimes the?" Los Santos Police have been caught the suspect. " message showing for no reason
Have any idea how to fix it?