Player key cmd? - 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: Player key cmd? (
/showthread.php?tid=440318)
Player key cmd? -
jimangel2001 - 29.05.2013
Hi i want to learn the script for...
When a player press a button something happens.
Re: Player key cmd? -
mahdi499 - 29.05.2013
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
Uses this function to check if the player pressed a key,and assign commands to it
Re: Player key cmd? -
jimangel2001 - 29.05.2013
thank you
Re: Player key cmd? -
jimangel2001 - 29.05.2013
i am trying to make a command where when i press j the car where i am inside jumps but i cant do it i am trying but i cant
AW: Player key cmd? -
HurtLocker - 29.05.2013
The j key you want is not available. Choose between those:
https://sampwiki.blast.hk/wiki/Keys
The other tools you will need are:
new Float:v[3];
GetPlayerState(playerid) --> use this to check if player is driver of the car. choose here:
https://sampwiki.blast.hk/wiki/Playerstates
GetVehicleVelocity(GetPlayerVehicleID(playerid), v[0], v[1], v[2]);
SetVehicleVelocity(GetPlayerVehicleID, v[0], v[1], v[2]+(velocity adding here));
Re: Player key cmd? -
jimangel2001 - 29.05.2013
ελληνας ειμαι
Re: Player key cmd? -
jimangel2001 - 29.05.2013
i am playing in a server where when you enter a car and press y it jums or when you press 2 it boosts so..
Re: Player key cmd? -
Konewka - 29.05.2013
Quote:
Originally Posted by jimangel2001
i am playing in a server where when you enter a car and press y it jums or when you press 2 it boosts so..
|
You can use Y or 2, but no J key. As @HurtLocker use wiki to help you out which keys you can use in SAMP.
Re: Player key cmd? -
jimangel2001 - 29.05.2013
.pwn(287) : error 076: syntax error in the expression, or invalid function call
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new v[3];
if ((newkeys & KEY_YES) && !(oldkeys & KEY_YES))
GetPlayerState(playerid);
GetVehicleVelocity(GetPlayerVehicleID(playerid), v[0], v[1], v[2]);
SetVehicleVelocity(GetPlayerVehicleID, v[0], v[1], v[2]+(20));
return 1;
}
287 = SetVehicleVelocity(GetPlayerVehicleID, v[0], v[1], v[2]+(20));
Re: Player key cmd? -
Dragonsaurus - 29.05.2013
Remove the brackets
pawn Код:
SetVehicleVelocity(GetPlayerVehicleID(playerid), v[0], v[1], v[2]+20);