19.03.2013, 10:19
(
Последний раз редактировалось klotebandit; 19.03.2013 в 11:47.
)
Hi, im trying to get a boost when someone presses the key_down while driving im using on player update
I tested this code but it is only fired when i pres the downbutton on foot, however the downPressed message is shown when it should and the downReleased also. but still only on foot.
please help
Edit:
I used the OnPlayerKeyStateChange with a different key so my problem is fixed. Thanks all
I tested this code but it is only fired when i pres the downbutton on foot, however the downPressed message is shown when it should and the downReleased also. but still only on foot.
please help
Код:
public OnPlayerUpdate(playerid)
{
new keys, updown, leftright;
GetPlayerKeys(playerid, keys, updown, leftright);
if(updown > 0 && pKey[playerid][1] != 1)
{
pKey[playerid][1] = 1; // Remember that they are pressing down
print("downPressed");
}
if(!(updown > 0) && pKey[playerid][1] == 1){
pKey[playerid][1] = 0;
print("downReleased");
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
new Float:x, Float:y, Float:z;
GetVehicleVelocity(playerid, x, y, z);
new playerVeh = GetPlayerVehicleID(playerid);
SetVehicleVelocity(playerVeh, x, y+50, z);
print("fired");
}
}
return 1;
}
I used the OnPlayerKeyStateChange with a different key so my problem is fixed. Thanks all


. Does annyone know if you can also check for the "S" button or just a general backwards in vehicle button