Automatic gates
#4

I recommend usin mGates by MP2, simplifies the process in making gates!
As for the timers, make a function like this

pawn Код:
new bool:GateOpen[10];

forward isPlayerInArea();
public isPlayerInArea()
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInRangeOfPoint(i, 10.0, 0.0000, 0.0000, 0.0000); OpenGate(0); //mibgate
        else if(IsPlayerInRangeOfPoint(i, 10.0, 0.000, 0.0000, 0.0000) OpenGate(1); // Some other gate
    }
    return 1;
}

forward OpenGate(Gate);
public OpenGate(Gate)
{
    switch(Gate)
    {
        case 0: // For example mibgate
        {
            if(!GateOpen[Gate])
            {
                MoveDynamicObject(mibgate, 0.0000, 0.0000, 0.0000, 0.5);
                SetTimerEx("CloseGate", 7000, false, "i", Gate);
                GateOpen[Gate] = true;
            }
        }
    }
    return 1;
}

forward CloseGate(Gate);
public CloseGate(Gate)
{
    switch(Gate)
    {
        case 0: // mibgate
        {
            MoveDynamicObject(mibgate, 0.0000, 0.0000, 0.0000, 0.5);
            GateOpen[Gate] = false;
        }
    }
    return 1;
}
As for the isPlayerInArea, you could do it like this with y_timers (include by ******)

pawn Код:
ptask isPlayerInArea[1000](playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 0.0000, 0.0000, 0.0000); OpenGate(0); // mibgate
}
Shortens it down a lot if you ask me.
Reply


Messages In This Thread
Automatic gates - by JackBurgani - 08.05.2013, 22:12
Re: Automatic gates - by IceCube! - 08.05.2013, 22:17
Re: Automatic gates - by JackBurgani - 08.05.2013, 22:22
Re: Automatic gates - by Knappen - 08.05.2013, 22:42
Re: Automatic gates - by JackBurgani - 08.05.2013, 22:52
Re: Automatic gates - by JackBurgani - 08.05.2013, 23:21
Re: Automatic gates - by MP2 - 09.05.2013, 05:25

Forum Jump:


Users browsing this thread: 3 Guest(s)