Making a gate for a certain username only?
#7

Actually, now that I think about it, dynamic areas might not work with regular objects. Change CreateObject to CreateDynamicObject.

EDIT:
pawn Код:
new GateArea, GateObject, bool:GateOpen;
//Place these at the top of your script, these are global variables.

public OnGameModeInit() //Or OnFilterScriptInit() if you're using a filterscript
{
    GateOpen = false;
    GateObject = CreateDynamicObject(980, 2061.5, 2437.5, 11.1, 0.0, 0.0, 0.0); //Create closed gate.
    GateArea = CreateDynamicCircle(2061.5, 2437.5, 5.0); //Create area.
    AttachDynamicAreaToObject(GateArea, GateObject); //Attach area to gate.
    return 1;
}

public OnPlayerEnterDynamicArea(playerid, areaid)
{
    if(areaid == GateArea)
    {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, 2061.5000000, 2437.5000000, 11.1000000))
        {
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            if(strcmp(name, "coolmark1995", false) != 0) return 1;
            //Replace 'coolmark1995' with your own name.
            //NOTE: You must include capital letters. It must be EXACT.
            if(!GateOpen)
            {
                MoveObject(GateObject, 2061.5, 2437.5, 7.1, 2, 0.0, 0.0, 0.0);
                GateOpen = true;
            }
        }
    }
    return 1;
}

public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    if(areaid == GateArea)
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        if(strcmp(name, "coolmark1995", false) != 0) return 1;
        if(GateOpen)
        {
            MoveObject(GateObject, 2061.5, 2437.5, 11.1, 2, 0.0, 0.0, 0.0);
            GateOpen = false;
        }
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)