Player key cmd?
#1

Hi i want to learn the script for...
When a player press a button something happens.
Reply
#2

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}
Uses this function to check if the player pressed a key,and assign commands to it
Reply
#3

thank you
Reply
#4

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
Reply
#5

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));
Reply
#6

ελληνας ειμαι
Reply
#7

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..
Reply
#8

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.
Reply
#9

.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));
Reply
#10

Remove the brackets
pawn Код:
SetVehicleVelocity(GetPlayerVehicleID(playerid), v[0], v[1], v[2]+20);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)