Problem with a gate
#1

Hi all

i have a problem with my script
i made a gate script only for admins
i get these errors
Код:
D:\games\gta trucking server\filterscripts\gate1.pwn(20) : error 017: undefined symbol "APlayerData"
D:\games\gta trucking server\filterscripts\gate1.pwn(20) : warning 215: expression has no effect
D:\games\gta trucking server\filterscripts\gate1.pwn(20) : error 001: expected token: ";", but found "]"
D:\games\gta trucking server\filterscripts\gate1.pwn(20) : error 029: invalid expression, assumed zero
D:\games\gta trucking server\filterscripts\gate1.pwn(20) : fatal error 107: too many error messages on one line

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


4 Errors.
I am using this script:
Код:
#define FILTERSCRIPT


#include <a_samp>

new adminarea;

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Gate1 loaded							");
	print("--------------------------------------\n");
	//*ADMIN GATE*//
	adminarea = CreateObject(19278,268.7369, 1884.0020, -33.0162,0.00000000,0.00000000,000.00000000);

	return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (APlayerData[playerid][PlayerLevel] >= 1)
	if(!strcmp(cmdtext, "/close", true, 14))
	{
  	MoveObject(adminarea, 268.7369, 1884.0020, -33.0162, 3.0);
   	SendClientMessage(playerid, 0xEF994300, "The gate has been closed.");
   	return 1;
	}
    if (APlayerData[playerid][PlayerLevel] >= 1)
	if(!strcmp(cmdtext, "/open", true, 16))
	{
    MoveObject(adminarea, 268.7369, 1884.0020, -80.9320, 3.0);
    SendClientMessage(playerid, 0xEF994300, "The gate has been opened.");
	return 1;
	}
	return 0;
}
the code has to be in a Filterscript
Reply
#2

where did you define it?! :

APlayerData
Reply
#3

i don't know where to define it
i heard something about a enum but i don't understand that
Reply
#4

Mate, to define a Playerdata you will use the enum, Read here: https://sampwiki.blast.hk/wiki/Keywords:Initialisers, it's used to make a group of somethings.
now,
do:
pawn Код:
enum PData
{
     PlayerLevel,
     //etc of player info you like to add
}
now under it:
pawn Код:
new APlayerData[MAX_PLAYERS][PData]; // here we made first the APlayerData and it's arrays, MAX_PLAYERS are all players you limited in your server, PData is the group that contains the player's information
I guess the errors will stop.
Reply
#5

the errors are fixed but the gate isn't opening now
it says unknown command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)