SA-MP Forums Archive
how to MAke this auto gate on command - 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: how to MAke this auto gate on command (/showthread.php?tid=249904)



how to MAke this auto gate on command - peterRook - 21.04.2011

So i have this code i got from a tutorial the gate works fine but i want it so that it only opens if i use a certain cmd

code i have so far -
Quote:

#include <a_samp>
forward GateCheck();
new AutomaticGate;

public OnGameModeInit()
{
SetTimer("GateCheck", 1000, true);
AutomaticGate = CreateObject(186, -766.9352, 92.1028, 192.3989, 0, 0, 0);
return 1;
}
public GateCheck()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 10.0, -766.9352, 92.1028, 192.3989))
{
MoveObject(AutomaticGate, -766.9352, 92.1028, 192.3989, 5.0);
}
else
{
MoveObject(AutomaticGate, -766.9352, 92.1028, 202.3989, 5.0);
}
}
}
}




Re: how to MAke this auto gate on command - Kitten - 21.04.2011

pawn Код:
if (strcmp("/MoveGatePlease", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(i, 10.0, -766.9352, 92.1028, 192.3989))
        {
            MoveObject(AutomaticGate, -766.9352, 92.1028, 192.3989, 5.0);
        }
        return 1;
    }



Re: how to MAke this auto gate on command - peterRook - 21.04.2011

does that auto close aswell?


Re: how to MAke this auto gate on command - Max_Coldheart - 21.04.2011

Nope, you have to set a time for that.