SA-MP Forums Archive
Speed Boost is bugged - 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: Speed Boost is bugged (/showthread.php?tid=173724)



Speed Boost is bugged - HardstylerNiko - 03.09.2010

Hey Guys,
i made a Speed boost, but if i press the Key ingame, nothing happens.
Can anyone correct it, please? =)

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  	if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
 	{
  		if (newkeys & KEY_SUBMISSION)
		{
			new Float:xx, Float:xy, Float:xz;
			GetVehicleVelocity(GetPlayerVehicleID(playerid),xx, xy, xz);
			SetVehicleVelocity(GetPlayerVehicleID(playerid),x*5,y*5,z*5);
			return 1;
		}
		return 1;
	}
	return 1;
}



Re: Speed Boost is bugged - CyNiC - 03.09.2010

Try put the verification: if(new keys ... before at if ( IsPlayerInVe...


Re: Speed Boost is bugged - HardstylerNiko - 03.09.2010

Isn't working >.<
But thanks...
any other solutions ?


Re: Speed Boost is bugged - CyNiC - 03.09.2010

A little error, the float variable is xx,yy,and xz, and you put x*5,y*5,z*5:
So:
pawn Код:
SetVehicleVelocity(GetPlayerVehicleID(playerid),xx*5,xy*5,xz*5);



Re: Speed Boost is bugged - HardstylerNiko - 03.09.2010

nope, still bugged xD


Re: Speed Boost is bugged - R@ger - 03.09.2010

Код:
if (PRESSED(KEY_JUMP))
	{
		new
			Float:x,
			Float:y,
			Float:z;
		GetPlayerPos(playerid, x, y, z);
		SetPlayerPos(playerid, x*5, y*5, z*5);
	}
	return 1;
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

source samp wiki


Re: Speed Boost is bugged - Jochemd - 03.09.2010

Why do you have return 1; 3 times? delete the first 2.


Re: Speed Boost is bugged - HardstylerNiko - 03.09.2010

both of your solutions aren't working...
What the hell is wrong with that script? O.o