Making a gate for a certain username only?
#5

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
pawn Код:
#include <a_samp>
#include <streamer>

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 = CreateObject(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;
}
NOTE: You need the 'streamer' plugin and include for this code. Download it by clicking HERE.
the gate dosent open I am not sure why
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)