Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //______________________________________________________________________________
- #include <a_samp>
- //______________________________________________________________________________
- #define SLOTS 200
- //______________________________________________________________________________
- new Text:Vehicle [MAX_PLAYERS];
- new Text:MPH [MAX_PLAYERS];
- new Text:Health [MAX_PLAYERS];
- //______________________________________________________________________________
- new SpeedometerActivated[MAX_PLAYERS];
- new Float:sVehicle_X[MAX_VEHICLES];
- new Float:sVehicle_Y[MAX_VEHICLES];
- new Float:sVehicle_Z[MAX_VEHICLES];
- //______________________________________________________________________________
- enum SpeedometerPosition
- {
- Float:sX,
- Float:sY,
- Float:sZ
- }
- new SavePlayerPos[SLOTS][SpeedometerPosition];
- //______________________________________________________________________________
- new VehicleNames[][] =
- {
- "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", "Stratium",
- "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", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
- "Tiller", "Utility Trailer"
- };
- //______________________________________________________________________________
- forward SpeedometerUpdate();
- //______________________________________________________________________________
- public OnFilterScriptInit()
- {
- print(" , ,");
- print(" /( )`");
- print(" | |___ / ||");
- print(" /- _ `-/ '");
- print(" (/|/ | | /|");
- print(" / / | ` |");
- print(" O O ) / |");
- print(" `-^--'`< '");
- print(" (_.) _ ) /");
- print(" `.___/` /");
- print(" `-----' /");
- print(" <----. __ / __ |");
- print(" <----|====O)))==) |) /====");
- print(" <----' `--' `.__,' |");
- print(" | |");
- print(" | /");
- print(" ______( (_ / |______");
- print(" ,' ,-----' | |");
- print(" `--{__________) //");
- print("+----------------------------+");
- print("| Darky's Speedometer |");
- print("| WAS LOADED! |");
- print("+----------------------------+");
- print("| Copyright @ 2012 Darky |");
- print("+----------------------------+");
- SetTimer("SpeedometerUpdate", 200, 1);
- for(new v=0; v<MAX_VEHICLES; v++)
- {
- SaveLastPosition(v);
- }
- for(new i=0; i<SLOTS; i++)
- {
- Vehicle[i] = TextDrawCreate(445.000000, 379.000000," ");
- TextDrawBackgroundColor(Vehicle[i], 255);
- TextDrawFont(Vehicle[i], 1);
- TextDrawLetterSize(Vehicle[i], 0.500000, 1.000000);
- TextDrawColor(Vehicle[i], -1);
- TextDrawSetOutline(Vehicle[i], 0);
- TextDrawSetProportional(Vehicle[i], 1);
- TextDrawSetShadow(Vehicle[i], 1);
- TextDrawUseBox(Vehicle[i], 1);
- TextDrawBoxColor(Vehicle[i], 252645200);
- TextDrawTextSize(Vehicle[i], 661.000000, -33.000000);
- //______________________________________________________________________________
- MPH[i] = TextDrawCreate(445.000000, 397.000000," ");
- TextDrawBackgroundColor(MPH[i], 255);
- TextDrawFont(MPH[i], 1);
- TextDrawLetterSize(MPH[i], 0.500000, 1.000000);
- TextDrawColor(MPH[i], -1);
- TextDrawSetOutline(MPH[i], 0);
- TextDrawSetProportional(MPH[i], 1);
- TextDrawSetShadow(MPH[i], 1);
- TextDrawUseBox(MPH[i], 1);
- TextDrawBoxColor(MPH[i], 252645200);
- TextDrawTextSize(MPH[i], 661.000000, -33.000000);
- //______________________________________________________________________________
- Health[i] = TextDrawCreate(445.000000,415.000000," ");
- TextDrawBackgroundColor(Health[i], 255);
- TextDrawFont(Health[i], 1);
- TextDrawLetterSize(Health[i], 0.500000, 1.000000);
- TextDrawColor(Health[i], -1);
- TextDrawSetOutline(Health[i], 0);
- TextDrawSetProportional(Health[i], 1);
- TextDrawSetShadow(Health[i], 1);
- TextDrawUseBox(Health[i], 1);
- TextDrawBoxColor(Health[i], 252645200);
- TextDrawTextSize(Health[i], 661.000000, -33.000000);
- }
- return 1;
- }
- //______________________________________________________________________________
- public SpeedometerUpdate()
- {
- new Float:Speedo_X,Float:Speedo_Y,Float:Speedo_Z;
- new Float:PlayerSpeedDistance,value;
- new Float:Speedometer_HP;
- for(new i=0; i<SLOTS; i++)
- {
- if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
- {
- GetPlayerPos(i, Speedo_X, Speedo_Y, Speedo_Z);
- GetPlayerVehicleID(i);
- GetVehicleHealth(GetPlayerVehicleID(i), Speedometer_HP);
- PlayerSpeedDistance = floatsqroot(floatpower(floatabs(floatsub(Speedo_X,SavePlayerPos[i][sX])),2)+floatpower(floatabs(floatsub(Speedo_Y,SavePlayerPos[i][sY])),2)+floatpower(floatabs(floatsub(Speedo_Z,SavePlayerPos[i][sZ])),2));
- value = floatround(PlayerSpeedDistance * 5000);
- new str1[256],str2[256],str3[256];
- if(SpeedometerActivated[i] == 0)
- {
- TextDrawShowForPlayer(i, Vehicle[i]); TextDrawShowForPlayer(i, MPH[i]);
- TextDrawShowForPlayer(i, Health[i]);
- SpeedometerActivated[i] = 1;
- }
- new MPH_Speed = floatround(value/1000);
- format(str1,sizeof(str1),"Vehicle: ~y~%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400]);
- TextDrawSetString(Vehicle[i], str1);
- if(MPH_Speed >= 200)
- {
- format(str2,sizeof(str2),"MP/H: ~r~%d",MPH_Speed);
- TextDrawSetString(MPH[i], str2);
- }
- else if(MPH_Speed >= 150)
- {
- format(str2,sizeof(str2),"MP/H: ~y~%d",MPH_Speed);
- TextDrawSetString(MPH[i], str2);
- }
- else if(MPH_Speed >= 100)
- {
- format(str2,sizeof(str2),"MP/H: ~g~%d",MPH_Speed);
- TextDrawSetString(MPH[i], str2);
- }
- else
- {
- format(str2,sizeof(str2),"MP/H: ~b~%d",MPH_Speed);
- TextDrawSetString(MPH[i], str2);
- }
- if(Speedometer_HP >= 551)
- {
- format(str3,sizeof(str3),"Health: ~g~%.2f", Speedometer_HP);
- TextDrawSetString(Health[i], str3);
- }
- else if(Speedometer_HP >= 361)
- {
- format(str3,sizeof(str3),"Health: ~y~%.2f", Speedometer_HP);
- TextDrawSetString(Health[i], str3);
- }
- else
- {
- format(str3,sizeof(str3),"Health: ~r~%.2f", Speedometer_HP);
- TextDrawSetString(Health[i], str3);
- }
- }
- SavePlayerPos[i][sX] = Speedo_X, SavePlayerPos[i][sY] = Speedo_Y, SavePlayerPos[i][sZ] = Speedo_Z;
- }
- for(new i=0; i<SLOTS; i++)
- {
- if(!IsPlayerInAnyVehicle(i))
- {
- TextDrawHideForPlayer(i, Vehicle[i]); TextDrawHideForPlayer(i, MPH[i]);
- TextDrawHideForPlayer(i, Health[i]);
- SpeedometerActivated[i] = 0;
- }
- }
- }
- //______________________________________________________________________________
- public OnVehicleSpawn(vehicleid)
- {
- SaveLastPosition(vehicleid);
- return 1;
- }
- //______________________________________________________________________________
- stock GetDistanceToLastPoint(vehicleid)
- {
- new Float:x2, Float:y2, Float:z2, Float:output;
- GetVehiclePos(vehicleid, x2, y2, z2);
- output = floatsqroot(floatpower(floatabs(floatsub(x2, sVehicle_X[vehicleid])), 2)+floatpower(floatabs(floatsub(y2, sVehicle_Y[vehicleid])), 2)+floatpower(floatabs(floatsub(z2, sVehicle_Z[vehicleid])), 2));
- return floatround(output);
- }
- //______________________________________________________________________________
- stock SaveLastPosition(vehicleid)
- {
- new Float:SaveCoord_X, Float:SaveCoord_Y, Float:SaveCoord_Z;
- GetVehiclePos(vehicleid, SaveCoord_X, SaveCoord_Y, SaveCoord_Z);
- sVehicle_X[vehicleid]=SaveCoord_X;
- sVehicle_Y[vehicleid]=SaveCoord_Y;
- sVehicle_Z[vehicleid]=SaveCoord_Z;
- }
- //______________________________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment