CALLBACK: UpdateSpeed()
{
for(new playerid=0;playerid<MAX_PLAYERS;playerid++)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicle = GetPlayerVehicleID(playerid);
new string23[20];
format(string23,sizeof(string23),"Fuel:~g~~h~%d", Gas[vehicle]);
PlayerTextDrawSetString(playerid,Speedo[1][playerid],string23);
new string1[64];
format(string1,sizeof(string1),"Speed: ~b~~h~%d ~w~KM/.",GetVehicleSpeed(vehicle));
PlayerTextDrawSetString(playerid,Speedo[0][playerid],string1);
new stra[12];
if(VehicleInfo[vehicle][pEngineStatus] == 0)format(stra,sizeof(stra),"~r~E",SpeedOnly(vehicle));
else format(stra,sizeof(stra),"~b~E",SpeedOnly(vehicle));
PlayerTextDrawSetString(playerid,Speedo[5][playerid],stra);
new stra1[12];
if(VehicleInfo[vehicle][pLightsStatus] == 0) format(stra1,sizeof(stra1),"~r~L",SpeedOnly(vehicle));
else format(stra1,sizeof(stra1),"~b~L",SpeedOnly(vehicle));
PlayerTextDrawSetString(playerid,Speedo[6][playerid],stra1);
new stra2[12];
if(CarInfo[vehicle][cLock] == 0)format(stra2,sizeof(stra2),"~r~D",SpeedOnly(vehicle));
else format(stra2,sizeof(stra2),"~g~D",SpeedOnly(vehicle));
PlayerTextDrawSetString(playerid,Speedo[7][playerid],stra2);
}
}
}
return true;
}
CALLBACK: UpdateSpeed()
{
for(new i = GetPlayerPoolSize(); i != -1; i--)
{
if(!IsPlayerConnected(i) || IsPlayerNPC(i) || GetPlayerState(i) != PLAYER_STATE_DRIVER) continue;
new vehicleid = GetPlayerVehicleID(i), string_big[65];
format(string_big, sizeof(string_big), "Fuel:~g~~h~%d", Gas[vehicleid]);
PlayerTextDrawSetString(i, Speedo[1][i], string_big);
format(string_big, sizeof(string_big), "Speed: ~b~~h~%d ~w~KM/.", GetVehicleSpeed(vehicleid));
PlayerTextDrawSetString(i, Speedo[0][i], string_big);
if(!VehicleInfo[vehicleid][pEngineStatus]) format(string_big, sizeof(string_big), "~r~E", SpeedOnly(vehicleid));
else format(string_big, sizeof(string_big), "~b~E", SpeedOnly(vehicleid));
PlayerTextDrawSetString(i, Speedo[5][i], string_big);
if(!VehicleInfo[vehicleid][pLightsStatus]) format(string_big, sizeof(string_big), "~r~L", SpeedOnly(vehicleid));
else format(string_big, sizeof(string_big),"~b~L", SpeedOnly(vehicleid));
PlayerTextDrawSetString(i, Speedo[6][i], string_big);
if(!CarInfo[vehicleid][cLock]) format(string_big, sizeof(string_big), "~r~D", SpeedOnly(vehicleid));
else format(string_big, sizeof(string_big), "~g~D", SpeedOnly(vehicleid));
PlayerTextDrawSetString(i, Speedo[7][i], string_big);
}
return 1;
}
И кстати лучше обновлять текстдравы только тогда - когда текст реально изменился, а по таймеру каждый раз юзать PlayerTextDrawSetString - это не есть норма.
|