public Speed()
{
for(new p = 0; p < GetMaxPlayers(); p++) if(IsPlayerConnected(p) && !IsPlayerNPC(p))
{
new vehicleid = GetPlayerVehicleID(p);
if(vehicleid)
{
new string[128], Float:X, Float:Y, Float:Z, Float:PointToPoint, Float:vhealth;
GetVehicleVelocity(vehicleid, X, Y, Z);
PointToPoint = (floatsqroot(floatpower(X, 2) + floatpower(Y, 2) + floatpower(Z, 2)))*100;
GetVehicleHealth(vehicleid,vhealth);
format(string,sizeof string ,"{00D1FF}Vehнculo: {FFFFFF}%s\n{00D1FF}Vida: {FFFFFF}%.2f\n{00D1FF}Velocidad: {FFFFFF}%ikm/h", VehicleName[GetVehicleModel(vehicleid)-400], vhealth, floatround(PointToPoint, floatround_floor));
DeletePlayer3DTextLabel(p, speedo3Dtext);
speedo3Dtext = CreatePlayer3DTextLabel(p, string, speedcolor, 0.0,-1.6,-0.35,20.0, INVALID_PLAYER_ID, vehicleid);
} else if(p) { DeletePlayer3DTextLabel(p, speedo3Dtext); }
}
}
VehicleName[GetVehicleModel(vehicleid)-400] |
new VehicleName[212][] = {
"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 1", "Previon", "Coach", "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo",
"Seasparrow", "Pizzaboy", "Tram", "Trailer 2", "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 LA", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit",
"Utility", "Nevada", "Yosemite", "Windsor", "Monster A", "Monster B", "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 3", "Emperor", "Wayfarer", "Euros", "Hotdog",
"Club", "Freight Carriage", "Trailer 4", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car (LSPD)", "Police Car (SFPD)",
"Police Car (LVPD)", "Police Ranger", "Picador", "S.W.A.T", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer A",
"Luggage Trailer B", "Stairs", "Boxville", "Tiller", "Utility Trailer" };
VehicleName[GetVehicleModel(vehicleid)-400]
VehicleName[GetVehicleModel(vehicleid)+400]
It's not :
Код:
VehicleName[GetVehicleModel(vehicleid)-400] Код:
VehicleName[GetVehicleModel(vehicleid)+400] |
new VehicleName[212]
new vehname = GetVehicleModel(vehicleid) - 400;
format(bla,sizeof bla,"bla bla veh name %s",VehicleName[vehname]);
That would not make any sense.
Код:
new VehicleName[212] PHP код:
|
native IsValidVehicle(vehicleid);
public Speed()
{
for(new p = 0; p < GetMaxPlayers(); p++) if(IsPlayerConnected(p) && !IsPlayerNPC(p))
{
new vehicleid = GetPlayerVehicleID(p);
if(!IsValidVehicle(vehicleid))
continue;
if(vehicleid)
{
new string[128], Float:X, Float:Y, Float:Z, Float:PointToPoint, Float:vhealth;
GetVehicleVelocity(vehicleid, X, Y, Z);
PointToPoint = (floatsqroot(floatpower(X, 2) + floatpower(Y, 2) + floatpower(Z, 2)))*100;
GetVehicleHealth(vehicleid,vhealth);
format(string,sizeof string ,"{00D1FF}Vehнculo: {FFFFFF}%s\n{00D1FF}Vida: {FFFFFF}%.2f\n{00D1FF}Velocidad: {FFFFFF}%ikm/h", VehicleName[GetVehicleModel(vehicleid)-400], vhealth, floatround(PointToPoint, floatround_floor));
DeletePlayer3DTextLabel(p, speedo3Dtext);
speedo3Dtext = CreatePlayer3DTextLabel(p, string, speedcolor, 0.0,-1.6,-0.35,20.0, INVALID_PLAYER_ID, vehicleid);
} else if(p) { DeletePlayer3DTextLabel(p, speedo3Dtext); }
}
}