[FilterScript] Simple Vehicle Speedometer/Health/Vehicle Name - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Simple Vehicle Speedometer/Health/Vehicle Name (
/showthread.php?tid=589767)
Re: Simple Vehicle Speedometer/Health/Vehicle Name -
FreAkeD - 27.09.2015
Quote:
Originally Posted by ahameed4755
NICE!
|
Cheers
Re: Simple Vehicle Speedometer/Health/Vehicle Name -
Stoyanov - 28.09.2015
Why you use loop under OnPlayerUpdate..? It's useless because this function have argument (playerid) for each player? This loop can cause lag.
I think your code under OnPlayerUpdate should be:
Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vspeed[25];
format(vspeed, sizeof(vspeed), "Speed: ~y~%d ~g~KM/H", GetVehicleSpeed(playerid));
PlayerTextDrawSetString(playerid, VehicleSpeed[playerid], vspeed);
new vhealthtd[32], Float:vHealth;
GetVehicleHealth(GetPlayerVehicleID(playerid), vHealth);
new Float:percentage = (((vHealth - 250.0) / (1000.0 - 250.0)) * 100.0);
format(vhealthtd, sizeof(vhealthtd), "Vehicle Health: ~g~%.0f%", percentage);
PlayerTextDrawSetString(playerid, VehicleHealth[playerid], vhealthtd);
}
return 1;
}
Re: Simple Vehicle Speedometer/Health/Vehicle Name -
Pr0GreSiVe - 19.10.2015
Amazing script bro +rep