07.02.2010, 08:39
When i enter a car it doesnt shows it to me. I have a timer that runs this public every 1sec.
Код:
public UpdateMeter(playerid) { for(new i=0; i < MAX_PLAYERS; i++) { if(IsPlayerInAnyVehicle(i) && speedometer[i] == 1) { TextDrawShowForPlayer(playerid,Text:speedo[i]); new vehicleid = GetPlayerVehicleID(playerid); new Float:X, Float:Y, Float:Z, Float:KMH; new Float:hp; hp = GetVehicleHealth(vehicleid,hp); GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z); KMH = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)), floatpower(Z, 2))), 100.0); if(KMH == 0) { VehicleInfo[vehicleid][Fuel] -= 0.00; } else if( KMH >= 1 && KMH <= 65 ) { VehicleInfo[vehicleid][Fuel] -= 0.01; } else if( KMH >= 66 && KMH <= 120 ) { VehicleInfo[vehicleid][Fuel] -= 0.02; } else { VehicleInfo[vehicleid][Fuel] -= 0.03; } if(VehicleInfo[vehicleid][Fuel] == 0) { SCM(playerid,GREY,"No more fuel left."); RemovePlayerFromVehicle(playerid); } new string[128]; format(string, sizeof(string), "~b~~h~~h~Name: ~w~%s~n~~g~~h~Speed: ~w~%0.0f km/h~n~~y~~h~Fuel: ~w~%.1f l~n~~r~~h~Health: ~w~%.2f", CarModels[GetVehicleModel(GetPlayerVehicleID(playerid))-400],floatround(floatdiv(KMH, 1.609344)),VehicleInfo[vehicleid][Fuel],hp); TextDrawSetString(Text:speedo[i], string); TextDrawShowForPlayer(i,Text:speedo[i]); } } }