02.07.2016, 09:07
(
Последний раз редактировалось Spookis; 02.07.2016 в 10:32.
)
Good day SA-MP community,
So i'm making couple of gates (1 door & 1 gate to be exact) to my job, and i have 2 problems
• When i'm not in a vehicle and hold space it spams my chat door is opening and door is closing, and the gate aswell spams opens/closes quickly, but when i'm in the vehicle if i hold space there is no chat spam and doors are not spam opening/ closing, like if i press space and hold it will open, if i press again, it will close everything is normal exept when i'm on foot.
• So the second doors(gate) i've made even when i'm on foot or in a vehicle the second door isn't opening or closing, and i don't get any SendClientMessage, ofcourse i'm in a range of that coordinates i placed.
Here's my code:
Foto when on foot it spams the chat:
http://imgur.com/a/9jSWM
So if anyone knows what i'm doing wrong, please let me know,
Thank you!
So i'm making couple of gates (1 door & 1 gate to be exact) to my job, and i have 2 problems
• When i'm not in a vehicle and hold space it spams my chat door is opening and door is closing, and the gate aswell spams opens/closes quickly, but when i'm in the vehicle if i hold space there is no chat spam and doors are not spam opening/ closing, like if i press space and hold it will open, if i press again, it will close everything is normal exept when i'm on foot.
• So the second doors(gate) i've made even when i'm on foot or in a vehicle the second door isn't opening or closing, and i don't get any SendClientMessage, ofcourse i'm in a range of that coordinates i placed.
Here's my code:
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(job[playerid] == POLICE)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, -1641.1395,686.5178,7.1875))
{
if((newkeys & 8 && !IsPlayerInAnyVehicle(playerid)) || (newkeys & KEY_HANDBRAKE && IsPlayerInAnyVehicle(playerid)))
{
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;
}
http://imgur.com/a/9jSWM
So if anyone knows what i'm doing wrong, please let me know,
Thank you!


After that you must press it again to close the gate. 