Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Tachosystem [S3] by ErikSon */
- #include <a_samp>
- /* Settings */
- #undef MAX_PLAYERS
- #define MAX_PLAYERS 5 //Server-Slotanzahl
- /* Settings */
- #define formatEx(%0,%1,%2) format(%0,sizeof(%0),%1,%2)
- enum T_EC{
- Text:Name,
- Text:punkt[10],
- Text:Speed,
- Text:kmh,
- Text:TachoBox,
- Text:Zustand,
- Shown
- }
- new Tacho[MAX_PLAYERS][T_EC];
- new VehName[][] ={
- "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(){
- print("\n--------------------------------------");
- print(" Tachosystem [S3] by ErikSon");
- print("--------------------------------------\n");
- for(new i = 0; i<MAX_PLAYERS; i++){
- Tacho[i][Speed] = TextDrawCreate(495.000000, 342.000000, "-");
- TextDrawBackgroundColor(Tacho[i][Speed], 255);
- TextDrawFont(Tacho[i][Speed], 1);
- TextDrawLetterSize(Tacho[i][Speed], 0.699999, 4.000000);
- TextDrawColor(Tacho[i][Speed], -1);
- TextDrawSetOutline(Tacho[i][Speed], 0);
- TextDrawSetProportional(Tacho[i][Speed], 1);
- TextDrawSetShadow(Tacho[i][Speed], 1);
- TextDrawSetSelectable(Tacho[i][Speed], 0);
- Tacho[i][kmh] = TextDrawCreate(548.000000, 349.000000, "km/h");
- TextDrawBackgroundColor(Tacho[i][kmh], 255);
- TextDrawFont(Tacho[i][kmh], 1);
- TextDrawLetterSize(Tacho[i][kmh], 0.500000, 1.000000);
- TextDrawColor(Tacho[i][kmh], -1);
- TextDrawSetOutline(Tacho[i][kmh], 0);
- TextDrawSetProportional(Tacho[i][kmh], 1);
- TextDrawSetShadow(Tacho[i][kmh], 1);
- TextDrawSetSelectable(Tacho[i][kmh], 0);
- Tacho[i][punkt][0] = TextDrawCreate(495.000000, 369.000000, ".");
- TextDrawBackgroundColor(Tacho[i][punkt][0], 255);
- TextDrawFont(Tacho[i][punkt][0], 1);
- TextDrawLetterSize(Tacho[i][punkt][0], 0.800000, 4.000000);
- TextDrawColor(Tacho[i][punkt][0], 16711935);
- TextDrawSetOutline(Tacho[i][punkt][0], 0);
- TextDrawSetProportional(Tacho[i][punkt][0], 1);
- TextDrawSetShadow(Tacho[i][punkt][0], 1);
- TextDrawSetSelectable(Tacho[i][punkt][0], 0);
- Tacho[i][punkt][1] = TextDrawCreate(505.000000, 369.000000, ".");
- TextDrawBackgroundColor(Tacho[i][punkt][1], 255);
- TextDrawFont(Tacho[i][punkt][1], 1);
- TextDrawLetterSize(Tacho[i][punkt][1], 0.800000, 4.000000);
- TextDrawColor(Tacho[i][punkt][1], 16711935);
- TextDrawSetOutline(Tacho[i][punkt][1], 0);
- TextDrawSetProportional(Tacho[i][punkt][1], 1);
- TextDrawSetShadow(Tacho[i][punkt][1], 1);
- TextDrawSetSelectable(Tacho[i][punkt][1], 0);
- Tacho[i][punkt][2] = TextDrawCreate(515.000000, 369.000000, ".");
- TextDrawBackgroundColor(Tacho[i][punkt][2], 255);
- TextDrawFont(Tacho[i][punkt][2], 1);
- TextDrawLetterSize(Tacho[i][punkt][2], 0.800000, 4.000000);
- TextDrawColor(Tacho[i][punkt][2], 16711935);
- TextDrawSetOutline(Tacho[i][punkt][2], 0);
- TextDrawSetProportional(Tacho[i][punkt][2], 1);
- TextDrawSetShadow(Tacho[i][punkt][2], 1);
- TextDrawSetSelectable(Tacho[i][punkt][2], 0);
- Tacho[i][punkt][3] = TextDrawCreate(525.000000, 369.000000, ".");
- TextDrawBackgroundColor(Tacho[i][punkt][3], 255);
- TextDrawFont(Tacho[i][punkt][3], 1);
- TextDrawLetterSize(Tacho[i][punkt][3], 0.800000, 4.000000);
- TextDrawColor(Tacho[i][punkt][3], 16711935);
- TextDrawSetOutline(Tacho[i][punkt][3], 0);
- TextDrawSetProportional(Tacho[i][punkt][3], 1);
- TextDrawSetShadow(Tacho[i][punkt][3], 1);
- TextDrawSetSelectable(Tacho[i][punkt][3], 0);
- Tacho[i][punkt][4] = TextDrawCreate(535.000000, 369.000000, ".");
- TextDrawBackgroundColor(Tacho[i][punkt][4], 255);
- TextDrawFont(Tacho[i][punkt][4], 1);
- TextDrawLetterSize(Tacho[i][punkt][4], 0.800000, 4.000000);
- TextDrawColor(Tacho[i][punkt][4], 16711935);
- TextDrawSetOutline(Tacho[i][punkt][4], 0);
- TextDrawSetProportional(Tacho[i][punkt][4], 1);
- TextDrawSetShadow(Tacho[i][punkt][4], 1);
- TextDrawSetSelectable(Tacho[i][punkt][4], 0);
- Tacho[i][punkt][5] = TextDrawCreate(545.000000, 369.000000, ".");
- TextDrawBackgroundColor(Tacho[i][punkt][5], 255);
- TextDrawFont(Tacho[i][punkt][5], 1);
- TextDrawLetterSize(Tacho[i][punkt][5], 0.800000, 4.000000);
- TextDrawColor(Tacho[i][punkt][5], 16711935);
- TextDrawSetOutline(Tacho[i][punkt][5], 0);
- TextDrawSetProportional(Tacho[i][punkt][5], 1);
- TextDrawSetShadow(Tacho[i][punkt][5], 1);
- TextDrawSetSelectable(Tacho[i][punkt][5], 0);
- Tacho[i][punkt][6] = TextDrawCreate(555.000000, 369.000000, ".");
- TextDrawBackgroundColor(Tacho[i][punkt][6], 255);
- TextDrawFont(Tacho[i][punkt][6], 1);
- TextDrawLetterSize(Tacho[i][punkt][6], 0.800000, 4.000000);
- TextDrawColor(Tacho[i][punkt][6], 16711935);
- TextDrawSetOutline(Tacho[i][punkt][6], 0);
- TextDrawSetProportional(Tacho[i][punkt][6], 1);
- TextDrawSetShadow(Tacho[i][punkt][6], 1);
- TextDrawSetSelectable(Tacho[i][punkt][6], 0);
- Tacho[i][punkt][7] = TextDrawCreate(565.000000, 369.000000, ".");
- TextDrawBackgroundColor(Tacho[i][punkt][7], 255);
- TextDrawFont(Tacho[i][punkt][7], 1);
- TextDrawLetterSize(Tacho[i][punkt][7], 0.800000, 4.000000);
- TextDrawColor(Tacho[i][punkt][7], 16711935);
- TextDrawSetOutline(Tacho[i][punkt][7], 0);
- TextDrawSetProportional(Tacho[i][punkt][7], 1);
- TextDrawSetShadow(Tacho[i][punkt][7], 1);
- TextDrawSetSelectable(Tacho[i][punkt][7], 0);
- Tacho[i][punkt][8] = TextDrawCreate(575.000000, 369.000000, ".");
- TextDrawBackgroundColor(Tacho[i][punkt][8], 255);
- TextDrawFont(Tacho[i][punkt][8], 1);
- TextDrawLetterSize(Tacho[i][punkt][8], 0.800000, 4.000000);
- TextDrawColor(Tacho[i][punkt][8], 16711935);
- TextDrawSetOutline(Tacho[i][punkt][8], 0);
- TextDrawSetProportional(Tacho[i][punkt][8], 1);
- TextDrawSetShadow(Tacho[i][punkt][8], 1);
- TextDrawSetSelectable(Tacho[i][punkt][8], 0);
- Tacho[i][punkt][9] = TextDrawCreate(585.000000, 369.000000, ".");
- TextDrawBackgroundColor(Tacho[i][punkt][9], 255);
- TextDrawFont(Tacho[i][punkt][9], 1);
- TextDrawLetterSize(Tacho[i][punkt][9], 0.800000, 4.000000);
- TextDrawColor(Tacho[i][punkt][9], 16711935);
- TextDrawSetOutline(Tacho[i][punkt][9], 0);
- TextDrawSetProportional(Tacho[i][punkt][9], 1);
- TextDrawSetShadow(Tacho[i][punkt][9], 1);
- TextDrawSetSelectable(Tacho[i][punkt][9], 0);
- Tacho[i][Zustand] = TextDrawCreate(517.000000, 379.000000, "Zustand");
- TextDrawBackgroundColor(Tacho[i][Zustand], 255);
- TextDrawFont(Tacho[i][Zustand], 1);
- TextDrawLetterSize(Tacho[i][Zustand], 0.469999, 1.100000);
- TextDrawColor(Tacho[i][Zustand], 0xFF000F88);
- TextDrawSetOutline(Tacho[i][Zustand], 0);
- TextDrawSetProportional(Tacho[i][Zustand], 1);
- TextDrawSetShadow(Tacho[i][Zustand], 1);
- TextDrawSetSelectable(Tacho[i][Zustand], 0);
- Tacho[i][Name] = TextDrawCreate(510.000000, 324.000000, "-");
- TextDrawBackgroundColor(Tacho[i][Name], 255);
- TextDrawFont(Tacho[i][Name], 1);
- TextDrawLetterSize(Tacho[i][Name], 0.500000, 2.000000);
- TextDrawColor(Tacho[i][Name], -16776961);
- TextDrawSetOutline(Tacho[i][Name], 0);
- TextDrawSetProportional(Tacho[i][Name], 1);
- TextDrawSetShadow(Tacho[i][Name], 1);
- TextDrawSetSelectable(Tacho[i][Name], 0);
- Tacho[i][TachoBox] = TextDrawCreate(495.000000, 321.000000, "~n~~n~");
- TextDrawBackgroundColor(Tacho[i][TachoBox], 255);
- TextDrawFont(Tacho[i][TachoBox], 1);
- TextDrawLetterSize(Tacho[i][TachoBox], 6.809998, 5.000000);
- TextDrawColor(Tacho[i][TachoBox], 255);
- TextDrawSetOutline(Tacho[i][TachoBox], 0);
- TextDrawSetProportional(Tacho[i][TachoBox], 1);
- TextDrawSetShadow(Tacho[i][TachoBox], 1);
- TextDrawUseBox(Tacho[i][TachoBox], 1);
- TextDrawBoxColor(Tacho[i][TachoBox], 0x00000088);
- TextDrawTextSize(Tacho[i][TachoBox], 596.000000, 70.000000);
- TextDrawSetSelectable(Tacho[i][TachoBox], 0);
- }
- return SetTimer("TachoUpdate",444,true);
- }
- public OnFilterScriptExit(){
- for(new i = 0; i<MAX_PLAYERS; i++){
- TextDrawHideForPlayer(i,Tacho[i][Name]);
- TextDrawHideForPlayer(i,Tacho[i][Zustand]);
- TextDrawHideForPlayer(i,Tacho[i][Speed]);
- TextDrawHideForPlayer(i, Tacho[i][TachoBox]);
- TextDrawHideForPlayer(i, Tacho[i][kmh]);
- for(new _i = 0; _i<10; _i++)TextDrawHideForPlayer(i, Tacho[i][punkt][_i]);
- TextDrawDestroy(Tacho[i][Name]);
- TextDrawDestroy(Tacho[i][Zustand]);
- TextDrawDestroy(Tacho[i][Speed]);
- TextDrawDestroy(Tacho[i][TachoBox]);
- TextDrawDestroy(Tacho[i][kmh]);
- for(new _i = 0; _i<10; _i++)TextDrawDestroy(Tacho[i][punkt][_i]);
- }
- return 1;
- }
- public OnPlayerConnect(playerid){
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason){
- if(IsPlayerInAnyVehicle(playerid)){
- TextDrawHideForPlayer(playerid, Tacho[playerid][Name]);
- TextDrawHideForPlayer(playerid, Tacho[playerid][Zustand]);
- TextDrawHideForPlayer(playerid, Tacho[playerid][Speed]);
- TextDrawHideForPlayer(playerid, Tacho[playerid][TachoBox]);
- TextDrawHideForPlayer(playerid, Tacho[playerid][kmh]);
- for(new i = 0; i<10; i++)TextDrawHideForPlayer(playerid, Tacho[playerid][punkt][i]);
- }
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate){
- if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER){
- TextDrawShowForPlayer(playerid, Tacho[playerid][TachoBox]);
- TextDrawShowForPlayer(playerid, Tacho[playerid][Name]);
- TextDrawShowForPlayer(playerid, Tacho[playerid][Zustand]);
- TextDrawShowForPlayer(playerid, Tacho[playerid][Speed]);
- TextDrawShowForPlayer(playerid, Tacho[playerid][kmh]);
- for(new i = 0; i<10; i++)TextDrawShowForPlayer(playerid, Tacho[playerid][punkt][i]);
- }
- if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER){
- TextDrawHideForPlayer(playerid, Tacho[playerid][Name]);
- TextDrawHideForPlayer(playerid, Tacho[playerid][Zustand]);
- TextDrawHideForPlayer(playerid, Tacho[playerid][Speed]);
- TextDrawHideForPlayer(playerid, Tacho[playerid][TachoBox]);
- TextDrawHideForPlayer(playerid, Tacho[playerid][kmh]);
- for(new i = 0; i<10; i++)TextDrawHideForPlayer(playerid, Tacho[playerid][punkt][i]);
- }
- return 1;
- }
- forward TachoUpdate();
- public TachoUpdate(){
- for(new i = 0; i<MAX_PLAYERS; i++){
- if(!IsPlayerConnected(i))continue;
- if(!IsPlayerInAnyVehicle(i))continue;
- new veh = GetPlayerVehicleID(i),str[64],Float:hp,speed = GetVehicleSpeed(veh);
- if(speed < 100)formatEx(str,"~g~%d", speed);
- else if(speed > 100 && speed < 160)formatEx(str,"~y~%d",speed);
- else if(speed > 160)formatEx(str,"~r~%d",speed);
- TextDrawSetString(Tacho[i][Speed],str);
- GetVehicleHealth(veh, hp); hp = floatround(hp);
- formatEx(str,"~p~%s", VehName[GetVehicleModel(veh)-400]), TextDrawSetString(Tacho[i][Name],str);
- for(new x = 0; x<10; x++)TextDrawHideForPlayer(i,Tacho[i][punkt][x]);
- if(hp>= 1000)for(new x = 0; x<10; x++)TextDrawShowForPlayer(i,Tacho[i][punkt][x]);
- else if(hp >= 900 && hp < 1000)for(new x = 0; x<9; x++)TextDrawShowForPlayer(i,Tacho[i][punkt][x]);
- else if(hp >= 800 && hp < 900) for(new x = 0; x<8; x++)TextDrawShowForPlayer(i,Tacho[i][punkt][x]);
- else if(hp >= 700 && hp < 800) for(new x = 0; x<7; x++)TextDrawShowForPlayer(i,Tacho[i][punkt][x]);
- else if(hp >= 600 && hp < 700)for(new x = 0; x<6; x++)TextDrawShowForPlayer(i,Tacho[i][punkt][x]);
- else if(hp >= 500 && hp < 600)for(new x = 0; x<5; x++)TextDrawShowForPlayer(i,Tacho[i][punkt][x]);
- else if(hp >= 400 && hp < 500)for(new x = 0; x<4; x++)TextDrawShowForPlayer(i,Tacho[i][punkt][x]);
- else if(hp >= 300 && hp < 400)for(new x = 0; x<3; x++)TextDrawShowForPlayer(i,Tacho[i][punkt][x]);
- else if(hp >= 200 && hp < 300)for(new x = 0; x<2; x++)TextDrawShowForPlayer(i,Tacho[i][punkt][x]);
- else if(hp >= 100 && hp < 200)for(new x = 0; x<1; x++)TextDrawShowForPlayer(i,Tacho[i][punkt][x]);
- }
- return 1;
- }
- stock GetVehicleSpeed(vehicleid){
- new Float:xPos[3];
- GetVehicleVelocity(vehicleid, xPos[0], xPos[1], xPos[2]);
- return floatround(floatsqroot(xPos[0] * xPos[0] + xPos[1] * xPos[1] + xPos[2] * xPos[2]) * 100 * 1.61);
- }
- stock IsNoTachoVeh(vehicleid)
- {
- if(vehicleid == INVALID_VEHICLE_ID)return 0;
- if(GetVehicleModel(vehicleid)==441||GetVehicleModel(vehicleid)==449||GetVehicleModel(vehicleid)==450||GetVehicleModel(vehicleid)==464||GetVehicleModel(vehicleid)==465||
- GetVehicleModel(vehicleid)==481||GetVehicleModel(vehicleid)==501||GetVehicleModel(vehicleid)==509||GetVehicleModel(vehicleid)==510||GetVehicleModel(vehicleid)==537||
- GetVehicleModel(vehicleid)==538||GetVehicleModel(vehicleid)==564||GetVehicleModel(vehicleid)==569||GetVehicleModel(vehicleid)==570||GetVehicleModel(vehicleid)==584||
- GetVehicleModel(vehicleid)==590||GetVehicleModel(vehicleid)==591||GetVehicleModel(vehicleid)==594||GetVehicleModel(vehicleid)==606||GetVehicleModel(vehicleid)==607||
- GetVehicleModel(vehicleid)==608||GetVehicleModel(vehicleid)==610||GetVehicleModel(vehicleid)==611)return 1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement