SHOW:
|
|
- or go back to the newest paste.
| 1 | /* | |
| 2 | This script/application is created by UnlimitedDeveloper from SAMP forums | |
| 3 | and it's supposed to be shared only at SAMP forums, nowhere else! | |
| 4 | If any copy of this script is found on another forum, it will be taken down. | |
| 5 | */ | |
| 6 | #include <a_samp> | |
| 7 | #include <zcmd> | |
| 8 | ||
| 9 | #define COLOR_WHITE 0xFFFFFFAA | |
| 10 | ||
| 11 | //Function forwarding | |
| 12 | /* | |
| 13 | Firstly we have to forward the functions that we are going | |
| 14 | to use later in our sript. | |
| 15 | */ | |
| 16 | forward robtimer(playerid); | |
| 17 | forward waittimer(); | |
| 18 | ||
| 19 | //Variables | |
| 20 | /* | |
| 21 | We are adding a NEW Variable so we can determine wether the bank | |
| 22 | can or cannot be robber at a certain time. | |
| 23 | */ | |
| 24 | - | new robpossible; |
| 24 | + | new |
| 25 | robpossible, | |
| 26 | general_timer, | |
| 27 | bool:gPlayerRobbing[MAX_PLAYERS] | |
| 28 | - | /* |
| 28 | + | ; |
| 29 | - | When the filterscript executes itself it's setting the 'robpossible' |
| 29 | + | |
| 30 | - | variable to 1 which means that we can rob the bank right after we login. |
| 30 | + | |
| 31 | - | */ |
| 31 | + | |
| 32 | - | robpossible = 1; |
| 32 | + | /* |
| 33 | When the filterscript executes itself it's setting the 'robpossible' | |
| 34 | variable to 1 which means that we can rob the bank right after we login. | |
| 35 | */ | |
| 36 | robpossible = 1; | |
| 37 | return 1; | |
| 38 | } | |
| 39 | - | if(robpossible == 1) //If the bank can be robbed we continue below |
| 39 | + | |
| 40 | - | {
|
| 40 | + | |
| 41 | - | if(IsPlayerInRangeOfPoint(playerid, 3.0, 2309.1899,-8.4444,26.7422)) |
| 41 | + | |
| 42 | - | {//Next thing we do is, we check if we are at the bank interior ^^
|
| 42 | + | |
| 43 | - | robpossible = 0; //Then we set the bank so it cannot be robbed |
| 43 | + | if(robpossible == 1) //If the bank can be robbed we continue below |
| 44 | - | SetTimer("waittimer", 300000, false); //Normal Mode 5 minutes
|
| 44 | + | {
|
| 45 | - | /*We run the timer(5 minutes) for the function that is going to make the |
| 45 | + | if(IsPlayerInRangeOfPoint(playerid, 3.0, 2309.1899,-8.4444,26.7422)) |
| 46 | - | bank available for robbing again |
| 46 | + | {//Next thing we do is, we check if we are at the bank interior ^^
|
| 47 | - | */ |
| 47 | + | robpossible = 0; //Then we set the bank so it cannot be robbed |
| 48 | - | //SetTimer("waittimer", 65000, false); //Test Mode 65 seconds
|
| 48 | + | SetTimer("waittimer", 300000, false); //Normal Mode 5 minutes
|
| 49 | - | SetTimer("robtimer", 60000, false);
|
| 49 | + | /*We run the timer(5 minutes) for the function that is going to make the |
| 50 | - | /* We also run another timer(1 minute) for the function that is |
| 50 | + | bank available for robbing again |
| 51 | - | actually going to give us the money and a user friendly message. |
| 51 | + | */ |
| 52 | - | */ |
| 52 | + | //SetTimer("waittimer", 65000, false); //Test Mode 65 seconds
|
| 53 | - | /* |
| 53 | + | general_timer = SetTimer("robtimer", 60000, false);
|
| 54 | - | Add a function that would notify the police. |
| 54 | + | /* We also run another timer(1 minute) for the function that is |
| 55 | - | */ |
| 55 | + | actually going to give us the money and a user friendly message. |
| 56 | - | SendClientMessage(playerid, COLOR_WHITE, "You are robbing the bank, the police has been notified!"); |
| 56 | + | */ |
| 57 | - | SendClientMessage(playerid, COLOR_WHITE, "You gotta stay 30 seconds in the bank in order to rob it!"); |
| 57 | + | /* |
| 58 | - | } |
| 58 | + | Add a function that would notify the police. |
| 59 | - | } else {
|
| 59 | + | */ |
| 60 | - | SendClientMessage(playerid, COLOR_WHITE, "You can't rob the bank right now!"); |
| 60 | + | SendClientMessage(playerid, COLOR_WHITE, "You are robbing the bank, the police has been notified!"); |
| 61 | SendClientMessage(playerid, COLOR_WHITE, "You gotta stay 30 seconds in the bank in order to rob it!"); | |
| 62 | ||
| 63 | gPlayerRobbing[playerid] = true; | |
| 64 | } | |
| 65 | } else {
| |
| 66 | SendClientMessage(playerid, COLOR_WHITE, "You can't rob the bank right now!"); | |
| 67 | } | |
| 68 | - | new string[128];//We are defining a new string for the formatted message that we are displaying later on. |
| 68 | + | return 1; |
| 69 | } | |
| 70 | - | GivePlayerMoney(playerid, cash); |
| 70 | + | |
| 71 | - | /* |
| 71 | + | public OnPlayerDeath(playerid, killerid, reason) {
|
| 72 | if (gPlayerRobbing[playerid]) {
| |
| 73 | - | GivePlayerMoney(playerid, cash);' we give the player |
| 73 | + | KillTimer(general_timer); |
| 74 | gPlayerRobbing[playerid] = false; | |
| 75 | } | |
| 76 | return 1; | |
| 77 | - | format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash); |
| 77 | + | |
| 78 | - | SendClientMessage(playerid, COLOR_WHITE, string); |
| 78 | + | |
| 79 | //Functions | |
| 80 | public robtimer(playerid) | |
| 81 | {
| |
| 82 | new string[128];//We are defining a new string for the formatted message that we are displaying later on. | |
| 83 | - | robpossible = 1; //With this we make the bank available for robbery again, and we display a friendly message to all players. |
| 83 | + | |
| 84 | - | SendClientMessageToAll(COLOR_WHITE, "The bank is now available for robbery!"); |
| 84 | + | GivePlayerMoney(playerid, cash); |
| 85 | gPlayerRobbing[playerid] = false; | |
| 86 | KillTimer(general_timer); | |
| 87 | /* | |
| 88 | With the fuction above 'new cash = random(200000); | |
| 89 | GivePlayerMoney(playerid, cash);' we give the player | |
| 90 | a random amount of money from $0 - $200,000 | |
| 91 | */ | |
| 92 | //Here below we use the string we defined above to format the message itself and display it to the player. | |
| 93 | format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash); | |
| 94 | SendClientMessage(playerid, COLOR_WHITE, string); | |
| 95 | } | |
| 96 | ||
| 97 | public waittimer() | |
| 98 | {
| |
| 99 | robpossible = 1; //With this we make the bank available for robbery again, and we display a friendly message to all players. | |
| 100 | SendClientMessageToAll(COLOR_WHITE, "The bank is now available for robbery!"); | |
| 101 | } |