Advertisement
garfield

[FS]: Velocímetro Futurístico

Dec 29th, 2013
591
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.63 KB | None | 0 0
  1. #include a_samp
  2. #include progress
  3.  
  4. enum pINFO {
  5.  
  6.  
  7.     Bar:E_FUEL,
  8.     Bar:E_VCARRO,
  9.     Bar:E_LOADSV,
  10.  
  11. }
  12.  
  13. new
  14.     Text:VelocimetroCR[ MAX_PLAYERS ],
  15.     pData[ MAX_PLAYERS] [ pINFO ],
  16.     pZolina[MAX_VEHICLES],
  17.    
  18.     VehicleNames[212][] =
  19.     {
  20.         {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},
  21.         {"Dumper"},{"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},
  22.         {"Pony"},{"Mule"},{"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},
  23.         {"Washington"},{"Bobcat"},{"Mr. Whoopee"},{"BF. Injection"},{"Hunter"},{"Premier"},{"Enforcer"},
  24.         {"Securicar"},{"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Article Trailer"},
  25.         {"Previon"},{"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
  26.         {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Article Trailer 2"},{"Turismo"},{"Speeder"},
  27.         {"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},{"Skimmer"},
  28.         {"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},{"Sanchez"},
  29.         {"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},{"Rustler"},{"ZR-350"},
  30.         {"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},{"Baggage"},{"Dozer"},
  31.         {"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},{"Jetmax"},{"Hotring"},
  32.         {"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},{"Mesa"},{"RC Goblin"},
  33.         {"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},{"Super GT"},{"Elegant"},
  34.         {"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},{"Tanker"},{"Roadtrain"},
  35.         {"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},{"NRG-500"},{"HPV1000"},
  36.         {"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},{"Willard"},{"Forklift"},
  37.         {"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},{"Blade"},{"Freight"},{"Streak"},
  38.         {"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},{"Firetruck LA"},{"Hustler"},{"Intruder"},
  39.         {"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},{"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},
  40.         {"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},{"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},
  41.         {"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},{"Bandito"},{"Freight Flat"},{"Streak Carriage"},
  42.         {"Kart"},{"Mower"},{"Dunerider"},{"Sweeper"},{"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},
  43.         {"Stafford"},{"BF-400"},{"Newsvan"},{"Tug"},{"Article Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Mobile Hotdog"},
  44.         {"Club"},{"Freight Carriage"},{"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},
  45.         {"Police Car (SFPD)"},{"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T Van"},{"Alpha"},
  46.         {"Phoenix"},{"Glendale"},{"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},
  47.         {"Boxville"},{"Farm Plow"},{"Utility Trailer"}
  48.     }
  49. ;
  50.  
  51. public OnFilterScriptInit(){
  52.  
  53.     SetTimer("GasolinaBus", 10000, true);
  54.    
  55.    
  56.     for(new i;  i != MAX_PLAYERS; ++i){
  57.         VelocimetroCR[i] = TextDrawCreate(472.000000, 403.000000, "Infernus");
  58.         TextDrawBackgroundColor(VelocimetroCR[i], 255);
  59.         TextDrawFont(VelocimetroCR[i], 2);
  60.         TextDrawLetterSize(VelocimetroCR[i], 0.210000, 0.900000);
  61.         TextDrawColor(VelocimetroCR[i], -1);
  62.         TextDrawSetOutline(VelocimetroCR[i], 1);
  63.         TextDrawSetProportional(VelocimetroCR[i], 1);
  64.     }
  65.    
  66.     return true;
  67.        
  68. }
  69. public OnPlayerConnect(playerid){
  70.     pData[playerid][E_VCARRO]   = CreateProgressBar(474.00, 413.00, 133.50, 7.19, -16776961, 100.0);
  71.  
  72.     pData[playerid][E_FUEL]     = CreateProgressBar(474.00, 426.00, 133.50, 3.20, -16776961, 100.0);
  73.    
  74.    
  75.     SetProgressBarMaxValue(pData[playerid][E_VCARRO], 300);
  76.     return true;
  77. }
  78.  
  79. public OnPlayerCommandText(playerid, cmdtext[]){
  80.  
  81.     if(!strcmp(cmdtext,"/abastecer", true)){
  82.    
  83.         if(!IsPlayerInAnyVehicle(playerid)){
  84.             return SendClientMessage(playerid, -1, "Você não está em nenhum veículo!");
  85.         }
  86.    
  87.         if(pZolina[GetPlayerVehicleID(playerid)] >= 100){
  88.             return SendClientMessage(playerid, -1, "O Tanque já está cheio!");
  89.         }
  90.    
  91.         pZolina[GetPlayerVehicleID(playerid)] += 50;
  92.  
  93.         GivePlayerMoney(playerid, -10000);
  94.        
  95.         SendClientMessage(playerid, -1, "Você adicionou +50 litros de gasolina! (R$: 10.000)");
  96.         return true;
  97.     }
  98.     return true;
  99. }
  100.  
  101. public OnPlayerUpdate(playerid){
  102.     if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
  103.    
  104.         if(pZolina[GetPlayerVehicleID(playerid)] == 0){
  105.  
  106.             new mot, lu, alar, por, cap, porma, ob;
  107.             GetVehicleParamsEx(GetPlayerVehicleID(playerid), mot, lu, alar, por, cap, porma, ob);
  108.             SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
  109.         }else{
  110.             new mot, lu, alar, por, cap, porma, ob;
  111.             GetVehicleParamsEx(GetPlayerVehicleID(playerid), mot, lu, alar, por, cap, porma, ob);
  112.             SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
  113.         }
  114.        
  115.         static vl;
  116.  
  117.         vl = GetPlayerSpeed(playerid);
  118.  
  119.         TextDrawSetString(VelocimetroCR[playerid], VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400]);
  120.         TextDrawShowForPlayer(playerid, VelocimetroCR[playerid]);
  121.  
  122.  
  123.         SetProgressBarValue(pData[playerid][E_VCARRO], vl);
  124.         UpdateProgressBar(pData[playerid][E_VCARRO], playerid);
  125.  
  126.  
  127.         SetProgressBarValue(pData[playerid][E_FUEL], pZolina[GetPlayerVehicleID(playerid)]);
  128.         UpdateProgressBar(pData[playerid][E_FUEL], playerid);
  129.  
  130.     }else{
  131.  
  132.         HideProgressBarForPlayer(playerid, pData[playerid][E_VCARRO]);
  133.         HideProgressBarForPlayer(playerid, pData[playerid][E_FUEL]);
  134.  
  135.         TextDrawHideForPlayer(playerid, VelocimetroCR[playerid]);
  136.     }
  137. }
  138.  
  139.  
  140. //
  141.  
  142. forward GasolinaBus();
  143. public GasolinaBus(){
  144.     for(new i; i != MAX_PLAYERS; ++i){
  145.         if(IsPlayerConnected(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER){
  146.             if(pZolina[GetPlayerVehicleID(i)] != 0){
  147.                 pZolina[GetPlayerVehicleID(i)] -= 5;
  148.             }
  149.         }
  150.     }
  151. }
  152.  
  153.  
  154. stock GetPlayerSpeed(playerid)
  155. {
  156.     new Float:ST[4];
  157.     if(IsPlayerInAnyVehicle(playerid))
  158.     GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
  159.     else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
  160.     ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
  161.     return floatround(ST[3]);
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement