30.08.2009, 07:32
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new keys, updown, leftright;
new Float:X, Float:Y, Float:Z;
if (AirBreakMode[playerid] == 1)
{
GetPlayerKeys(playerid, keys, updown, leftright);
if (updown == KEY_UP)
{
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y+2.5, Z);
PlayerPlaySound(playerid, 1138, X, Y, Z);
}
else if (updown == KEY_DOWN)
{
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y-2.5, Z);
PlayerPlaySound(playerid, 1138, X, Y, Z);
}
else if (leftright == KEY_RIGHT)
{
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X+2.5, Y, Z);
PlayerPlaySound(playerid, 1138, X, Y, Z);
}
else if (leftright == KEY_LEFT)
{
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X-2.5, Y, Z);
PlayerPlaySound(playerid, 1138, X, Y, Z);
}
}
return 1;
}
It isn't going too well. I don't have much experience at all with OnPlayerKeyStateChange. When I press capslock though; my character moves Y-2.5. I need to know how to properly use this.