[Help] Automatic Gate
#1

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
Reply
#2

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

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.
Reply
#4

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.
Reply
#5

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
Reply
#6

sorry for double topic, but i up my topic...xD
Reply
#7

re: up..
help me please..
Reply
#8

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

OMG.... JonyBoy gave you the code already!
Reply
#10

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..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)