11.09.2012, 15:34
well...
you have this
which you farward the playerid so why not use it ? instead your making more lag !
Explained
as you have a cmd to turn on the speedo , etc..
just forward the playerid so you don't have to loop through all players creating more lag because the timers is running at 300 every millisecond for nearly every player on the server and if you add the loop that will eat a lot of CPU mem. will cause lag!
you have this
pawn Code:
SpeedoSysTimer[playerid] = SetTimerEx("SpeedoUpdate", 800, true, "i", playerid);
pawn Code:
public SpeedoUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:x,Float:y,Float:z,string[24],vehicleid = GetPlayerVehicleID(playerid);
GetVehicleVelocity(vehicleid,x,y,z);
format(string,sizeof(string),"~g~Speed: ~w~%d mph",floatround(floatsqroot(((x*x)+(y*y))+(z*z))*156.666667*0.641371192));
TextDrawSetString(speed[playerid],string);
format(string,sizeof(string),"~g~Fuel: ~w~%d%%",VehFuel[vehicleid]);
TextDrawSetString(fuel[playerid],string);
}
}
as you have a cmd to turn on the speedo , etc..
just forward the playerid so you don't have to loop through all players creating more lag because the timers is running at 300 every millisecond for nearly every player on the server and if you add the loop that will eat a lot of CPU mem. will cause lag!