• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Bank Robbery System [HELP!]
#2
Main problem timer dont stop, when he
Quote:robbedoff

I fix your code, and fix some other issues.



Download link | Solidfiles.com





Put this code at top of your codes and use function, dont need forward and public same time



Code:
#define function%0(%1) forward%0(%1); public%0(%1)



Variables





Code:
new bankrobberid;

new alreadyrobbed;

new bankreadytorobTimer;



new robbing[MAX_PLAYERS];

new robbingTimer[MAX_PLAYERS];



Command





Code:
CMD:robbank(playerid, params[])

{

if(robbing[playerid] == 1)return SendErrorMessage(playerid, " You are already robbing the bank, please slow down");

if(alreadyrobbed == 1)return SendErrorMessage(playerid, "Someone 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");

robbingTimer[playerid] = SetTimerEx("bankrobend", 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;

}



OnPlayerDeath



Code:
public OnPlayerDeath(playerid, killerid, reason)

{

if(robbing[playerid] == 1)

{

// 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;

}



OnPlayerDisconnect





Code:
public OnPlayerDisconnect(playerid, reason)

{

if(robbing[playerid] == 1)

{

// 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;

}



Other?Functions



Code:
function bankrobend(playerid)

{

new S[128];

new robcash = random(25000)  35000;

SendClientMessage(playerid, COLOR_WHITE, " Your finished robbing the bank, Run now");

GiveMoney(playerid, robcash);

format(S, sizeof(S), "You've been rob {33CC33}%d{FFFFFF} Dollars from the bank vault.", robcash)

SendClientMessage(playerid, COLOR_WHITE, S);

alreadyrobbed = 1;

robbing[playerid] = 0;

bankrobberid = playerid;

KillTimer(robbingTimer[playerid]);

bankreadytorobTimer = SetTimer("readytorob", 18000000, true);

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;

}



function readytorob()

{

alreadyrobbed = 0;

KillTimer(bankreadytorobTimer);

SendClientMessage(bankrobberid, COLOR_WHITE, " You can now rob the bank again [/report to ask an admin to approve.]");

bankrobberid = -1;

return 1;

}
  Reply


Messages In This Thread
Bank Robbery System [HELP!] - by Fuzzy - 2019-09-24, 12:37 PM
RE: Bank Robbery System [HELP!] - by akosd127 - 2020-03-15, 12:26 AM

Forum Jump: