SA-MP Forums Archive
Automatic Gate Issues - 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: Automatic Gate Issues (/showthread.php?tid=161201)



Automatic Gate Issues - robert4049 - 19.07.2010

Okay i added these gates in.... And there are no Warning/Errors In the Complier Log when the script is compiled. I have plugged in my cordinet but yet when i walk to the gate there is no movement. And also i made sure the Faction i was in was set to type 1.
top of script
Код:
forward LSPDFGateTimer(playerid);//lspd front gate
forward LSPDGGateTimer(playerid);//lspd garage gate
forward LSPDFGateClose();//lspd front gate timer
forward LSPDGGateClose();//lspd garge gate timer
//==================================================
Actual Coding
Код:
public LSPDFGateTimer(playerid)//lspd front entrance autogates
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 35, 1541.4320,-1627.3322,13.3828))
        {
             if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
            {
                MoveObject(LSPDFRONT,1542.3559570313, -1627.8432617188, 10.699661254883, 8.0);
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Please be patient while the gate to this facility is opening.");
                SetTimer("LSPDFGateClose", 1000, 0);
            }
        }
    }
    return 1;
}

public LSPDFGateClose()
{
    MoveObject(LSPDFRONT, 1542.3559570313, -1627.8432617188, 14.099655151367, 8);
    return 1;
}//end of lspd front gate
public LSPDGGateTimer(playerid)//lspd garage
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 35, 1588.0067 , -1636.1232 , 13.3828))
        {
             if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
            {
                MoveObject(LSPDGARAGE, 1592.837890625, -1638.1611328125, 9.7574806213379, 8.0);
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Please be patient while the gate to this facility is opening.");
                SetTimer("LSPDGateClose", 1000, 0);
            }
        }
    }
    return 1;
}

public LSPDGGateClose()
{
    MoveObject(LSPDGARAGE, 1592.837890625, -1638.1611328125, 9.7574806213379, 8.0);
    return 1;
}//end of lspd garage



Re: Automatic Gate Issues - WillyP - 19.07.2010

On the playerid, you shouldnt have 35 behind it


Re: Automatic Gate Issues - robert4049 - 19.07.2010

thats the distance i thought?


Re: Automatic Gate Issues - Agent Smith - 19.07.2010

Also your running the timmer at 1 second?
pawn Код:
SetTimer("LSPDGateClose", 1000, 0);
Need to change it to something like 10000 - 10 seconds


Re: Automatic Gate Issues - robert4049 - 19.07.2010

when i remove the 35 i get this
Код:
C:\Users\Robert\Desktop\SA-MP\gamemodes\skrp.pwn(1725) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\SA-MP\gamemodes\skrp.pwn(1747) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase



Re: Automatic Gate Issues - WillyP - 19.07.2010

On the playerid, you shouldnt have 35 behind it


Re: Automatic Gate Issues - robert4049 - 19.07.2010

my current code
Код:
public LSPDFGateTimer(playerid)//lspd front entrance autogates
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 1541.4320,-1627.3322,13.3828))
        {
             if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
            {
                MoveObject(LSPDFRONT,1542.3559570313, -1627.8432617188, 10.699661254883, 8.0);
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Please be patient while the gate to this facility is opening.");
                SetTimer("LSPDFGateClose",10000, 0);
            }
        }
    }
    return 1;
}

public LSPDFGateClose()
{
    MoveObject(LSPDFRONT, 1542.3559570313, -1627.8432617188, 14.099655151367, 8);
    return 1;
}//end of lspd front gate
public LSPDGGateTimer(playerid)//lspd garage
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 1588.0067 , -1636.1232 , 13.3828))
        {
             if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
            {
                MoveObject(LSPDGARAGE, 1592.837890625, -1638.1611328125, 9.7574806213379, 8.0);
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Please be patient while the gate to this facility is opening.");
                SetTimer("LSPDGateClose",10000, 0);
            }
        }
    }
    return 1;
}

public LSPDGGateClose()
{
    MoveObject(LSPDGARAGE, 1592.837890625, -1638.1611328125, 9.7574806213379, 8.0);
    return 1;
}//end of lspd garage
errors
Код:
C:\Users\Robert\Desktop\SA-MP\gamemodes\skrp.pwn(1725) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\SA-MP\gamemodes\skrp.pwn(1747) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:           6480 bytes
Code size:           563536 bytes
Data size:          1373624 bytes
Stack/heap size:      16384 bytes; estimated max. usage=4086 cells (16344 bytes)
Total requirements: 1960024 bytes



Re: Automatic Gate Issues - Agent Smith - 19.07.2010

Quote:
Originally Posted by Lolrofl
Посмотреть сообщение
On the playerid, you shouldnt have 35 behind it
If you have looked at IsPlayerInRangeOfPoint you will notice he is correct with what he is doing

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint

pawn Код:
if(!strcmp("/stadium",cmdtext))
{
    if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438))
    {
        SendClientMessage(playerid,0xFFFFFFFF,"You are near the Stadium entrance!");
    }
    return 1;
}



Re: Automatic Gate Issues - ikey07 - 19.07.2010

That 35 must be^^


btw, check if objects ids matches, do you have LSPDFRONT = CreateObject(..... ?

and btw, your open and close coords is the same so maybe there is problem?


Re: Automatic Gate Issues - robert4049 - 19.07.2010

Код:
    LSPDFRONT = CreateObject(7657, 1542.3559570313, -1627.8432617188, 14.099655151367, 0, 0, 269.39495849609);
    LSPDGARAGE = CreateObject(10184, 1592.837890625, -1638.1611328125, 15.007468223572, 0, 0, 89.310028076172);