Not moving object
#1

Im making an auto gate but whenever i walk up to the gate it doesnt open..

timers/names
pawn Код:
forward lvpdGatesOpen();
forward lvpdGatesClose();
forward lspdGatesOpen();
forward lspdGatesClose();

new lvpdgate;
new lspdgate;
new lvpdGateOpen = 0;
new lspdGateOpen = 0;
pawn Код:
public OnGameModeInit()
{  
    SetTimer("lvpdGatesOpen",1000,1);
    SetTimer("lspdGatesOpen",1000,1);
   
    lvpdgate = CreateDynamicObject(971, 2334.98, 2443.39, 7.50, 0.00, 0.00, 60.06);
    lspdgate = CreateDynamicObject(971, 1588.98, -1638.15, 14.36, 0.00, 0.00, 179.10);
   
    return 1;
}

LVPD gate
pawn Код:
public lvpdGatesOpen()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(PlayerToPoint(10.0, i, 2334.98, 2443.39, 7.50) && lvpdGateOpen == 0)
        {
            //if(gTeam[i] == TEAM_NOOBS)
            {
                MoveObject(lvpdgate, 2334.98, 2443.39, 1.00, 5);
                lvpdGateOpen =1;
                SetTimer("lvpdGatesClose",7000,0);
        }
        }
    }
}

public lvpdGatesClose()
{
     MoveObject(lvpdgate, 2334.98, 2443.39, 7.50, 5);
     lvpdGateOpen =0;
}
LSPD gate
pawn Код:
public lspdGatesOpen()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(PlayerToPoint(10.0, i, 1588.98, -1638.15, 14.36) && lspdGateOpen == 0)
        {
            //if(gTeam[i] == TEAM_NOOBS)
            {
                MoveObject(lspdgate, 1588.98, -1638.15, 8.36, 5);
                lspdGateOpen =1;
                SetTimer("lspdGatesClose",7000,0);
        }
        }
    }
}

public lspdGatesClose()
{
     MoveObject(lspdgate, 1588.98, -1638.15, 14.36, 5);
     lspdGateOpen =0;
}
pawn Код:
PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
    new Float:oldpos[3], Float:temppos[3];
    GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
    temppos[0] = (oldpos[0] -X);
    temppos[1] = (oldpos[1] -Y);
    temppos[2] = (oldpos[2] -Z);
    if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
    {
        return true;
    }
    return false;
}
Reply


Messages In This Thread
Not moving object - by SnG.Scot_MisCuDI - 20.05.2012, 22:55
Re: Not moving object - by MP2 - 21.05.2012, 02:13
Re: Not moving object - by coole210 - 21.05.2012, 02:16
Re: Not moving object - by SnG.Scot_MisCuDI - 21.05.2012, 02:19
Re: Not moving object - by MP2 - 21.05.2012, 02:22
Re: Not moving object - by SnG.Scot_MisCuDI - 21.05.2012, 02:25
Re: Not moving object - by MP2 - 21.05.2012, 02:38
Re: Not moving object - by SnG.Scot_MisCuDI - 21.05.2012, 02:40
Re: Not moving object - by MP2 - 21.05.2012, 02:44
Re: Not moving object - by SnG.Scot_MisCuDI - 21.05.2012, 02:57

Forum Jump:


Users browsing this thread: 2 Guest(s)