SA-MP Forums Archive
What's wrong with this line? - 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: What's wrong with this line? (/showthread.php?tid=531684)



What's wrong with this line? - Gogorakis - 14.08.2014

LINE:
Код:
	  if(!IsPlayerAdmin(playerid)||PlayerInfo[playerid][AdminLevel]<5)return SendClientMessage(playerid,0xFF0000FF,"You're not authorized to use that command");

ERRORS:
Quote:

C:\Users\Administrator\Desktop\KITTENTEST\gamemode s\greekfr.pwn(639) : error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo"
C:\Users\Administrator\Desktop\KITTENTEST\gamemode s\greekfr.pwn(639) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\KITTENTEST\gamemode s\greekfr.pwn(639) : error 001: expected token: ";", but found "]"
C:\Users\Administrator\Desktop\KITTENTEST\gamemode s\greekfr.pwn(639) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\KITTENTEST\gamemode s\greekfr.pwn(639) : fatal error 107: too many error messages on one line

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


4 Errors.

ENUM PLAYERINFO
Quote:

enum PlayerInfo
{
Pass[129], //User's password
Adminlevel, //User's admin level
VIPlevel, //User's vip level
Money, //User's money
Scores, //User's scores
Kills, //User's kills
Deaths //User's deaths
}
new pInfo[MAX_PLAYERS][PlayerInfo]; /*This will create a new variable so we can later use it to saving/loading user's info.*/




Re: What's wrong with this line? - Jefff - 14.08.2014

pInfo not PlayerInfo here PlayerInfo[playerid][AdminLevel] xD


Re: What's wrong with this line? - Pottus - 14.08.2014

new pInfo[MAX_PLAYERS][PlayerInfo]; you have, PlayerInfo[playerid][AdminLevel]<5

I would recommend doing this instead.

pawn Код:
#define CMDLEVEL(%0) if(!IsPlayerAdmin(playerid)|| pInfo[playerid][AdminLevel]< %0) return SendClientMessage(playerid,0xFF0000FF,"You're not authorized to use that command");
Then all you need to do is write, CMDLEVEL(5); much easier when you have a lot of commands.


Re: What's wrong with this line? - Gogorakis - 14.08.2014

Thank you!! Fixed..but..
Quote:

C:\Users\Administrator\Desktop\KITTENTEST\gamemode s\greekfr.pwn(641) : error 017: undefined symbol "AdminLevel"
C:\Users\Administrator\Desktop\KITTENTEST\gamemode s\greekfr.pwn(645) : error 017: undefined symbol "AdminLevel"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

How to "define" them?


Re: What's wrong with this line? - billy123321 - 14.08.2014

Quote:
Originally Posted by Gogorakis
Посмотреть сообщение
Thank you!! Fixed..but..


How to "define" them?
You haven't yet defined your admin level variable in the script yet...? You should be doing that before commands.


Re: What's wrong with this line? - Pottus - 14.08.2014

Lets see those lines