SA-MP Forums Archive
Hi guys! Help? - 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: Hi guys! Help? (/showthread.php?tid=136247)



Hi guys! Help? - lionlev - 24.03.2010

I saw at gamerx server that you can fly(jump) by pressing h key. How can I do it? I wanna fly at my server too


Re: Hi guys! Help? - Faraday - 24.03.2010

Код:
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		if (PRESSED(KEY_CROUCH))
		{
    	new Float:x, Float:y, Float:z;
			GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
			SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x ,y ,z+0.3);
		}
	}
That's how I do it.
Add it in OnPlayerKeyStateChange


Re: Hi guys! Help? - lionlev - 24.03.2010

Quote:
Originally Posted by Faraday
Код:
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		if (PRESSED(KEY_CROUCH))
		{
    	new Float:x, Float:y, Float:z;
			GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
			SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x ,y ,z+0.3);
		}
	}
That's how I do it.
Add it in OnPlayerKeyStateChange
error 017: undefined symbol "PRESSED"


Re: Hi guys! Help? - Correlli - 24.03.2010

Quote:
Originally Posted by lionlev
error 017: undefined symbol "PRESSED"
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange


Re: Hi guys! Help? - Faraday - 24.03.2010

or
Код:
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))



Re: Hi guys! Help? - lionlev - 24.03.2010

Quote:
Originally Posted by Faraday
or
Код:
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
I am new to pawno, so where do I put the define?


Re: Hi guys! Help? - lionlev - 24.03.2010

Quote:
Originally Posted by lionlev
Quote:
Originally Posted by Faraday
or
Код:
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
I am new to pawno, so where do I put the define?
nvm, I got it. But I am not jumping with cars.... Why it's doesn't work?


Re: Hi guys! Help? - Faraday - 24.03.2010

Show your OnPlayerKeyStateChange code.


Re: Hi guys! Help? - lionlev - 24.03.2010

Quote:
Originally Posted by Faraday
Show your OnPlayerKeyStateChange code.
nvm It working... I though I have to press on crouch key to jump, but I have to press on horn key :P Thanks


Re: Hi guys! Help? - aircombat - 24.03.2010

Horn key = KEY_SPRINT