SA-MP Forums Archive
[HELP]Auto Gate? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]Auto Gate? (/showthread.php?tid=190837)



[HELP]Auto Gate? - Larsey123IsMe - 16.11.2010

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);
    }



Re: [HELP]Auto Gate? - Nero_3D - 16.11.2010

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


Re: [HELP]Auto Gate? - Rafa - 17.11.2010

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... :/


Re: [HELP]Auto Gate? - Larsey123IsMe - 17.11.2010

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 =/


Re: [HELP]Auto Gate? - Nero_3D - 17.11.2010

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);
}



Re: [HELP]Auto Gate? - yvoms - 17.11.2010

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


Re: [HELP]Auto Gate? - Larsey123IsMe - 17.11.2010

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?


Re: [HELP]Auto Gate? - yvoms - 17.11.2010

Yvoms mate


Re: [HELP]Auto Gate? - Larsey123IsMe - 17.11.2010

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


Re: [HELP]Auto Gate? - yvoms - 18.12.2010

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