Advertisement
Felipe_Alves

Velocimetro pc and mobile

Apr 5th, 2020
1,698
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.28 KB | None | 0 0
  1. // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
  2. // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
  3. // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
  4. // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
  5. // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
  6.  
  7.  
  8. // By: Maycon Felipe
  9.  
  10. // Includes
  11. #include <a_samp>
  12.  
  13.  
  14. // Defines
  15. #define Cor_Azul_Aviso          0x56B4EBFF
  16.  
  17. #undef MAX_VEHICLES
  18. #define MAX_VEHICLES 400
  19.  
  20. // Variables
  21. enum Vehicle_DATA {
  22.     v_combustivel,
  23.     Float:v_lataria,
  24.  
  25.     v_time_count,
  26.     v_calc_comb,
  27. } new Vehicle[MAX_VEHICLES][Vehicle_DATA];
  28.  
  29.  
  30. new
  31.     mot,
  32.     lu,
  33.     alar,
  34.     por,
  35.     cap,
  36.     porma,
  37.     ob
  38. ;
  39.  
  40. // Callbacks Natives
  41. public OnFilterScriptInit()
  42. {
  43.     for(new i = 0; i < MAX_VEHICLES; ++i)
  44.     {
  45.         // Quanto o script iniciar, o veiculo receberá 100 de combustivel.
  46.         Vehicle[i][v_combustivel] = 100;
  47.     }
  48.     for(new i = 0; i < MAX_PLAYERS; ++i)
  49.     {
  50.         SetTimerEx("Timer_Veiculos", 50, 1, "i", i);
  51.     }
  52.  
  53.  
  54.     print("============================================");
  55.     print("=====     VELOCIMETRO FOR PC/MOBILE  ====");
  56.     print("=====     Create by: Maycon Felipe      ====");
  57.     print("=====     Site: www.dominiosamp.net  ====");
  58.     print("=====     State: Loaded          ====");
  59.     print("============================================");
  60.     return 1;
  61. }
  62.  
  63. public OnFilterScriptExit() {
  64.     print("============================================");
  65.     print("=====     VELOCIMETRO FOR PC/MOBILE  ====");
  66.     print("=====     Create by: Maycon Felipe      ====");
  67.     print("=====     Site: www.dominiosamp.net  ====");
  68.     print("=====     State: Unloaded            ====");
  69.     print("============================================");
  70.     return 1;
  71. }
  72.  
  73.  
  74. // Callbacks
  75. forward Timer_Veiculos(playerid);
  76. public Timer_Veiculos(playerid)
  77. {
  78.     if(IsPlayerConnected(playerid))
  79.     {
  80.         if(IsPlayerInAnyVehicle(playerid))
  81.         {
  82.             static vehicleid, string[128] = '\0';
  83.             string[0] = '\0';
  84.             vehicleid = GetPlayerVehicleID(playerid);
  85.  
  86.             GetVehicleHealth(vehicleid, Vehicle[vehicleid][v_lataria]);
  87.             format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~ ~w~%02d ~b~KM/H ~w~%02d ~g~L ~w~%.0f ~y~LAT", Vehicle_Velocity(vehicleid), Vehicle[vehicleid][v_combustivel], Vehicle[vehicleid][v_lataria]);
  88.             GameTextForPlayer(playerid, string, 120 + GetPlayerPing(playerid), 3);
  89.  
  90.             if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Vehicle_Velocity(vehicleid) > 5)
  91.             {
  92.                 if(Vehicle[vehicleid][v_combustivel])
  93.                 {
  94.                     if(++Vehicle[vehicleid][v_time_count] >= 50)
  95.                     {
  96.                         if(++Vehicle[vehicleid][v_calc_comb] >= 10)
  97.                         {
  98.                             Vehicle[vehicleid][v_combustivel] -= 1;
  99.                             Vehicle[vehicleid][v_calc_comb] = 0;
  100.                         }
  101.                         Vehicle[vehicleid][v_time_count] = 0;
  102.                     }
  103.                     GetVehicleParamsEx(vehicleid, mot, lu, alar, por, cap, porma, ob);
  104.                     SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
  105.                 }
  106.                 else
  107.                 {
  108.                     GetVehicleParamsEx(vehicleid, mot, lu, alar, por, cap, porma, ob);
  109.                     SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
  110.                     GameTextForPlayer(playerid,"~r~Veiculo sem combustivel.", 1000, 3);
  111.                     SendClientMessage(playerid, Cor_Azul_Aviso, "O combustível deste veiculo acabou, assim que tiver novamente digite: '/motor' para liga-lo o veiculo.");
  112.                 }
  113.             }
  114.         }
  115.     }
  116.     return 1;
  117. }
  118.  
  119. // Functions
  120. Vehicle_Velocity(vehicleid){
  121.     new Float:xPos[3];
  122.     GetVehicleVelocity(vehicleid, xPos[0], xPos[1], xPos[2]);
  123.     return floatround(floatsqroot(xPos[0] * xPos[0] + xPos[1] * xPos[1] + xPos[2] * xPos[2]) * 170.00);
  124. }
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
  134. // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
  135. // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
  136. // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
  137. // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
  138. // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement