Moving gate error
#1

So my command was working perfectly, But i wanted to add it so only group 9 could use the command, Because it was for that groups faction, I'm only a beginner scripter, And i couldn't really find anything that'd help me, so I attempted it on my own.
Heres the code i made
Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>

#if defined FILTERSCRIPT

#define ORANGE 	0xF97804FF

#endif

new Gate,
    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)) && (Player[playerid][group] == 9)
    {
        switch(Open)//Check whether the gate opened or closed
        {
            case true://If the gate opened
            {
                MoveObject(Gate,1428.6456, 242.0033, 20.3020,4);//Close the gate
                Open = false;//false for closed
            }
            case false://If the gate closed
            {
                MoveObject(Gate,1426.5259, 237.4716, 20.3020,4);//Open the gate
                Open = true;//true for opened
            }
        }
        return 1;
    }
    SendClientMessage(playerid,ORANGE,"You're not close enough to the gate.");//Send error message if player isn't near any gate
    return 1;
}
It worked perfectly until i added this into it
Код:
&& (Player[playerid][group] == 9)
My errors are
Код:
C:\Users\Josh\Desktop\FCSLRP\filterscripts\MovingGates.pwn(23) : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\FCSLRP\filterscripts\MovingGates.pwn(23) : error 017: undefined symbol "Player"
C:\Users\Josh\Desktop\FCSLRP\filterscripts\MovingGates.pwn(23) : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\FCSLRP\filterscripts\MovingGates.pwn(23) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
if someone could fix the code for me, that'd be great.
Usually if i want a command to only be usable by one group, it'd be something like this.
Код:
	    if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
Thats for a cuff command, Command types 1 and 4 are the leo command ranks.
Thanks in advance if somone could help, Will be repping.
Reply
#2

I tried
Код:
if(IsPlayerInRangeOfPoint(playerid,10,1428.6456, 242.0033, 20.3020)) || (Player[playerid][group] == 9)
too.
Reply
#3

try
this
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,10,1428.6456, 242.0033, 20.3020)  && Player[playerid][group] == 9)
{
there was a doubling of brackets

Add:
broo if(.....) has only two brackets you had two brackets one for isplayerinrange and second for player[playerid]
Reply
#4

Do you have the enum of it? It could also happen if you don't.
pawn Код:
enum pData
{
 group
};
new Player[MAX_PLAYERS][pData];
Reply
#5

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
Do you have the enum of it? It could also happen if you don't.
pawn Код:
enum pData
{
 group
};
new Player[MAX_PLAYERS][pData];
Agreed
Check That too =.=
Reply
#6

Try changing

pawn Код:
&& (Player[playerid][group] == 9)
To:

pawn Код:
&& (PlayerInfo[playerid][group] == 9)
Reply
#7

simple
pawn Код:
//problem solved
  if(IsPlayerInRangeOfPoint(playerid,10,1428.6456, 242.0033, 20.3020 && Player[playerid][group] == 9)
Reply
#8

Added the enum and got
Код:
C:\Users\Josh\Desktop\FCSLRP\filterscripts\MovingGates.pwn(29) : warning 213: tag mismatch
C:\Users\Josh\Desktop\FCSLRP\filterscripts\MovingGates.pwn(30) : error 001: expected token: ")", but found "{"
C:\Users\Josh\Desktop\FCSLRP\filterscripts\MovingGates.pwn(46) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#9

Just a space was miss here
pawn Код:
enum pData
{
    group
};
new Player[MAX_PLAYERS][pData];
Reply
#10

Still get the error
Код:
C:\Users\Josh\Desktop\FCSLRP\filterscripts\MovingGates.pwn(30) : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\FCSLRP\filterscripts\MovingGates.pwn(46) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)