Gate opening for more ppl
#1

Hey all i have a code for a automatic gate with isplayerinrange
but it is little bit weird xD
because if i am the only one in my server and i wwalk to the gate it opens but when another friend/guy comes ingame i cant open it any more but the other guy can open it thats really weird because whe want it opens for all of us this is my script.:.:
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT
new gate; // use it on the top of the script!!
new gate1;
#define ORANGE 0xFF9900AA
forward GateCheck();
forward GateCheck1();
public OnFilterScriptInit()
{
    SetTimer("GateCheck", 500, true);
    SetTimer("GateCheck1", 500, true);
	gate = CreateObject(980, 1792.6700439453, -1284.7282714844, 15.406204223633, 0, 0, 0); //GATE!
	CreateObject(987, 1798.8885498047, -1296.3529052734, 12.544774055481, 0, 0, 94);
	CreateObject(987, 1776.6673583984, -1290.5843505859, 12.6328125, 0, 0, 271.9990234375);
	CreateObject(987, 1787.1528320313, -1284.6828613281, 12.752249717712, 0, 0, 209.99401855469);
	CreateObject(638, 1770.9407958984, -1302.5523681641, 49.126628875732, 0, 0, 180);
	CreateObject(16151, 1817.3671875, -1294.1584472656, 48.787979125977, 0, 0, 0);
	CreateObject(1978, 1826.3927001953, -1271.7930908203, 49.445430755615, 0, 0, 0);
	CreateObject(2188, 1825.5853271484, -1291.2224121094, 49.374271392822, 0, 0, 92);
	CreateObject(2785, 1824.7265625, -1298.9467773438, 49.250728607178, 0, 0, 88);
	CreateObject(2773, 1824.6099853516, -1289.9552001953, 48.946002960205, 0, 0, 88.25);
	CreateObject(2773, 1824.6708984375, -1292.3682861328, 48.943355560303, 0, 0, 88.247680664063);
	CreateObject(3881, 1800.3692626953, -1281.5466308594, 14.48787689209, 0, 0, 0);
	gate1 = CreateObject(980, 1788.2348632813, -1298.3057861328, 14.098407745361, 0, 0, 0); //GATE2!
	CreateObject(987, 1805.8101806641, -1298.9328613281, 12.355841636658, 0, 0, 178);
	CreateObject(987, 1782.4714355469, -1298.142578125, 12.375, 0, 0, 177.99499511719);
	
	//lol
	CreateObject(14513, 2458.998046875, -1666.8685302734, 30.669139862061, 0, 320, 178);
	CreateObject(13666, 2469.2578125, -1667.2280273438, 74.111305236816, 0, 0, 0);
	CreateObject(13666, 2469.26171875, -1667.2307128906, 121.10928344727, 0, 0, 0);
	CreateObject(14513, 2480.2082519531, -1667.2335205078, 163.91586303711, 0, 42, 0);
	CreateObject(13666, 2523.9389648438, -1667.2490234375, 178.71940612793, 0, 86.249969482422, 0);
	CreateObject(13666, 2418.5717773438, -1666.3181152344, 17.412803649902, 0, 90, 0);
	CreateObject(1634, 2391.2028808594, -1666.3409423828, 13.844192504883, 0, 0, 88);


	
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}



public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	return 0;
}

public GateCheck()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 10.0, 1792.6700439453, -1284.7282714844, 15.406204223633))//Range Of Closed One
            {
                MoveObject(gate,1792.6700439453, -1284.7282714844, 8.7312259674072, 3.0);//Opened
            }
            else
            {
                MoveObject(gate, 1792.6700439453, -1284.7282714844, 15.406204223633, 3.0);//Closed
            }
        }
    }
}
public GateCheck1()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 10.0, 1788.2348632813, -1298.3057861328, 14.098407745361))//Range Of Closed One
            {
                MoveObject(gate1,1799.7746582031, -1298.7623291016, 14.098407745361, 3.0);//Opened
            }
            else
            {
                MoveObject(gate1,1788.2348632813, -1298.3057861328, 14.098407745361, 3.0);//Closed
            }
        }
    }
}
#endif
someone sees the problem?
if yes thank you!

-luckie12
Reply
#2

I would add a variable for when the gate is open and closed.
Reply
#3

example?
Reply
#4

pawn Код:
public GateCheck()
{
    new InRange;
    for(new i=0; i<MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
            if(IsPlayerInRangeOfPoint(i, 10.0, 1792.6700439453, -1284.7282714844, 15.406204223633))InRange = 1; //Range Of Closed One
        }
    }
    if(InRange)MoveObject(gate, 1792.6700439453, -1284.7282714844, 8.7312259674072, 3.0); //Opened
    else MoveObject(gate, 1792.6700439453, -1284.7282714844, 15.406204223633, 3.0); //Closed
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)