01.09.2017, 10:05
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_FIRE && !HoldingKey[playerid])
{
KeyCheck(playerid);
HoldingKey[playerid] = true;
}
return true;
}
PHP код:
Server:KeyCheck(playerid)
{
if(IsPlayerConnected(playerid))
{
new keys, ud, lr;
GetPlayerKeys(playerid, keys, ud, lr);
if(keys & KEY_FIRE && IsPlayerUsingFireExting(playerid))
{
SendClientMessage(playerid, COLOR_WHITE, "[DEBUG]: Fire key is being held down for fire extinguisher.");
SetTimerEx("KeyCheck", 500, 0, "i", playerid);
}
}
HoldingKey[playerid] = false;
return false;
}
PHP код:
IsPlayerUsingFireExting(playerid)
{
if(CurrentWeaponID[playerid] == 42) return true;
else return false;
}
Currently, All of this functions 100% correct but when I use another weapon or hold down the KEY_FIRE with no weapon and then try to use the extinguisher again, then it doesn't function anymore until a restart. Any ideas? Am I missing something obvious?
Thanks ahead of time!