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



[Help] Automatic Gate - Sodierlow - 24.11.2010

hello guys,
I have a problem with my automatic gate system.

I'm supposed to open the gate to a particular player, but is open exclusively to me ..
pawn Code:
new barrackgate;
new portarogate1;
//new portarogate2;
public OnGameModeInit()
{
    SetTimer("BaracchiGate",1000,true); //setto il timer per il cancello di barrack
    SetTimer("PortaroGate",1000,true); //setto il timer per il cancello di portaro
    barrackgate = CreateObject(976, -225.27685546875, 2614.13671875, 61.708999633789, 0, 0, 0, 500);
     //CreateObject(976, -225.27685546875, 2614.13671875, 57.709098815918, 0, 0, 0, 500);
    portarogate1 = CreateObject(976, 997.58355712891, 1687.7630615234, 5.921875, 0, 0, 270);
    //CreateObject(976, 997.58355712891, 1687.7630615234, 10.199999809265, 0, 0, 270);
}

forward BaracchiGate(playerid);
public BaracchiGate(playerid)
{
    new barrackgate_status;
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    for(new Mauro_Baracchi; Mauro_Baracchi<MAX_PLAYER_NAME; Mauro_Baracchi++)
    {
        if(!IsPlayerConnected(Mauro_Baracchi)) continue;
        if(IsPlayerInRangeOfPoint(playerid, 10.0, -225.27685546875, 2614.13671875, 61.708999633789))barrackgate_status=1;
    }
    if(barrackgate_status)MoveObject(barrackgate,-225.27685546875, 2614.13671875, 57.709098815918, 2);
    else MoveObject(barrackgate, -225.27685546875, 2614.13671875, 61.708999633789, 2);

}

forward PortaroGate(playerid);
public PortaroGate(playerid)
{
    new portarogate_status;
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    for(new Andrea_Portaro; Andrea_Portaro<MAX_PLAYER_NAME; Andrea_Portaro++)
    {
        if(!IsPlayerConnected(Andrea_Portaro)) continue;
        if(IsPlayerInRangeOfPoint(playerid, 10.0, 997.58355712891, 1687.7630615234, 10.199999809265))portarogate_status=1;
    }
    if(portarogate_status)MoveObject(portarogate1, 997.58355712891, 1687.7630615234, 5.921875, 2);
    else MoveObject(portarogate1, 997.58355712891, 1687.7630615234, 10.199999809265, 2);
}
Mauro_Baracchi & Andrea_Portaro are the players who should open their gates


P.S. Sorry for my bad english


Help Me..Please


Re: [Help] Automatic Gate - jonnyboy - 24.11.2010

Quote:
Originally Posted by Sodierlow
View Post
hello guys,
I have a problem with my automatic gate system.

I'm supposed to open the gate to a particular player, but is open exclusively to me ..
pawn Code:
new barrackgate;
new portarogate1;
//new portarogate2;
public OnGameModeInit()
{
    SetTimer("BaracchiGate",1000,true); //setto il timer per il cancello di barrack
    SetTimer("PortaroGate",1000,true); //setto il timer per il cancello di portaro
    barrackgate = CreateObject(976, -225.27685546875, 2614.13671875, 61.708999633789, 0, 0, 0, 500);
     //CreateObject(976, -225.27685546875, 2614.13671875, 57.709098815918, 0, 0, 0, 500);
    portarogate1 = CreateObject(976, 997.58355712891, 1687.7630615234, 5.921875, 0, 0, 270);
    //CreateObject(976, 997.58355712891, 1687.7630615234, 10.199999809265, 0, 0, 270);
}

forward BaracchiGate(playerid);
public BaracchiGate(playerid)
{
    new barrackgate_status;
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    for(new Mauro_Baracchi; Mauro_Baracchi<MAX_PLAYER_NAME; Mauro_Baracchi++)
    {
        if(!IsPlayerConnected(Mauro_Baracchi)) continue;
        if(IsPlayerInRangeOfPoint(playerid, 10.0, -225.27685546875, 2614.13671875, 61.708999633789))barrackgate_status=1;
    }
    if(barrackgate_status)MoveObject(barrackgate,-225.27685546875, 2614.13671875, 57.709098815918, 2);
    else MoveObject(barrackgate, -225.27685546875, 2614.13671875, 61.708999633789, 2);

}

forward PortaroGate(playerid);
public PortaroGate(playerid)
{
    new portarogate_status;
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    for(new Andrea_Portaro; Andrea_Portaro<MAX_PLAYER_NAME; Andrea_Portaro++)
    {
        if(!IsPlayerConnected(Andrea_Portaro)) continue;
        if(IsPlayerInRangeOfPoint(playerid, 10.0, 997.58355712891, 1687.7630615234, 10.199999809265))portarogate_status=1;
    }
    if(portarogate_status)MoveObject(portarogate1, 997.58355712891, 1687.7630615234, 5.921875, 2);
    else MoveObject(portarogate1, 997.58355712891, 1687.7630615234, 10.199999809265, 2);
}
Mauro_Baracchi & Andrea_Portaro are the players who should open their gates


P.S. Sorry for my bad english


Help Me..Please
i know how to make auto gates ^^ and u did everything wrong

can make an re-code for this


Re: [Help] Automatic Gate - jonnyboy - 24.11.2010

this will help
pawn Code:
/*==============================================================================
*                             MADE BY JONNYBOY                                 =
*THIS SCRIPT IS FOR THOSE THAT NEED HELP WITH AUTO GATES!  DON'T REMOVE CREDITS!=
*=============================================================================*/

