SA-MP Forums Archive
Problem with a 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)
+--- Thread: Problem with a gate (/showthread.php?tid=488564)



Problem with a gate - thegamer355 - 18.01.2014

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


Re: Problem with a gate - amirab - 18.01.2014

where did you define it?! :

APlayerData


Re: Problem with a gate - thegamer355 - 19.01.2014

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


Re: Problem with a gate - Sawalha - 19.01.2014

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.


Re: Problem with a gate - thegamer355 - 19.01.2014

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