SHARE
TWEET

Untitled

Cobertozinho Sep 29th, 2011 287 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  2. XX                                                                            XX
  3. XX                             [BXS]                                          XX
  4. XX                      [Creditos: BlueX]                                     XX
  5. XX                                                                            XX
  6. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
  7. #include <a_samp>
  8.  
  9. new Text:Textdraw0;
  10. new Text:Textdraw1;
  11. new Text:Textdraw2;
  12. new Text:Textdraw3;
  13. new Text:Textdraw4;
  14. new Text:Textdraw5;
  15.  
  16. static Float:poskm [3];
  17.  
  18. new veiculos[][] ={
  19. "Landstalker","Bravura","Buffalo","Linerunner","Pereniel","Sentinel","Dumper","Firetruck","Trashmaster",
  20. "Stretch","Manana","Infernus","Voodoo","Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto",
  21. "Taxi","Washington","Bobcat","Mr Whoopee","BF Injection","Hunter","Premier","Enforcer","Securicar","Banshee",
  22. "Predator","Bus","Rhino","Barracks","Hotknife","Trailer","Previon","Coach","Cabbie","Stallion","Rumpo",
  23. "RC Bandit","Romero","Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer",
  24. "Turismo","Speeder","Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley's RC Van","Skimmer",
  25. "PCJ-600","Faggio","Freeway","RC Baron","RC Raider","Glendale","Oceanic","Sanchez","Sparrow","Patriot",
  26. "Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR3 50","Walton","Regina","Comet","BMX",
  27. "Burrito","Camper","Marquis","Baggage","Dozer","Maverick","News Chopper","Rancher","FBI Rancher","Virgo",
  28. "Greenwood","Jetmax","Hotring","Sandking","Blista Compact","Police Maverick","Boxville","Benson","Mesa",
  29. "RC Goblin","Hotring Racer A","Hotring Racer B","Bloodring Banger","Rancher","Super GT","Elegant",
  30. "Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","RoadTrain","Nebula","Majestic",
  31. "Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV1000","Cement Truck","Tow Truck","Fortune","Cadrona",
  32. "FBI Truck","Willard","Forklift","Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight",
  33. "Streak","Vortex","Vincent","Bullet","Clover","Sadler","Firetruck","Hustler","Intruder","Primo","Cargobob",
  34. "Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor","Monster A","Monster B","Uranus",
  35. "Jester","Sultan","Stratum","Elegy","Raindance","RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight",
  36. "Trailer","Kart","Mower","Duneride","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley","Stafford",
  37. "BF-400","Newsvan","Tug","Trailer A","Emperor","Wayfarer","Euros","Hotdog","Club","Trailer B","Trailer C",
  38. "Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)","Police Car (SFPD)","Police Car (LVPD)","Police Ranger",
  39. "Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggage Trailer A","Luggage Trailer B",
  40. "Stair Trailer","Boxville","Farm Plow","Utility Trailer" };
  41.  
  42. public OnFilterScriptInit()
  43. {
  44.     print("Velocimetro by: BlueX");
  45.  
  46.     // Create the textdraws:
  47.     Textdraw0 = TextDrawCreate(517.000000, 324.000000, "Velocidade: Km/h");
  48.     TextDrawBackgroundColor(Textdraw0, -16776961);
  49.     TextDrawFont(Textdraw0, 2);
  50.     TextDrawLetterSize(Textdraw0, 0.280000, 1.000000);
  51.     TextDrawColor(Textdraw0, -1);
  52.     TextDrawSetOutline(Textdraw0, 0);
  53.     TextDrawSetProportional(Textdraw0, 1);
  54.     TextDrawSetShadow(Textdraw0, 1);
  55.  
  56.     Textdraw1 = TextDrawCreate(640.000000, 329.000000, "_");
  57.     TextDrawBackgroundColor(Textdraw1, 255);
  58.     TextDrawFont(Textdraw1, 3);
  59.     TextDrawLetterSize(Textdraw1, 0.280000, 1.000000);
  60.     TextDrawColor(Textdraw1, 16777215);
  61.     TextDrawSetOutline(Textdraw1, 1);
  62.     TextDrawSetProportional(Textdraw1, 1);
  63.     TextDrawUseBox(Textdraw1, 1);
  64.     TextDrawBoxColor(Textdraw1, 106);
  65.     TextDrawTextSize(Textdraw1, 499.000000, 3.000000);
  66.  
  67.     Textdraw2 = TextDrawCreate(640.000000, 315.000000, "_");
  68.     TextDrawBackgroundColor(Textdraw2, 255);
  69.     TextDrawFont(Textdraw2, 3);
  70.     TextDrawLetterSize(Textdraw2, 0.280000, 1.000000);
  71.     TextDrawColor(Textdraw2, 16777215);
  72.     TextDrawSetOutline(Textdraw2, 1);
  73.     TextDrawSetProportional(Textdraw2, 1);
  74.     TextDrawUseBox(Textdraw2, 1);
  75.     TextDrawBoxColor(Textdraw2, 106);
  76.     TextDrawTextSize(Textdraw2, 499.000000, 3.000000);
  77.  
  78.     Textdraw3 = TextDrawCreate(640.000000, 343.000000, "_");
  79.     TextDrawBackgroundColor(Textdraw3, 255);
  80.     TextDrawFont(Textdraw3, 3);
  81.     TextDrawLetterSize(Textdraw3, 0.280000, 1.000000);
  82.     TextDrawColor(Textdraw3, 16777215);
  83.     TextDrawSetOutline(Textdraw3, 1);
  84.     TextDrawSetProportional(Textdraw3, 1);
  85.     TextDrawUseBox(Textdraw3, 1);
  86.     TextDrawBoxColor(Textdraw3, 106);
  87.     TextDrawTextSize(Textdraw3, 499.000000, 3.000000);
  88.  
  89.     Textdraw4 = TextDrawCreate(517.000000, 337.000000, "Veiculo:");
  90.     TextDrawBackgroundColor(Textdraw4, -16776961);
  91.     TextDrawFont(Textdraw4, 2);
  92.     TextDrawLetterSize(Textdraw4, 0.280000, 1.000000);
  93.     TextDrawColor(Textdraw4, -1);
  94.     TextDrawSetOutline(Textdraw4, 0);
  95.     TextDrawSetProportional(Textdraw4, 1);
  96.     TextDrawSetShadow(Textdraw4, 1);
  97.  
  98.     Textdraw5 = TextDrawCreate(640.000000, 349.000000, "_");
  99.     TextDrawBackgroundColor(Textdraw5, 255);
  100.     TextDrawFont(Textdraw5, 3);
  101.     TextDrawLetterSize(Textdraw5, 0.280000, 1.000000);
  102.     TextDrawColor(Textdraw5, 16777215);
  103.     TextDrawSetOutline(Textdraw5, 1);
  104.     TextDrawSetProportional(Textdraw5, 1);
  105.     TextDrawUseBox(Textdraw5, 1);
  106.     TextDrawBoxColor(Textdraw5, 106);
  107.     TextDrawTextSize(Textdraw5, 499.000000, 3.000000);
  108.  
  109.     return 1;
  110. }
  111.  
  112. public OnFilterScriptExit()
  113. {
  114.     TextDrawHideForAll(Textdraw0);
  115.     TextDrawDestroy(Textdraw0);
  116.     TextDrawHideForAll(Textdraw1);
  117.     TextDrawDestroy(Textdraw1);
  118.     TextDrawHideForAll(Textdraw2);
  119.     TextDrawDestroy(Textdraw2);
  120.     TextDrawHideForAll(Textdraw3);
  121.     TextDrawDestroy(Textdraw3);
  122.     TextDrawHideForAll(Textdraw4);
  123.     TextDrawDestroy(Textdraw4);
  124.     TextDrawHideForAll(Textdraw5);
  125.     TextDrawDestroy(Textdraw5);
  126.     return 1;
  127. }
  128.  
  129. public OnPlayerStateChange(playerid, newstate, oldstate)
  130. {
  131.     if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
  132.     {
  133.         Speed(playerid);
  134.     }
  135.     else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
  136.     {
  137.         TextDrawHideForPlayer(playerid, Textdraw0);
  138.         TextDrawHideForPlayer(playerid, Textdraw1);
  139.         TextDrawHideForPlayer(playerid, Textdraw2);
  140.         TextDrawHideForPlayer(playerid, Textdraw3);
  141.         TextDrawHideForPlayer(playerid, Textdraw4);
  142.         TextDrawHideForPlayer(playerid, Textdraw5);
  143.     }
  144.     return 1;
  145. }
  146. Speed(playerid);
  147. public Speed(playerid)
  148. {
  149.     new MySpeed[48];
  150.     new MyCar[48];
  151.     format(MySpeed,sizeof(MySpeed),"Velocidade: %d Km/h",GetSpeed(playerid));
  152.     format(MyCar,sizeof(MyCar),"Veiculo: %s",veiculos[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
  153.     TextDrawSetString(Textdraw0, MySpeed);
  154.     TextDrawSetString(Textdraw4, MyCar);
  155.     TextDrawShowForPlayer(playerid, Textdraw0);
  156.     TextDrawShowForPlayer(playerid, Textdraw1);
  157.     TextDrawShowForPlayer(playerid, Textdraw2);
  158.     TextDrawShowForPlayer(playerid, Textdraw3);
  159.     TextDrawShowForPlayer(playerid, Textdraw4);
  160.     TextDrawShowForPlayer(playerid, Textdraw5);
  161.     SetTimerEx("Speed",1,0,"i",playerid);
  162. }
  163. stock
  164.     GetSpeed ( playerid , mode = 1 )
  165. {
  166.     GetVehicleVelocity ( GetPlayerVehicleID ( playerid ) , poskm [ 0 ] , poskm [ 1 ] , poskm [ 2 ] ) ;
  167.     return IsPlayerInAnyVehicle ( playerid ) ? floatround ( ( ( floatsqroot ( ( ( poskm [ 0 ] * poskm [ 0 ] ) + ( poskm [ 1 ] * poskm [ 1 ] ) + ( poskm [ 2 ] * poskm [ 2 ] ) ) ) * ( !mode ? 105.0 : 170.0 ) ) ) * 1 ) : 0;
  168. }
  169.  
RAW Paste Data
Pastebin PRO Summer Special!
Get 60% OFF on Pastebin PRO accounts!
Top