Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.50 KB | None | 0 0
  1.  
  2. #include <a_samp>
  3. #include <zcmd>
  4. #pragma tabsize 0
  5. //Variáveis
  6. new Bomb[MAX_PLAYERS];
  7. new FBTimer;
  8. new CountTime;
  9. new Counting;
  10. new BagTime;
  11. new BagCounting;
  12. new VanMoved;
  13. new SMoney;
  14. new DetonateBomb[MAX_PLAYERS];
  15. new SecurityVanID[MAX_PLAYERS];
  16. new SVBeingRobbed[MAX_VEHICLES];
  17. new FullBag[MAX_PLAYERS];
  18. new MoneyLeft[MAX_VEHICLES];
  19. new Float:VanX,Float:VanY,Float:VanZ;
  20. //Forwards
  21. forward VanMovedTimer(playerid,Float:X,Float:Y,Float:Z);
  22. forward FillingBags(playerid);
  23. forward SecureMoney(playerid);
  24. //Publics
  25. public OnFilterScriptInit()
  26. {
  27. print("\n--------------------------------------");
  28. print("System roubo ao carro forte - Traduzido por Menor. [By TonyII]");
  29. print("--------------------------------------\n");
  30. return 1;
  31. }
  32.  
  33. public OnFilterScriptExit()
  34. {
  35. return 1;
  36. }
  37.  
  38. public OnPlayerDeath(playerid, killerid, reason)
  39. {
  40. if(FullBag[playerid] == 1)
  41. {
  42. GivePlayerMoney(playerid, -100000);
  43. KillTimer(SMoney);
  44. FullBag[playerid] = 0;
  45. SendClientMessage(playerid, 0xFF0000FF,"Erro: Seu assalto deu errado, você morreu.");
  46. }
  47. return 1;
  48. }
  49.  
  50. public VanMovedTimer(playerid)
  51. {
  52. new Float:X,Float:Y,Float:Z;
  53. if(!Counting)
  54. {
  55. KillTimer(VanMoved);
  56. Bomb[playerid] = 0;
  57. DetonateBomb[playerid] = 1;
  58. SendClientMessage(playerid, 0xFFFF00FF,"Tudo pronto, a bomba esta plantada. Saia de perto e use /detonarbomba");
  59. ClearAnimations(playerid);
  60. }
  61. else
  62. {
  63. new SVID = SecurityVanID[playerid];
  64. GetVehiclePos(SVID, X,Y,Z);
  65. if(X == VanX && Y == VanY && Z == VanZ)
  66. {
  67. new string[128];
  68. format(string,sizeof(string),"%i",CountTime);
  69. GameTextForPlayer(playerid,string,1000,5);
  70. CountTime --;
  71. if(CountTime == 0)
  72. {
  73. Counting = 0;
  74. }
  75. }
  76. else
  77. {
  78. KillTimer(VanMoved);
  79. SendClientMessage(playerid, 0xFF0000FF,"Erro: Você saiu de perto do carro-forte ao plantar a bomba!");
  80. }
  81. }
  82. return 1;
  83. }
  84.  
  85. public SecureMoney(playerid)
  86. {
  87. SendClientMessage(playerid, 0xFFFF00FF,"O Dinheiro esta seguro agora.");
  88. FullBag[playerid] = 0;
  89. KillTimer(SMoney);
  90. return 1;
  91. }
  92.  
  93. public FillingBags(playerid)
  94. {
  95. if(!BagCounting)
  96. {
  97. KillTimer(FBTimer);
  98. FullBag[playerid] = 1;
  99. GivePlayerMoney(playerid, 100000);
  100. SendClientMessage(playerid, 0xFFFF00FF,"Você encheu a mala, a mala contém $100,000 Dólares.");
  101. SendClientMessage(playerid, 0xFFFF00FF,"Deixe a área, se você morrer, você perde o dinheiro!");
  102. ClearAnimations(playerid);
  103. SMoney = SetTimerEx("SecureMoney",600000,false,"i",playerid);
  104. }
  105. else
  106. {
  107. new string[128];
  108. format(string,sizeof(string),"%i",BagTime);
  109. GameTextForPlayer(playerid,string,1000,5);
  110. BagTime --;
  111. if(BagTime == 0)
  112. {
  113. BagCounting = 0;
  114. }
  115. }
  116. return 1;
  117. }
  118. //Stocks
  119. stock SecurityVan(vehicleid)
  120. {
  121. switch(GetVehicleModel(vehicleid))
  122. {
  123. case 428: return 1;
  124. }
  125. return 0;
  126. }
  127.  
  128. stock GetDistanceToCar(playerid, veh, Float: posX = 0.0, Float: posY = 0.0, Float: posZ = 0.0)
  129. {
  130. new Float: Floats[2][3];
  131. if(posX == 0.0 && posY == 0.0 && posZ == 0.0)
  132. {
  133. if(!IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playerid, Floats[0][0], Floats[0][1], Floats[0][2]);
  134. else GetVehiclePos(GetPlayerVehicleID(playerid), Floats[0][0], Floats[0][1], Floats[0][2]);
  135. }
  136. else
  137. {
  138. Floats[0][0] = posX;
  139. Floats[0][1] = posY;
  140. Floats[0][2] = posZ;
  141. }
  142. GetVehiclePos(veh, Floats[1][0], Floats[1][1], Floats[1][2]);
  143. return floatround(floatsqroot((Floats[1][0] - Floats[0][0]) * (Floats[1][0] - Floats[0][0]) + (Floats[1][1] - Floats[0][1]) * (Floats[1][1] - Floats[0][1]) + (Floats[1][2] - Floats[0][2]) * (Floats[1][2] - Floats[0][2])));
  144. }
  145.  
  146. stock GetClosestCar(playerid, exception = INVALID_VEHICLE_ID)
  147. {
  148. new Float: Distance,target = -1,Float: vPos[3];
  149. if(!IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playerid, vPos[0], vPos[1], vPos[2]);
  150. else GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);
  151. for(new v; v < MAX_VEHICLES; v++) if(GetVehicleModel(v) >= 400)
  152. {
  153. if(v != exception && (target < 0 || Distance > GetDistanceToCar(playerid, v, vPos[0], vPos[1], vPos[2])))
  154. {
  155. target = v;
  156. Distance = GetDistanceToCar(playerid, v, vPos[0], vPos[1], vPos[2]);
  157. }
  158. }
  159. return target;
  160. }
  161. //Comandos
  162. CMD:comprarbomba(playerid, params[])
  163. {
  164. if(GetPlayerMoney(playerid) <= 10000) return SendClientMessage(playerid, 0xFF0000FF,"Erro: Dinheiro insuficiente.");
  165. if(Bomb[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF,"Erro: Você já tem uma bomba.");
  166. Bomb[playerid] = 1;
  167. ApplyAnimation(playerid,"PED","fucku",4.0,0,0,0,0,0);
  168. SendClientMessage(playerid, 0xFFFF00FF,"Você comprou com sucesso uma bomba.");
  169. SendClientMessage(playerid, 0xFFFF00FF,"Aproxime-se de um carro-forte e plante nas portas traseiras. /Plantarbomba");
  170. GivePlayerMoney(playerid, -100000);
  171. return 1;
  172. }
  173.  
  174. CMD:plantarbomba(playerid, params[])
  175. {
  176.  
  177. new ClosestCar = GetClosestCar(playerid);
  178. GetVehiclePos(ClosestCar, VanX,VanY,VanZ);
  179. if(Bomb[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF,"Erro: Você não tem uma bomba.");
  180. if(IsPlayerInRangeOfPoint(playerid, 7.0, VanX,VanY,VanZ))
  181. {
  182. if(SecurityVan(ClosestCar))
  183. {
  184. SecurityVanID[playerid] = ClosestCar;
  185. VanMoved = SetTimerEx("VanMovedTimer",1000,true,"i",playerid);
  186. CountTime = 5;
  187. Counting = 1;
  188. SendClientMessage(playerid, 0xFFFF00FF,"Você está plantando a bomba!");
  189. ApplyAnimation(playerid, "BOMBER","BOM_Plant_Loop",4.0,1,0,0,1,0);
  190. }
  191. else return SendClientMessage(playerid, 0xFF0000FF,"Erro: Esse veículo não é um carro-forte!");
  192. }
  193. else return SendClientMessage(playerid, 0xFF0000FF,"Erro: Não há nenhum carro-forte por perto.");
  194. return 1;
  195. }
  196.  
  197. CMD:detonarbomba(playerid, params[])
  198. {
  199. new Float:X,Float:Y,Float:Z;
  200. if(DetonateBomb[playerid] == 1)
  201. {
  202. new SVID = SecurityVanID[playerid];
  203. GetVehiclePos(SVID, X,Y,Z);
  204. CreateExplosion(X, Y, Z, 7, 10);
  205. SetVehicleHealth(SVID, 350);
  206. SVBeingRobbed[SVID] = 1;
  207. DetonateBomb[playerid] = 0;
  208. MoneyLeft[SVID] = 5;
  209. SetPlayerWantedLevel(playerid,4);
  210. SendClientMessage(playerid, 0xFFFF00FF,"A bomba explodiu, encha as malas e saia daqui. Use /enchermala");
  211. SendClientMessage(playerid, 0xFF0000FF,"A polícia esta na sua cola, agora você é um procurado!");
  212. }
  213. else return SendClientMessage(playerid, 0xFF0000FF,"Erro: Você não tem uma bomba plantada aqui.");
  214. return 1;
  215. }
  216.  
  217. CMD:enchermala(playerid, params[])
  218. {
  219. static Ladrao[MAX_PLAYER_NAME], sStr[70];
  220. GetPlayerName(playerid, Ladrao, sizeof(Ladrao));
  221. new ClosestCar = GetClosestCar(playerid);
  222. if(BagCounting == 1) return SendClientMessage(playerid, 0xFF0000FF,"Erro: Você já está enchendo suas malas!");
  223. if(GetPlayerWeapon(playerid) == 46) return SendClientMessage(playerid, 0xFF0000FF, "Erro: Você não tem uma mochila ! ");
  224. if(MoneyLeft[ClosestCar] == 0) return SendClientMessage(playerid, 0xFF0000FF,"Este carro está vazio!");
  225. if(FullBag[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF,"Erro: Suas malas estão cheias, gaste o dinheiro do roubo anterior!");
  226. if(SVBeingRobbed[ClosestCar] == 1)
  227. {
  228. SendClientMessage(playerid, 0xFFFF00FF,"Aguarde, você está enchendo suas malas com dinheiro.");
  229. FBTimer = SetTimerEx("FillingBags",1000,true,"i",playerid);
  230. BagTime = 5;
  231. BagCounting = 1;
  232. MoneyLeft[ClosestCar] -= 1;
  233. ApplyAnimation(playerid, "BOMBER","BOM_Plant_Loop",4.0,1,0,0,1,0);
  234. format(sStr, sizeof(sStr), "ATENÇÃO! %s[%d] está roubando o Banco!", Ladrao, playerid);
  235. SendClientMessageToAll(0xE31919FF, sStr);
  236. }
  237. else return SendClientMessage(playerid, 0xFF0000FF,"Erro: Este carro não está sendo roubado.");
  238. return 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement