11.09.2012, 19:15
Код:
public Speedometer(playerid, vehicleid) { new string[65], Float:speed_x, Float:speed_y, Float:speed_z; GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z); new Float:final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*216.666667; // 136.666667 = kmph // 85.4166672= mph vehicleDB[vehicleid][Rida]+=final_speed; if(vehicleDB[vehicleid][Fueltype] == 2) { vehicleDB[vehicleid][Fuel]-=final_speed/100000*7*2/15; } else if(vehicleDB[vehicleid][Fueltype] == 1) { vehicleDB[vehicleid][Fuel]-=final_speed/100000*7*2/17; } else if(vehicleDB[vehicleid][Fueltype] == 3) { vehicleDB[vehicleid][Fuel]-=final_speed/100000*7*2/18; } if(vehicleDB[vehicleid][Fuel] <= 0) { new Carvar[7]; GetVehicleParamsEx(vehicleid, Carvar[0], Carvar[1], Carvar[2], Carvar[3], Carvar[4], Carvar[5], Carvar[6]); SetVehicleParamsEx(vehicleid, 0, Carvar[1], Carvar[2], Carvar[3], Carvar[4], Carvar[5], Carvar[6]); vehicleDB[vehicleid][Fuel]=0; } format(string, 65, "Speed: ~g~%ikm/h~n~~w~Fuel: ~g~%.2fl~n~~w~Driven: ~g~%.1fkm", GetVehicleSpeed(vehicleid, true), vehicleDB[vehicleid][Fuel], vehicleDB[vehicleid][Rida]/100000*7*2); TextDrawSetString(Spido[playerid], string); }
Any solutions?