#1

Hello i have made a moveing gate and its work fine with command but i want it to open auto when player inside one of this vehicles and it dosnt work

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        if(
IsPlayerInRangeOfPoint(playerid,5.0,-1631.5386,681.5295,7.1901))
        {
          new 
Vehicle;
          
Vehicle GetPlayerVehicleID(playerid);
          if(
Vehicle 427 || 490 || 528 || 596 || 597 ||598 || 599)
          {
            
MoveObject(SFcopDoor,-1631.5688.4000213.1,1,0090);
          }
        }
        else
        {
          
MoveObject(SFcopDoor,-1631.5688.400028.7,1,0090);
        }
    }
    return 
1;

Reply
#2

pawn Код:
Vehicle > 427 || 490 || 528 || 596 || 597 ||598 || 599
Change it to:

pawn Код:
Vehicle == 427 || Vehicle == 490 || Vehicle == 528 || Vehicle == 596 || Vehicle == 597 || Vehicle == 598 || Vehicle == 599
Reply
#3

still dont work
Reply
#4

NOTE: player needs to exit the vehicle in front of the gate and enter the vehicle again to open the gate
,,you will need a timer if you want it automatically opened
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        if(IsPlayerInRangeOfPoint(playerid,5.0,-1631.5386,681.5295,7.1901))
        {
            new Vehicle;
            Vehicle = GetPlayerVehicleID(playerid);
            switch(Vehicle)
            {
                case 427,490,528,596,597,598,599:
                {
                    MoveObject(SFcopDoor,-1631.5, 688.40002, 13.1,1,0, 0, 90);
                }
            }        
        }
        else
        {
          MoveObject(SFcopDoor,-1631.5, 688.40002, 8.7,1,0, 0, 90);
        }
    }
    return 1;
}
with timers
pawn Код:
public OnGameModeEnit()
{
    SetTimer("GateTimer",500,true);
        return 1;
}

forward GateTimer();
public GateTimer()
{
    for(new i;i!=MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(playerid,5.0,-1631.5386,681.5295,7.1901))
            {
                new Vehicle;
                Vehicle = GetPlayerVehicleID(playerid);
                switch(Vehicle)
                {
                    case 427,490,528,596,597,598,599:
                    {
                        MoveObject(SFcopDoor,-1631.5, 688.40002, 13.1,1,0, 0, 90);
                    }
                }        
            }
            else
            {
                MoveObject(SFcopDoor,-1631.5, 688.40002, 8.7,1,0, 0, 90);
            }
        }
       
    }

}
Reply
#5

still dont work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)