Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Speedometer by Destiny,
- Ich bitte euch das Copyright drinne stehen zu lassen.
- Funktionen:
- * Zeigt die Geschwindigkeit eines Fahrzeuges an.
- * Zeigt Fahrzeug Namen an
- Das Speedometer ist zurzeit auf der Version 1.0,
- Es werden immer mehr Versionen zur Schau gestellt.
- Man kann es downloaden und auf seinem Server benutzen solange man das Copyright drinne lässt.
- Mit freundlichen Grüßen,
- Destiny.
- Kontakt:
- ICQ: DestinyDesigns@live.de (Einfach das eingeben ist ICQ nicht MSN ;) )
- E-Mail: DestinyDesigns@live.de
- Webseite: www.DestinyDesigns.de
- */
- #include <a_samp>
- #define Schwarz 0x000000ff
- #define Orange 0xFF9933FF
- forward UpdateSpeedo();
- new Float:TachoX[MAX_PLAYERS],Float:TachoY[MAX_PLAYERS],Float:TachoZ[MAX_PLAYERS];
- new Text:SpeedoText[MAX_PLAYERS];
- new Text:SpeedoText2[MAX_PLAYERS];
- new FahrzeugName[][] =
- {
- "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
- "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
- "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
- "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
- "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
- "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
- "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
- "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
- "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van",
- "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale",
- "Oceanic","Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy",
- "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX",
- "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper",
- "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
- "Blista Compact", "Police Maverick", "Boxvillde", "Benson", "Mesa", "RC Goblin",
- "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
- "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
- "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
- "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
- "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
- "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
- "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
- "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
- "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratum",
- "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
- "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
- "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
- "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
- "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
- "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
- "Phoenix", "2. Gebrauchtwagen", "1. Gebrauchtwagen", "Luggage", "Luggage", "Stairs", "Boxville",
- "Tiller", "Utility Trailer"
- };
- public OnFilterScriptInit()
- {
- //Wenn es erflogreich lädt
- print("D_Speed wurde erfolgreich geladen!");
- return 1;
- }
- public UpdateSpeedo()
- {
- for(new i = 0;i<MAX_PLAYERS;i++)
- {
- if(IsPlayerConnected(i))
- {
- if(GetPlayerState(i)==2)
- {
- new speed[128];
- new Float:xfloat,Float:yfloat,Float:zfloat;
- new Float:distance,value;
- GetPlayerPos(i, xfloat, yfloat, zfloat);
- distance = floatsqroot(floatpower(floatabs(floatsub(xfloat,TachoX[i])),2)+floatpower(floatabs(floatsub(yfloat,TachoY[i])),2)+floatpower(floatabs(floatsub(zfloat,TachoZ[i])),2));
- value = floatround(distance * 11000);
- TachoX[i] = xfloat;
- TachoY[i] = yfloat;
- TachoZ[i] = zfloat;
- format(speed,sizeof(speed),"Geschwindigkeit: %d Km/h",floatround(value/3200));
- TextDrawSetString(SpeedoText[i],speed);
- new namestring[128];
- format(namestring,sizeof(namestring),"Fahrzeug: %s",FahrzeugName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
- TextDrawSetString(SpeedoText2[i],namestring);
- }
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SpeedoText[playerid] = TextDrawCreate(174,370,"Geschwindigkeit: 100 Km/h");
- TextDrawFont(SpeedoText[playerid],1);
- TextDrawSetOutline(SpeedoText[playerid],1);
- TextDrawBackgroundColor(SpeedoText[playerid],Schwarz);
- TextDrawColor(SpeedoText[playerid],Orange);
- SpeedoText2[playerid] = TextDrawCreate(174,390,"Fahrzeug: Fahrzeug");
- TextDrawFont(SpeedoText2[playerid],1);
- TextDrawSetOutline(SpeedoText2[playerid],1);
- TextDrawBackgroundColor(SpeedoText2[playerid],Schwarz);
- TextDrawColor(SpeedoText2[playerid],Orange);
- SetTimer("UpdateSpeedo",1000,1);
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- TextDrawHideForPlayer(playerid,SpeedoText[playerid]);
- TextDrawHideForPlayer(playerid,SpeedoText2[playerid]);
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if(newstate == PLAYER_STATE_DRIVER)
- {
- TextDrawShowForPlayer(playerid,SpeedoText[playerid]);
- TextDrawShowForPlayer(playerid,SpeedoText2[playerid]);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement