02.07.2016, 11:03
Hello!
Try this:
You must press the key one times. After that you must press it again to close the gate. Don't hold the key.
Try this:
PHP код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
if(job[playerid] == POLICE)
{
if((newkeys & 8 && !IsPlayerInAnyVehicle(playerid)) || (newkeys & KEY_HANDBRAKE && IsPlayerInAnyVehicle(playerid)))
{
if(IsPlayerInRangeOfPoint(playerid,3.0,-1641.1395,686.5178,7.1875))
{
if(DOORMODE == false)
{
MoveDynamicObject(POLICIJOSDOORS[0],-1641.55225, 688.7032, 6.18130, 3.0);
SendClientMessage(playerid,green,"Door is opening");
DOORMODE = true;
}
else if(DOORMODE == true)
{
MoveDynamicObject(POLICEDOORS[0], -1641.55225, 687.22321, 6.18130, 3.0);
SendClientMessage(playerid, red, "Doors are closing");
DOORMODE = false;
}
}
else if(IsPlayerInRangeOfPoint(playerid,10.0, -1641.1897,679.5863,7.1875))
{
if(DOORMODE2 == false)
{
MoveDynamicObject(POLICEGATES[0], -1641.60791, 679.52722, 11.5965, 3.0);
SendClientMessage(playerid, green, "Gate is opening");
DOORMODE2 = true;
}
else if(DOORMODE2 == true)
{
MoveDynamicObject(POLICEGATES[0], -1641.60791, 679.52722, 7.67200, 3.0);
SendClientMessage(playerid, red, "Gate is closing");
DOORMODE2 = false;
}
}
}
}
return 1;
}