Multiple gates
#1

I want to have multiple gates that all work under the command /gate
But only work if your close enough to it, and in the group.
heres my script that works perfectly fine for one gate.
Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>

#if defined FILTERSCRIPT

#define ORANGE  0xF97804FF

#endif
enum PLAYERS
{
group
}
new Player[MAX_PLAYERS][PLAYERS];

new Gate;
new bool:OPEN;

public OnFilterScriptInit()
{
    Gate = CreateObject(989,1428.6284, 241.9930, 20.3020,359.2969, 0.7000, 172.9962, 0.0);
    return 1;
}

CMD:gate(playerid,params[])
{
    if(!IsPlayerInRangeOfPoint(playerid,10,1428.6456, 242.0033, 20.3020)) return SendClientMessage(playerid,ORANGE,"You're not close enough to the gate.");//Send error message if player isn't near any gate
    {
    if(Player[playerid][group] == 9)
     {
        if(OPEN == false)
        {
                MoveObject(Gate,1428.6456, 242.0033, 20.3020,4);
                OPEN = true;
        }
        if(OPEN == true)
        {
                MoveObject(Gate,1426.5259, 237.4716, 20.3020,4);
                OPEN = false;
       }
     }
    }
    return 1;
}
And heres my attempt of making a script that works for multiple ones.
Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>

#if defined FILTERSCRIPT

#define ORANGE  0xF97804FF

#endif
enum PLAYERS
{
group
}
new Player[MAX_PLAYERS][PLAYERS];

new Gate[2];
	bool:Open[2 char];

public OnFilterScriptInit()
{
    Gate[0] = CreateObject(989,1428.6284, 241.9930, 20.3020,359.2969, 0.7000, 172.9962, 0.0);
    Gate[1] = CreateObject(989,-1701.4600, 687.8000, 24.7900, 0, 0, 0.0);
    Gate[2] = CreateObject(989,-1572.2261, 658.6411, 7.0000, 0, 0, 0);
    return 1;
}

CMD:gate(playerid,params[])
{
    if(!IsPlayerInRangeOfPoint(playerid,10,1428.6456, 242.0033, 20.3020)) return SendClientMessage(playerid,ORANGE,"You're not close enough to the gate.");//Send error message if player isn't near any gate
    {
    if(Player[playerid][group] == 9)
     {
        if(OPEN == false)
        {
                MoveObject(Gate[0],1428.6456, 242.0033, 20.3020,4);
                OPEN = true;
        }
        if(OPEN == true)
        {
                MoveObject(Gate[0],1426.5259, 237.4716, 20.3020,4);
                OPEN = false;
       }
     }
    }
    return 1;
}
    {
    if(Player[playerid][group] == 1)
     {
        if(OPEN == false)
        {
                MoveObject(Gate[1],-1701.4600, 687.8000, 24.7900,4);
                OPEN = true;
        }
        if(OPEN == true)
        {
                MoveObject(Gate[1],-1701.4441, 687.7974, 24.7900,4);
                OPEN = false;
       }
     }
    }
    return 1;
}
    {
    if(Player[playerid][group] == 1)
     {
        if(OPEN == false)
        {
                MoveObject(Gate[2],-1572.2261, 658.6411, 7.0000,4);
                OPEN = true;
        }
        if(OPEN == true)
        {
                MoveObject(Gate[2],-1572.4937, 657.3914, 7.0000,4);
                OPEN = false;
       }
     }
    }
    return 1;
}
And these are my errors, :3
Код:
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(18) : error 010: invalid function or declaration
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(24) : error 032: array index out of bounds (variable "Gate")
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(34) : error 017: undefined symbol "OPEN"
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(37) : error 017: undefined symbol "OPEN"
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(37) : warning 215: expression has no effect
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(39) : error 017: undefined symbol "OPEN"
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(42) : error 017: undefined symbol "OPEN"
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(42) : warning 215: expression has no effect
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(48) : error 055: start of function body without function header
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(49) : error 010: invalid function or declaration
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(51) : error 010: invalid function or declaration
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(56) : error 010: invalid function or declaration
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(63) : error 010: invalid function or declaration
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(66) : error 010: invalid function or declaration
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(68) : error 010: invalid function or declaration
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(73) : error 010: invalid function or declaration
C:\Users\Josh\Desktop\FCSLRP\gamemodes\Untitled.pwn(80) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


15 Errors.
Thanks in advance.
Reply
#2

new bool:OPEN;
new bool:OPEN2;
and use this

the bool in the command is this
pawn Код:
OPEN
but u have the new as
PHP код:
bool:Open[2 char]; 
Reply
#3

pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>

#if defined FILTERSCRIPT

#define ORANGE  0xF97804FF

#endif
enum PLAYERS
{
group
}
new Player[MAX_PLAYERS][PLAYERS];

new Gate[3];//0 counts as 1
new bool:OPEN1;
new bool:OPEN2;
new bool:OPEN3;

public OnFilterScriptInit()
{
    Gate[0] = CreateObject(989,1428.6284, 241.9930, 20.3020,359.2969, 0.7000, 172.9962, 0.0);
    Gate[1] = CreateObject(989,-1701.4600, 687.8000, 24.7900, 0, 0, 0.0);
    Gate[2] = CreateObject(989,-1572.2261, 658.6411, 7.0000, 0, 0, 0);
    return 1;
}

CMD:gate(playerid,params[])
{
    if(!IsPlayerInRangeOfPoint(playerid,10,1428.6456, 242.0033, 20.3020)) return SendClientMessage(playerid,ORANGE,"You're not close enough to the gate.");//Send error message if player isn't near any gate
    {
    if(Player[playerid][group] == 9)
     {
        if(OPEN1 == false)
        {
                MoveObject(Gate[0],1428.6456, 242.0033, 20.3020,4);
                OPEN1 = true;
        }
        if(OPEN1 == true)
        {
                MoveObject(Gate[0],1426.5259, 237.4716, 20.3020,4);
                OPEN1 = false;
       }
    }
    else if(Player[playerid][group] == 1)
    {
        if(OPEN2 == false)
        {
                MoveObject(Gate[1],-1701.4600, 687.8000, 24.7900,4);
                OPEN2 = true;
        }
        if(OPEN2 == true)
        {
                MoveObject(Gate[1],-1701.4441, 687.7974, 24.7900,4);
                OPEN2 = false;
       }
    }
    else if(Player[playerid][group] == 1)
    {
        if(OPEN3 == false)
        {
                MoveObject(Gate[2],-1572.2261, 658.6411, 7.0000,4);
                OPEN3 = true;
        }
        if(OPEN3 == true)
        {
                MoveObject(Gate[2],-1572.4937, 657.3914, 7.0000,4);
                OPEN3 = false;
       }
    }
    }
    return 1;
}
Reply
#4

That works, but I'm pretty sure that's intended for gates that all basically joined, and men't to work as one.
I want all separate gates but work with the same command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)