[HELP]Auto Gate?
#1

How can i make a gate who automaticly opens when i get close to the gate
Like an hangar (the gate opens when i am getting close to it)

Script (The gate)
pawn Код:
#include <a_samp>

#define FILTERSCRIPT
#define COLOR_GREEN 0x33AA33AA


forward loadobjects();
forward loadvehicles();
forward Resetbase();

new Gate1;

public OnFilterScriptInit()
{
    Gate1 = CreateObject(2933,96.71507263,1920.44409180,17.12633896,0.00000000,270.00000000,90.00000000); //gate(/gate)
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/gate", cmdtext, true) == 0)
    {
        if(IsPlayerAdmin(playerid)==1)
        {
            SendClientMessage(playerid,COLOR_GREEN,"The HQ gate Is now opening!");
            MoveObject(Gate1, 96.715072631836,1920.4440917969,12.12633895874, 2.00);
            SetTimer("Resetbase",5000,0);
            return 1;
        }
    }
    return 0;
}


public Resetbase()
{
    MoveObject(Gate1, 96.715072631836,1920.4440917969,17.12633895874, 2.00);
    }
Reply
#2

First of all you need a timer which checks if someone is near the gate and if someone is near it opens, if noone it closes

Yes you can add a variable to mark the gate as opend / closed to save some MoveObject calls
Reply
#3

u can make to open with command and to close auto...
if u wnat to create totaly automatic gate look at the wiki.
idk the link cause im in school... :/
Reply
#4

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
First of all you need a timer which checks if someone is near the gate and if someone is near it opens, if noone it closes

Yes you can add a variable to mark the gate as opend / closed to save some MoveObject calls
Can you make it to me? I am pretty new at scripting so, i am not so good =/
Reply
#5

Check the wiki -> Automatic_Gates

BUT the last code has a mistake in it, take that one instead

pawn Код:
forward CheckGate();
public CheckGate()
{
    new i;
    for( ; i != MAX_PLAYERS; i++)
        if(IsPlayerInRangeOfPoint(i, 10.0, closed_X, closed_Y, closed_Z))
            break;
    if(i != MAX_PLAYERS) MoveObject(mygate, open_X, open_Y, open_Z, Moving_Speed);
    else MoveObject(mygate, closed_X, closed_Y, closed_Z, Moving_Speed);
}
Reply
#6

hey larsey add me on xfire
its me yvoms from g0dz
i just started scripting also
we meight help each other out
Reply
#7

Quote:
Originally Posted by yvoms
Посмотреть сообщение
hey larsey add me on xfire
its me yvoms from g0dz
i just started scripting also
we meight help each other out
ok, sure , what is your Xfire?
Reply
#8

Yvoms mate
Reply
#9

Quote:
Originally Posted by yvoms
Посмотреть сообщение
Yvoms mate
Xfire dident find you first time xD
Reply
#10

Dude you dont need to make a command if you want to make an automatic gate :O
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)