problem with moving objects -
Dainyzxz - 16.03.2013
hello, how i could do this code working ?
i want to do if player pres num 4 open gates if it closed and close gates if it's opened, but i have an error
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_ANALOG_LEFT ))
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1587.9688,-1722.7001,1449.6000))//6carter
{
if(PlayerInfo[playerid][pJailAccess] < 1) return SCM(playerid, COLOR_RED,"You don't have a key.");
{
if(GetObjectPos(GATE6, 1587.9688,-1722.7001,1449.6000)) MoveObject(GATE6,1587.89941406,-1718.39941406,1448.59997559,2.0); SCM(playerid,0xFFFFFFFF,"closing!");
if(GetObjectPos(GATE6, 1587.89941406,-1718.39941406,1448.59997559)) MoveObject(GATE6,1587.9688,-1722.7001,1449.6000,2.0); SCM(playerid,0xFFFFFFFF,"opening!");
}
}
return 1;
}
Код:
(342) : error 035: argument type mismatch (argument 2)
(343) : error 035: argument type mismatch (argument 2)
Re: problem with moving objects -
DaRk_RaiN - 16.03.2013
I had the exact same problem, some of the keys just wouldn't work for me, change the KEY_ANALOG_LEFT withe KEY_FIRE or KEY_HANDBRAKE.
Re: problem with moving objects -
papedo - 16.03.2013
KEY_ANALOG_LEFT is not detectable in OnPlayerStateChange callback
Re: problem with moving objects -
Dainyzxz - 16.03.2013
no,
KEY_ANALOG_LEFT is working than i use it only for opening gates, it's not workiing than i want to do closing and opening with the same key, this code problem is these two lines, but i don't know how to fix it
Код:
if(GetObjectPos(GATE6, 1587.9688,-1722.7001,1449.6000)) MoveObject(GATE6,1587.89941406,-1718.39941406,1448.59997559,2.0); SCM(playerid,0xFFFFFFFF,"closing!");
if(GetObjectPos(GATE6, 1587.89941406,-1718.39941406,1448.59997559)) MoveObject(GATE6,1587.9688,-1722.7001,1449.6000,2.0); SCM(playerid,0xFFFFFFFF,"opening!");
Re : problem with moving objects -
morocco - 16.03.2013
Ues
new NameGate
Re: problem with moving objects -
Vince - 16.03.2013
This is not how GetObjectPos works. Just use a static variable. Under your
pawn Код:
if (PRESSED(KEY_ANALOG_LEFT ))
add:
then:
pawn Код:
if(gateOpen == false) // is closed, open it
{
}
else // is open, close it
{
}
gateStatus = !gateStatus; // invert status; 1 -> 0, 0 -> 1