Speedo problem - 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: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Speedo problem (
/showthread.php?tid=487505)
Speedo problem -
Face9000 - 13.01.2014
Can someone tell me why this speedometer code doesn't work??
pawn Код:
if(IsPlayerInAnyVehicle(i))
{
new s[128],Float:health,vehicleid = GetPlayerVehicleID(i);
format(s, sizeof(s), "~g~%d ~w~km/h - ~g~%.2f ~w~hp", GetVehicleSpeed(vehicleid), health);
TextDrawSetString(KillsTxd[i], s);
TextDrawShowForPlayer(i, Speedo[0][i]);
TextDrawShowForPlayer(i, Speedo[1][i]);
}
else
{
TextDrawHideForPlayer(i, Speedo[0][i]);
TextDrawHideForPlayer(i, Speedo[1][i]);
}
I have it in a timer. Is supposed to show vehicle speed in km/h and current hp..but both doesnt update.
Re: Speedo problem -
Jstylezzz - 13.01.2014
Stupid question from me maybe, but have you debugged the code? Like, putting print statements around the timer (most important of all, inside the code you showed above)? I solved a lot of my problems like that most of the time.
Re: Speedo problem -
Vince - 13.01.2014
You're not even getting any health at all. It's just an empty variable.
Re: Speedo problem -
Face9000 - 13.01.2014
@Vince omg

About the health i fixed, about the speed? Jstylezz i debugged already
Re: Speedo problem -
tyler12 - 13.01.2014
Post the GetVehicleSpeed function.
Just thought I'd state the obvious that you're not even setting the speedometer string.
Re: Speedo problem -
Face9000 - 13.01.2014
Ah no, fixed.