/*
TIP: YOU NEED TO CHANGE SOME STUFF! like where it should go! "0,0,0"
*/

#define FILTERSCRIPT
#define COLOR_YELLOW 0xFFFF00AA

#include <a_samp>
new portarogate1;
new barrackgate;
#if defined FILTERSCRIPT

forward close();

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" AutoGates");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" ITS A FILTERSCRIPT");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
     barrackgate = CreateObject(976,-225.27685546875,2614.13671875,61.708999633789,0,0,0, 500);
     portarogate1 = CreateObject(976,997.58355712891,1687.7630615234,5.921875,0,0, 270);
     return 1;
}

public close()
{
    MoveObject(barrackgate,-225.27685546875,2614.13671875,61.708999633789, 3.00);
    MoveObject(portarogate1,997.58355712891,1687.7630615234,5.921875, 3.00);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/PG1", cmdtext, true, 10) == 0)
    {
    MoveObject(portarogate1,0,0,0, 2.00);
    SetTimer("close", 7000, 0);//Changeme
    SendClientMessage(playerid,COLOR_YELLOW,"Changeme");
    return 1;
    }
   
    if (strcmp("/BG", cmdtext, true, 10) == 0)
    {
    MoveObject(barrackgate,0,0,0, 2.00);
    SetTimer("close", 7000, 0);//Changeme
    SendClientMessage(playerid,COLOR_YELLOW,"Changeme");
    return 1;
    }

    return 0;
}
WARNING
DON'T CHANGE THE CREDITS!
change stuff that you want it.


Re: [Help] Automatic Gate - Nushi - 24.11.2010

Do not use your Mauro_Baracchi as "playerid", otherwise only you will be allowed to open it.
If you want specific people to open the gate, then you will have to set up an array and group the users allowed in the code block. If you want all, leave "playerid" alone.
if(!IsPlayerConnected(Mauro_Baracchi)) continue;//For Mauro_Baracchi.

if(!IsPlayerConnected(playerid)) continue;//For everyone.


Re: [Help] Automatic Gate - Sodierlow - 25.11.2010

The code should be so?
pawn Code:
forward BaracchiGate(playerid);
public BaracchiGate(playerid)
{
    new barrackgate_status;
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    for(new Mauro_Baracchi; Mauro_Baracchi<MAX_PLAYER_NAME; Mauro_Baracchi++)
    {
        if(!IsPlayerConnected(Mauro_Baracchi)) continue;
        if(IsPlayerInRangeOfPoint(Mauro_Baracchi, 10.0, -225.27685546875, 2614.13671875, 61.708999633789))barrackgate_status=1;
    }
    if(barrackgate_status)MoveObject(barrackgate,-225.27685546875, 2614.13671875, 57.709098815918, 2);
    else MoveObject(barrackgate, -225.27685546875, 2614.13671875, 61.708999633789, 2);

}
or am I wrong?
help me please


Re: [Help] Automatic Gate - Sodierlow - 26.11.2010

sorry for double topic, but i up my topic...xD


Re: [Help] Automatic Gate - Sodierlow - 26.11.2010

re: up..
help me please..


Re: [Help] Automatic Gate - Darien - 31.01.2011

D:\SERVER~3\FILTER~1\miestas.pwn(897) : error 024: "break" or "continue" is out of context


Re: [Help] Automatic Gate - ricardo178 - 31.01.2011

OMG.... JonyBoy gave you the code already!


Re: [Help] Automatic Gate - Lorrden - 31.01.2011

Quote:
Originally Posted by jonnyboy
View Post
this will help
pawn Code:
/*==============================================================================
*                             MADE BY JONNYBOY                                 =
*THIS SCRIPT IS FOR THOSE THAT NEED HELP WITH AUTO GATES!  DON'T REMOVE CREDITS!=
*=============================================================================*/

/*
TIP: YOU NEED TO CHANGE SOME STUFF! like where it should go! "0,0,0"
*/

#define FILTERSCRIPT
#define COLOR_YELLOW 0xFFFF00AA

#include <a_samp>
new portarogate1;
new barrackgate;
#if defined FILTERSCRIPT

forward close();

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" AutoGates");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" ITS A FILTERSCRIPT");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
     barrackgate = CreateObject(976,-225.27685546875,2614.13671875,61.708999633789,0,0,0, 500);
     portarogate1 = CreateObject(976,997.58355712891,1687.7630615234,5.921875,0,0, 270);
     return 1;
}

public close()
{
    MoveObject(barrackgate,-225.27685546875,2614.13671875,61.708999633789, 3.00);
    MoveObject(portarogate1,997.58355712891,1687.7630615234,5.921875, 3.00);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/PG1", cmdtext, true, 10) == 0)
    {
    MoveObject(portarogate1,0,0,0, 2.00);
    SetTimer("close", 7000, 0);//Changeme
    SendClientMessage(playerid,COLOR_YELLOW,"Changeme");
    return 1;
    }
   
    if (strcmp("/BG", cmdtext, true, 10) == 0)
    {
    MoveObject(barrackgate,0,0,0, 2.00);
    SetTimer("close", 7000, 0);//Changeme
    SendClientMessage(playerid,COLOR_YELLOW,"Changeme");
    return 1;
    }

    return 0;
}
WARNING
DON'T CHANGE THE CREDITS!
change stuff that you want it.
Somehow... Adding objects @ OnGameModeInit doesn't seem like it should work?
But I don't know, I havn't been working with FS's alot...

Just to make sure you don't give the guy bad information..