SA-MP Forums Archive
speedo and fuel 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 and fuel problem (/showthread.php?tid=401346)



speedo and fuel problem - bensmart469 - 22.12.2012

I found the problem, i changed it to per-player variables.


Re: speedo and fuel problem - Faisal_khan - 22.12.2012

Try just GetPlayerState.
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new string[128], speed = GetVehicleSpeed(GetPlayerVehicleID(playerid), 0);
            format(string, sizeof(string), "~g~Fuel: ~w~%d", Fuel[vehicleid]);
            TextDrawSetString(FuelTD, string);
              TextDrawShowForPlayer(playerid, FuelTD);
            format(string, sizeof(string), "~r~KPH: ~w~%d", speed);
            TextDrawSetString(SpeedoTD, string);
              TextDrawShowForPlayer(playerid, SpeedoTD);

        }



Re: speedo and fuel problem - bensmart469 - 22.12.2012

What i mean is, the script is sending all of the drivers speeds and fuel to all drivers so if one person was going 90 kph, other 130 kph, and another 30 kph, the drivers would keep getting 90, 130, and 30 kph on their speedometers


Re: speedo and fuel problem - Lordzy - 22.12.2012

I recommend you not to use 'OnPlayerUpdate' for fuel/speedometer functions. Use a timer which repeats always where you can update the textdraws according to speed.