SA-MP Forums Archive
[HELP]Automatic Gates! - 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)
+--- Thread: [HELP]Automatic Gates! (/showthread.php?tid=315100)



[HELP]Automatic Gates! - Scofield62 - 01.02.2012

Hi guys i need some help! I've got a script about automatic gate! And it works but not fine!

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

The Problem: When only me in the server it works fine, but someone came in , only the player who has id:1 and bigger id-s work and for id:0 doesn't work.

So if the server has xy players everyone work the gates except ID:0 player:S:S
What is the problem?:S

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#include <foreach>
#include <zcmd>
#pragma tabsize 0


forward CheckGate();
new Gate1;
new Gate2;


public OnFilterScriptInit()
{
    SetTimer("CheckGate", 1000, true);
    CreateObject(966, 1328.35, -1385.73, 12.53, 0.0, 0.0, 0.0); // Gate1 talp
    Gate1 = CreateObject(968, 1328.33, -1385.72, 13.25, 0.0, -90.0, 0.0);
    CreateObject(966, 1722.78, 1611.90, 9.10, 0.00, 0.00, 70.20);
    Gate2 = CreateObject(968, 1722.76, 1611.90, 9.88, 0.00, -90.00, 70.25);
    print("\n--------------------------------------");
    print(" Gates! ");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public CheckGate()
{
foreach(Player, i)
{
            if(IsPlayerInRangeOfPoint(i, 5.00, 1325.0199,-1387.8572,13.6263))
            {
                if(IsPlayerInAnyVehicle(i))
                {
                    MoveObject(Gate1, 1328.33, -1385.72, 13.25+0.0001, 0.0001, 0.0, 0.0, 0.0); //Nyilik
                }
                else
                {
                    SendClientMessage(i, 0x00FF00AA, "You are not in any vehicle.");
                }
            }
            else
            {
                MoveObject(Gate1, 1328.33, -1385.72, 13.25, 0.0001, 0.0, -90.0, 0.0); // Csukodik
            }

            if(IsPlayerInRangeOfPoint(i, 5.00, 1727.40, 1608.18, 8.91))
            {
                if(IsPlayerInAnyVehicle(i))
                {
                    MoveObject(Gate2, 1722.76, 1611.90, 9.88+0.0001, 0.0001, 0.00, 0.00, 70.25); //Nyilik
                }
                else
                {
                    SendClientMessage(i, 0x00FF00AA, "You are not in any vehicle.");
                }
            }
            else
            {
                MoveObject(Gate2, 1722.76, 1611.90, 9.88, 0.0001, 0.00, -90.00, 70.25); // Csukodik
            }
    }
    return 1;
}



Re: [HELP]Automatic Gates! - geerdinho8 - 01.02.2012

pawn Код:
public CheckGate()
{
    for(new i, m = GetMaxPlayers(); i < m; i++)
    {
            if (IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 5.00, 1325.0199,-1387.8572,13.6263))
            {
                if(IsPlayerInAnyVehicle(i))
                {
                    MoveObject(Gate1, 1328.33, -1385.72, 13.25+0.0001, 0.0001, 0.0, 0.0, 0.0); //Nyilik
                }
                else
                {
                    SendClientMessage(i, 0x00FF00AA, "You are not in any vehicle.");
                }
            }
            else
            {
                MoveObject(Gate1, 1328.33, -1385.72, 13.25, 0.0001, 0.0, -90.0, 0.0); // Csukodik
            }

            if(IsPlayerInRangeOfPoint(i, 5.00, 1727.40, 1608.18, 8.91))
            {
                if(IsPlayerInAnyVehicle(i))
                {
                    MoveObject(Gate2, 1722.76, 1611.90, 9.88+0.0001, 0.0001, 0.00, 0.00, 70.25); //Nyilik
                }
                else
                {
                    SendClientMessage(i, 0x00FF00AA, "You are not in any vehicle.");
                }
            }
            else
            {
                MoveObject(Gate2, 1722.76, 1611.90, 9.88, 0.0001, 0.00, -90.00, 70.25); // Csukodik
            }
    }
            }
    }

    return 1;
}
Untested.


Re: [HELP]Automatic Gates! - Scofield62 - 01.02.2012

It isn't work i Tested it.


Re: [HELP]Automatic Gates! - milanosie - 01.02.2012

https://sampforum.blast.hk/showthread.php?tid=289299

make gates with a few clicks!


Re: [HELP]Automatic Gates! - Scofield62 - 01.02.2012

with that doesn't work XD Nothing happened with the gate...