09.07.2010, 03:41
wrote this quickly
pawn Код:
#define KEY_W -128
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_W)
{
if(GetPVarInt(playerid, "lastkey") != KEY_W) SetPVarInt(playerid, "lastkey", KEY_W);
else
{
SetPVarInt(playerid, "pressedwtwice", 1);
// they've hit w twice in a row
}
return 1;
}
if(newkeys & KEY_SPRINT)
{
if(GetPVarInt(playerid, "pressedwtwice") == 1)
{
// they have pressed w twice in a row and then sprint
SetPVarInt(playerid, "pressedwtwice", 0);
}
return 1;
}
SetPVarInt(playerid, "lastkey", 65535);
SetPVarInt(playerid, "pressedwtwice", 0);
return 1;
}