I lost all the day in trying to make a gate. Help me, please?!?
#3

pawn Код:
new Gate;
new bool:IsGateOpen;
public OnGameModeInit() //or OnFilterScriptInit
{
    Gate = CreateObject(...); //Here's your gate object
    SetTimer("GateOpen", 1000, true); //Start the player check
    return 1;
}

forward GateOpen();
public GateOpen()
{
    for(new i = 0; i < MAX_PLAYERS; i++) //Start a loop
    {
        if(IsPlayerConnected(i)) //If player is online
        {
            if(IsPlayerACop(playerid) == true) //CHANGE THIS LINE!!! **************
            {
            if(IsPlayerInRangeOfPoint(i, ....) //If they are near the point
            {
                if(IsGateOpen == false)
                {
                MoveObject(Gate, ....); //Open Position
                IsGateOpen = true;
                } }
                else
                {
                if(IsGateOpen == true) {
                MoveObject(Gate,....); //Back to closed position
                IsGateOpen = false; } }
                }
        }
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)