Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
- // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
- // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
- // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
- // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
- // By: Maycon Felipe
- // Includes
- #include <a_samp>
- // Defines
- #define Cor_Azul_Aviso 0x56B4EBFF
- #undef MAX_VEHICLES
- #define MAX_VEHICLES 400
- // Variables
- enum Vehicle_DATA {
- v_combustivel,
- Float:v_lataria,
- v_time_count,
- v_calc_comb,
- } new Vehicle[MAX_VEHICLES][Vehicle_DATA];
- new
- mot,
- lu,
- alar,
- por,
- cap,
- porma,
- ob
- ;
- // Callbacks Natives
- public OnFilterScriptInit()
- {
- for(new i = 0; i < MAX_VEHICLES; ++i)
- {
- // Quanto o script iniciar, o veiculo receberá 100 de combustivel.
- Vehicle[i][v_combustivel] = 100;
- }
- for(new i = 0; i < MAX_PLAYERS; ++i)
- {
- SetTimerEx("Timer_Veiculos", 50, 1, "i", i);
- }
- print("============================================");
- print("===== VELOCIMETRO FOR PC/MOBILE ====");
- print("===== Create by: Maycon Felipe ====");
- print("===== Site: www.dominiosamp.net ====");
- print("===== State: Loaded ====");
- print("============================================");
- return 1;
- }
- public OnFilterScriptExit() {
- print("============================================");
- print("===== VELOCIMETRO FOR PC/MOBILE ====");
- print("===== Create by: Maycon Felipe ====");
- print("===== Site: www.dominiosamp.net ====");
- print("===== State: Unloaded ====");
- print("============================================");
- return 1;
- }
- // Callbacks
- forward Timer_Veiculos(playerid);
- public Timer_Veiculos(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- static vehicleid, string[128] = '\0';
- string[0] = '\0';
- vehicleid = GetPlayerVehicleID(playerid);
- GetVehicleHealth(vehicleid, Vehicle[vehicleid][v_lataria]);
- 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]);
- GameTextForPlayer(playerid, string, 120 + GetPlayerPing(playerid), 3);
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Vehicle_Velocity(vehicleid) > 5)
- {
- if(Vehicle[vehicleid][v_combustivel])
- {
- if(++Vehicle[vehicleid][v_time_count] >= 50)
- {
- if(++Vehicle[vehicleid][v_calc_comb] >= 10)
- {
- Vehicle[vehicleid][v_combustivel] -= 1;
- Vehicle[vehicleid][v_calc_comb] = 0;
- }
- Vehicle[vehicleid][v_time_count] = 0;
- }
- GetVehicleParamsEx(vehicleid, mot, lu, alar, por, cap, porma, ob);
- SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
- }
- else
- {
- GetVehicleParamsEx(vehicleid, mot, lu, alar, por, cap, porma, ob);
- SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
- GameTextForPlayer(playerid,"~r~Veiculo sem combustivel.", 1000, 3);
- SendClientMessage(playerid, Cor_Azul_Aviso, "O combustível deste veiculo acabou, assim que tiver novamente digite: '/motor' para liga-lo o veiculo.");
- }
- }
- }
- }
- return 1;
- }
- // Functions
- Vehicle_Velocity(vehicleid){
- new Float:xPos[3];
- GetVehicleVelocity(vehicleid, xPos[0], xPos[1], xPos[2]);
- return floatround(floatsqroot(xPos[0] * xPos[0] + xPos[1] * xPos[1] + xPos[2] * xPos[2]) * 170.00);
- }
- // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
- // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
- // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
- // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
- // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
- // WWW.DOMINIOSAMP.NET - [2020] - O melhor blog sa-mp do brasil!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement