Advertisement
IlanZiin

Base Veiculo-Bomba

Apr 7th, 2017
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.01 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. new bool: VeiculoBomba[MAX_VEHICLES];
  5. static Float: PosVeiculo[3];
  6.  
  7. main()
  8. {
  9.     print("\n----------------------------------");
  10.     print(" Veiculo-Bomba carregado");
  11.     print(" Por IlanZ");
  12.     print("----------------------------------\n");
  13. }
  14.  
  15. public OnGameModeInit()
  16. {
  17.     // Don't use these lines if it's a filterscript
  18.     SetGameModeText("Blank Script");
  19.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  20.  
  21.     CreateVehicle(400, 0.0, 0.0, 2.5, 0, random(128), random(128), -1);
  22.     CreateVehicle(400, 7, 0.0, 2.5, 0, random(128), random(128), -1);
  23.     return 1;
  24. }
  25.  
  26. public OnGameModeExit()
  27. {
  28.     return 1;
  29. }
  30.  
  31. public OnPlayerSpawn(playerid)
  32. {
  33.     SetPlayerSkin(playerid, random(311));
  34.     SetPlayerPos(playerid, 0, 0, 0);
  35.     return 1;
  36. }
  37.  
  38. public OnVehicleDeath(vehicleid, killerid)
  39. {
  40.     if(VeiculoBomba[vehicleid] == true)
  41.     {
  42.         VeiculoBomba[vehicleid] = false;
  43.     }
  44.     return 1;
  45. }
  46.  
  47. public OnPlayerStateChange(playerid, newstate, oldstate)
  48. {
  49.     if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
  50.     {
  51.         if(VeiculoBomba[GetPlayerVehicleID(playerid)] == true)
  52.         {
  53.             SetTimerEx("ExplodirBomba", 5000, false, "i", playerid);
  54.             SendClientMessage(playerid, -1, "Voce entrou em um carro com bomba plantada, e ira explodir em 5 segundos");
  55.             SendClientMessage(playerid, -1, "Corra!");
  56.             SetVehicleHealth(GetPlayerVehicleID(playerid), 0);
  57.             GetVehiclePos(GetPlayerVehicleID(playerid),PosVeiculo[0], PosVeiculo[1],PosVeiculo[2]);
  58.         }
  59.     }
  60.     return 1;
  61. }
  62. forward ExplodirBomba(playerid);
  63. public ExplodirBomba(playerid)
  64. {
  65.     CreateExplosion(PosVeiculo[0]+1,PosVeiculo[1]+0.5, PosVeiculo[2],10,30.0);
  66.     CreateExplosion(PosVeiculo[0]+5,PosVeiculo[1]+4, PosVeiculo[2],10,30.0);
  67.     CreateExplosion(PosVeiculo[0]+7,PosVeiculo[1]+6, PosVeiculo[2]+4,10,30.0);
  68.     return 1;
  69. }
  70.  
  71. CMD:plantarbomba(playerid)
  72. {
  73.     if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "nao está em um carro");
  74.     VeiculoBomba[GetPlayerVehicleID(playerid)] = true;
  75.     return 1;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement