This gate is not opening.
#1

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
}
Reply
#2

Make sure you press the KEY_CROUCH which is usually c not caps lock.
Reply
#3

I tried both, and it's not working acutally
Reply
#4

Try using MoveDynamicObject instead of MoveObject. Otherwise change CreateDynamicObject to the CreateObject format.
Reply
#5

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)
Reply
#6

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
}
Reply
#7

Why you are not making it as command ?
Reply
#8

replace PlayerToPoint by IsPlayerInRangeOfPoint(playerid, 40.0, 1123.8972,-1683.6736,13.2420)
Reply
#9

Thank you everybody, the door is fixed.
The thing is that now, the doesn't close anymore ^^

Any solution please ?
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)