Advertisement
Guest User

D_Speedo by Destiny

a guest
Aug 13th, 2010
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.56 KB | None | 0 0
  1. /*
  2. Speedometer by Destiny,
  3. Ich bitte euch das Copyright drinne stehen zu lassen.
  4.  
  5. Funktionen:
  6. *   Zeigt die Geschwindigkeit eines Fahrzeuges an.
  7. *   Zeigt Fahrzeug Namen an
  8.  
  9. Das Speedometer ist zurzeit auf der Version 1.0,
  10. Es werden immer mehr Versionen zur Schau gestellt.
  11. Man kann es downloaden und auf seinem Server benutzen solange man das Copyright drinne lässt.
  12.  
  13. Mit freundlichen Grüßen,
  14. Destiny.
  15.  
  16. Kontakt:
  17. ICQ: DestinyDesigns@live.de (Einfach das eingeben ist ICQ nicht MSN ;) )
  18. E-Mail: DestinyDesigns@live.de
  19. Webseite: www.DestinyDesigns.de
  20.  
  21. */
  22.  
  23. #include <a_samp>
  24.  
  25. #define Schwarz         0x000000ff
  26. #define Orange          0xFF9933FF
  27.  
  28.  
  29. forward UpdateSpeedo();
  30. new Float:TachoX[MAX_PLAYERS],Float:TachoY[MAX_PLAYERS],Float:TachoZ[MAX_PLAYERS];
  31. new Text:SpeedoText[MAX_PLAYERS];
  32. new Text:SpeedoText2[MAX_PLAYERS];
  33.  
  34. new FahrzeugName[][] =
  35. {
  36.     "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
  37.     "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
  38.     "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
  39.     "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
  40.     "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
  41.     "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
  42.     "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
  43.     "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
  44.     "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van",
  45.     "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale",
  46.     "Oceanic","Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy",
  47.     "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX",
  48.     "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper",
  49.     "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
  50.     "Blista Compact", "Police Maverick", "Boxvillde", "Benson", "Mesa", "RC Goblin",
  51.     "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
  52.     "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
  53.     "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
  54.     "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
  55.     "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
  56.     "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
  57.     "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
  58.     "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
  59.     "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratum",
  60.     "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
  61.     "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
  62.     "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
  63.     "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
  64.     "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
  65.     "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
  66.     "Phoenix", "2. Gebrauchtwagen", "1. Gebrauchtwagen", "Luggage", "Luggage", "Stairs", "Boxville",
  67.     "Tiller", "Utility Trailer"
  68. };
  69.  
  70.  
  71. public OnFilterScriptInit()
  72. {
  73.     //Wenn es erflogreich lädt
  74.     print("D_Speed wurde erfolgreich geladen!");
  75.     return 1;
  76. }
  77.  
  78. public UpdateSpeedo()
  79. {
  80.     for(new i = 0;i<MAX_PLAYERS;i++)
  81.     {
  82.         if(IsPlayerConnected(i))
  83.         {
  84.             if(GetPlayerState(i)==2)
  85.             {
  86.  
  87.                 new speed[128];
  88.                 new Float:xfloat,Float:yfloat,Float:zfloat;
  89.                 new Float:distance,value;
  90.                 GetPlayerPos(i, xfloat, yfloat, zfloat);
  91.                 distance = floatsqroot(floatpower(floatabs(floatsub(xfloat,TachoX[i])),2)+floatpower(floatabs(floatsub(yfloat,TachoY[i])),2)+floatpower(floatabs(floatsub(zfloat,TachoZ[i])),2));
  92.                 value = floatround(distance * 11000);
  93.                 TachoX[i] = xfloat;
  94.                 TachoY[i] = yfloat;
  95.                 TachoZ[i] = zfloat;
  96.                 format(speed,sizeof(speed),"Geschwindigkeit: %d Km/h",floatround(value/3200));
  97.                 TextDrawSetString(SpeedoText[i],speed);
  98.                 new namestring[128];
  99.                 format(namestring,sizeof(namestring),"Fahrzeug: %s",FahrzeugName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
  100.                 TextDrawSetString(SpeedoText2[i],namestring);
  101.             }
  102.         }
  103.     }
  104.     return 1;
  105. }
  106.  
  107. public OnPlayerConnect(playerid)
  108. {
  109.     SpeedoText[playerid] = TextDrawCreate(174,370,"Geschwindigkeit: 100 Km/h");
  110.     TextDrawFont(SpeedoText[playerid],1);
  111.     TextDrawSetOutline(SpeedoText[playerid],1);
  112.     TextDrawBackgroundColor(SpeedoText[playerid],Schwarz);
  113.     TextDrawColor(SpeedoText[playerid],Orange);
  114.     SpeedoText2[playerid] = TextDrawCreate(174,390,"Fahrzeug: Fahrzeug");
  115.     TextDrawFont(SpeedoText2[playerid],1);
  116.     TextDrawSetOutline(SpeedoText2[playerid],1);
  117.     TextDrawBackgroundColor(SpeedoText2[playerid],Schwarz);
  118.     TextDrawColor(SpeedoText2[playerid],Orange);
  119.     SetTimer("UpdateSpeedo",1000,1);
  120.     return 1;
  121. }
  122.  
  123. public OnPlayerExitVehicle(playerid, vehicleid)
  124. {
  125.     TextDrawHideForPlayer(playerid,SpeedoText[playerid]);
  126.     TextDrawHideForPlayer(playerid,SpeedoText2[playerid]);
  127.     return 1;
  128. }
  129.  
  130. public OnPlayerStateChange(playerid, newstate, oldstate)
  131. {
  132.     if(newstate == PLAYER_STATE_DRIVER)
  133.     {
  134.         TextDrawShowForPlayer(playerid,SpeedoText[playerid]);
  135.         TextDrawShowForPlayer(playerid,SpeedoText2[playerid]);
  136.     }
  137.     return 1;
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement