SA-MP Forums Archive
[SOLVED]Speed = 9000+ ? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED]Speed = 9000+ ? (/showthread.php?tid=94499)



[SOLVED]Speed = 9000+ ? - Rizard - 30.08.2009

Hi,

I'm currently debugging my gamemode and bumbep on this issue;

Having a speedometer gives me the problem when entering a car, the speed is for like 1/2 of a sec 9000+ ... and then it goes to 0 like it should do.

Anyone knows exactly what my problem is? or do you need any code? let me know

Grts Riz


Re: Speed = 9000+ ? - kc - 30.08.2009

inside OnPlayerEnterVehicle, update the oldx oldy oldz positions all speedos have to the players current position.


Re: Speed = 9000+ ? - Rizard - 30.08.2009

Total edit:

I put this in OnPlayerEnterVehicle();
pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
SavePlayerPos[playerid][LastX] = x;
SavePlayerPos[playerid][LastY] = y;
SavePlayerPos[playerid][LastZ] = z;
Now the speed onplayerentervehicle is lowered , it has a "peek" of 990 now and then goes back 2 0...
OnPlayerEnterVehicle(); isn't the right pos?

EDIT agian xD:
SOLVED!!

I put the code in OnplayerStateChange();
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
SavePlayerPos[playerid][LastX] = x;
SavePlayerPos[playerid][LastY] = y;
SavePlayerPos[playerid][LastZ] = z;
}
Thnx for your help kc 'all I needed was a clear mind'

Grts Riz