Advertisement
Guest User

[FS]Bank robbing

a guest
Dec 19th, 2013
2,211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.32 KB | None | 0 0
  1. #include <      a_samp          >
  2. #include <      zcmd            >
  3.  
  4. new hBankRobbery[MAX_PLAYERS];
  5. new robbingbank[MAX_PLAYERS];
  6. new Text:RobbingTD0[MAX_PLAYERS]; // textdraws for robbing
  7. new Text:RobbingTD1[MAX_PLAYERS]; // textdraws for robbing
  8. new Text:RobbingTD2[MAX_PLAYERS]; // textdraws for robbing
  9.  
  10. forward BankRobbing(p, v);
  11. forward RobbingTextdraw(playerid, create);
  12.  
  13. enum tdInfo
  14. {
  15.     tdRobbingTD0,
  16.     tdRobbingTD1,
  17.     tdRobbingTD2,
  18. };
  19.  
  20. public OnPlayerConnect(playerid)
  21. {
  22.       hBankRobbery[playerid] = -1;
  23.       return 1;
  24. }
  25.  
  26. public RobbingTD(playerid, create)
  27. {
  28.     if(create == 1)
  29.     {
  30.         if(TDInfo[playerid][tdRobbingTD0] == 0)
  31.         {
  32.             RobbingTD0[playerid] = TextDrawCreate(259.000000, 199.000000, "~w~");
  33.             TextDrawBackgroundColor(RobbingTD0[playerid], 255);
  34.             TextDrawFont(RobbingTD0[playerid], 1);
  35.             TextDrawLetterSize(RobbingTD0[playerid], 1.300000, 4.000000);
  36.             TextDrawColor(RobbingTD0[playerid], -1);
  37.             TextDrawSetOutline(RobbingTD0[playerid], 0);
  38.             TextDrawSetProportional(RobbingTD0[playerid], 0);
  39.             TextDrawSetShadow(RobbingTD0[playerid], 1);
  40.             TDInfo[playerid][tdRobbingTD0] = 1;
  41.         }
  42.         if(TDInfo[playerid][tdRobbingTD1] == 0)
  43.         {
  44.             RobbingTD1[playerid] = TextDrawCreate(420.000000, 242.000000, "_");
  45.             TextDrawBackgroundColor(RobbingTD1[playerid], 255);
  46.             TextDrawFont(RobbingTD1[playerid], 1);
  47.             TextDrawLetterSize(RobbingTD1[playerid], 0.500000, -7.000000);
  48.             TextDrawColor(RobbingTD1[playerid], -1);
  49.             TextDrawSetOutline(RobbingTD1[playerid], 0);
  50.             TextDrawSetProportional(RobbingTD1[playerid], 1);
  51.             TextDrawSetShadow(RobbingTD1[playerid], 1);
  52.             TextDrawUseBox(RobbingTD1[playerid], 1);
  53.             TextDrawBoxColor(RobbingTD1[playerid], 150);
  54.             TextDrawTextSize(RobbingTD1[playerid], 219.000000, 90.000000);
  55.             TDInfo[playerid][tdRobbingTD1] = 1;
  56.         }
  57.         if(TDInfo[playerid][tdRobbingTD2] == 0)
  58.         {
  59.             RobbingTD2[playerid] = TextDrawCreate(318.000000, 188.000000, "~y~Robbing...");
  60.             TextDrawAlignment(RobbingTD2[playerid], 2);
  61.             TextDrawBackgroundColor(RobbingTD2[playerid], 255);
  62.             TextDrawFont(RobbingTD2[playerid], 1);
  63.             TextDrawLetterSize(RobbingTD2[playerid], 0.349999, 1.000000);
  64.             TextDrawColor(RobbingTD2[playerid], 16711935);
  65.             TextDrawSetOutline(RobbingTD2[playerid], 0);
  66.             TextDrawSetProportional(RobbingTD2[playerid], 1);
  67.             TextDrawSetShadow(RobbingTD2[playerid], 1);
  68.             TDInfo[playerid][tdRobbingTD2] = 1;
  69.         }
  70.     }
  71.     else
  72.     {
  73.         if(TDInfo[playerid][tdRobbingTD0] == 1)
  74.         {
  75.             TextDrawHideForPlayer(playerid, RobbingTD0[playerid]);
  76.             TextDrawDestroy(RobbingTD0[playerid]);
  77.             TDInfo[playerid][tdRobbingTD0] = 0;
  78.         }
  79.         if(TDInfo[playerid][tdRobbingTD1] == 1)
  80.         {
  81.             TextDrawHideForPlayer(playerid, RobbingTD1[playerid]);
  82.             TextDrawDestroy(RobbingTD1[playerid]);
  83.             TDInfo[playerid][tdRobbingTD1] = 0;
  84.         }
  85.         if(TDInfo[playerid][tdRobbingTD2] == 1)
  86.         {
  87.             TextDrawHideForPlayer(playerid, RobbingTD2[playerid]);
  88.             TextDrawDestroy(RobbingTD2[playerid]);
  89.             TDInfo[playerid][tdRobbingTD2] = 0;
  90.         }
  91.     }
  92.     return 1;
  93. }
  94. public BankRobbing(p, v)
  95. {
  96.     if(!IsPlayerConnected(p)) return KillTimer(robbingbank[p]);
  97.     if(hBankRobbery[p] == -1) return KillTimer(robbingbank[p]);
  98.     hBankRobbery[p]++;
  99.     if(hBankRobbery[p] == 1) TextDrawSetString(RobbingTD0[p], "~w~I");
  100.     else if(hBankRobbery[p] == 2) TextDrawSetString(RobbingTD0[p], "~w~II");
  101.     else if(hBankRobbery[p] == 3) TextDrawSetString(RobbingTD1[p], "~w~III");
  102.     else if(hBankRobbery[p] == 4) TextDrawSetString(RobbingTD2[p], "~w~IIII");
  103.     else if(hBankRobbery[p] == 5) TextDrawSetString(RobbingTD3[p], "~w~IIIII");
  104.     else if(hBankRobbery[p] == 6)
  105.     {
  106.         new x = random(5);
  107.         switch(x)
  108.         {
  109.             case 0..1:
  110.             {
  111.                 TextDrawSetString(ObijanjeTD0[p], "~r~IIIII");
  112.                 TextDrawSetString(ObijanjeTD2[p], "~r~Bank is not robbed!");
  113.                 TogglePlayerControllable(p, 1);
  114.                     StopLoopingAnim(p);
  115.                 SencClientMessage(p, -1, "Bank is not robbed!");
  116.                 }
  117.             case 2..4:
  118.             {
  119.                 TextDrawSetString(RobbingTD0[p], "~r~IIIII");
  120.                 TextDrawSetString(RobbingTD2[p], "~g~Bank is succesfuly robbed!");
  121.                 TogglePlayerControllable(p, 1);
  122.                     StopLoopingAnim(p);
  123.                 SendClientMessage(p, -1, "Bank is robbed!");
  124.                         new cash = 30000;
  125.                         new bribe = random(5000);
  126.                             SendClientMessage(p, -1, "You stoled $%d from the bank!", cash+bribe);
  127.                             GivePlayerMoney(p, cash+bribe);
  128.             }
  129.         }
  130.     }
  131.     else if(hBankRobbery[p] == 7)
  132.     {
  133.         KillTimer(robbingbank[p]);
  134.         hBankRobbery[p] = -1;
  135.     }
  136.     return 1;
  137. }
  138.  
  139. CMD:robbank(playerid, params[])
  140. {
  141.     if(gettime() < hBankRobbery[playerid]) return SendClientMessage(playerid, -1, "You already robbed bank!");
  142.     if(!IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z)) return SCM(playerid, -1, "You are not in the bank!"); // Put x,y,z where is your bank
  143.     LoopingAnim(playerid,"BOMBER","BOM_Plant_Loop",4.0,1,0,0,1,0);
  144.     hBankRobbery[playerid] = 0;
  145.     robbingbank[playerid] = SetTimerEx("robbingbank", 20000, true, "ii", playerid);
  146.     ObijanjeTD(playerid, 1);
  147.         SendClientMessageToAll(-1,"[NEWS] Bank is being robbed, do not come near the bank!");
  148.     TextDrawShowForPlayer(playerid, ObijanjeTD0[playerid]);
  149.     TextDrawShowForPlayer(playerid, ObijanjeTD1[playerid]);
  150.     TextDrawShowForPlayer(playerid, ObijanjeTD2[playerid]);
  151.     hBankRobbery[playerid] = gettime() + 15000;
  152.     return 1;
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement