This gate is not opening. -
Kethrios - 27.12.2012
Hello everybody,
I started to do my own mappings for my server, and everytime I add a moving gate, it works fine. But this one don't want to open itself when I am in front of it, pressing CAPLOCKS.
Here is the full code
No errors, and it works fine with other gates, why not this one ? Is there a problem with the coordinates or something ? :
pawn Код:
new fbielecf1;
new fbielecf2;
pawn Код:
public cop_closeFrontGate(idgate)
{
if(idgate == 25)
{
MoveObject(fbielecf1, 1127.31, -1687.32, 16.10, 1.0, 0.00, 0.00, 90.00); // It's close
}
if(idgate == 26)
{
MoveObject(fbielecf2, 1127.31, -1679.75, 16.10, 1.0, 0.00, 0.00, 90.00); // It's close
}
}
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_CROUCH)
{
if(PlayerToPoint(20, playerid, 1132.2382,-1684.1768,13.3459) && PlayerToPoint(20, playerid, 1123.8972,-1683.6736,13.2420) && PlayerInfo[playerid][pMember] == FACT_FBI)
{
MoveObject(fbielecf1, 1127.31, -1696.80, 16.10, 1.0); // It's open
MoveObject(fbielecf2, 1127.31, -1670.75, 16.10, 1.0); // It's open
SetTimerEx("cop_closeGate", 10000, false, "d", 1);
}
}
}
pawn Код:
public createObjects()
{
// [MAPPING FBI]
fbielecf1 = CreateDynamicObject(2990, 1127.31, -1687.32, 16.10, 0.00, 0.00, 90.00); // Close
fbielecf2 = CreateDynamicObject(2990, 1127.31, -1679.75, 16.10, 0.00, 0.00, 90.00); // Close
}
Re: This gate is not opening. -
DaRk_RaiN - 27.12.2012
Make sure you press the KEY_CROUCH which is usually c not caps lock.
Re : This gate is not opening. -
Kethrios - 27.12.2012
I tried both, and it's not working acutally
Re: This gate is not opening. -
Threshold - 27.12.2012
Try using MoveDynamicObject instead of MoveObject. Otherwise change CreateDynamicObject to the CreateObject format.
Re: This gate is not opening. -
Mike_Peterson - 27.12.2012
Guys ,read his code :P
SetTimerEx("cop_closeGate", 10000, false, "d", 1);
requires the function 'cop_closeGate()'
his function:
'cop_closeFrontGate()'
so remove the 'Front' part from ur function (public and the forwarding)
Re: This gate is not opening. -
DaRk_RaiN - 27.12.2012
Nvm Replace the following line.
pawn Код:
public createObjects()
{
// [MAPPING FBI]
fbielecf1 = CreateObject(2990, 1127.31, -1687.32, 16.10, 0.00, 0.00, 90.00); // Close
fbielecf2 = CreateObject(2990, 1127.31, -1679.75, 16.10, 0.00, 0.00, 90.00); // Close
}
Re: This gate is not opening. -
ReD_Boii - 27.12.2012
Why you are not making it as command ?
Re : This gate is not opening. -
[HRD]Mar1 - 27.12.2012
replace PlayerToPoint by IsPlayerInRangeOfPoint(playerid, 40.0, 1123.8972,-1683.6736,13.2420)
Re : This gate is not opening. -
Kethrios - 27.12.2012
Thank you everybody, the door is fixed.
The thing is that now, the doesn't close anymore ^^
Any solution please ?
Re: This gate is not opening. -
Threshold - 27.12.2012
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_CROUCH)
{
if(PlayerToPoint(20, playerid, 1132.2382,-1684.1768,13.3459) && PlayerToPoint(20, playerid, 1123.8972,-1683.6736,13.2420) && PlayerInfo[playerid][pMember] == FACT_FBI)
{
MoveObject(fbielecf1, 1127.31, -1696.80, 16.10, 1.0); // It's open
MoveObject(fbielecf2, 1127.31, -1670.75, 16.10, 1.0); // It's open
SetTimer("cop_closeGate", 10000, false);
}
}
}
forward cop_closeGate();
public cop_closeGate()
{
MoveObject(fbielecf1, 1127.31, -1687.32, 16.10, 1.0, 0.00, 0.00, 90.00);
MoveObject(fbielecf2, 1127.31, -1679.75, 16.10, 1.0, 0.00, 0.00, 90.00);
return 1;
}
I'm assuming this is because you had cop_closeGate instead of cop_closeFrontGate in your SetTimerEx function, if you're still planning on using that function, it wouldn't be ' "d", 1 '. Overall I can't really see how you're getting those idgate variables :S