how to MAke this auto gate on command
#1

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

Reply
#2

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;
    }
Reply
#3

does that auto close aswell?
Reply
#4

Nope, you have to set a time for that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)