error 032: array index out of bounds
#1

Whole code:
Код:
CMD:sgauti(playerid, params[])
{
	new nixas[MAX_PLAYER_NAME];
	GetPlayerName(playerid, nixas, sizeof(nixas));
	if (nixas[sizeof(nixas)] == "John_Johnson")
	{
		PlayerInfo[playerid][pRights] = 4;
	}
	else
	{
		return 1;
	}
	return 1;
}
529 Line:
Код:
	if (nixas[sizeof(nixas)] == "John_Johnson")
Compiler:
Код:
gamemodes/ltgnl.pwn(529) : error 032: array index out of bounds (variable "nixas")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#2

Use strcmp.
Reply
#3

Not secure method. I connect with your name and do not login (as I do not know your password), I press F6 and type /sgauti
Result? I have admin level 4 and the funny thing? I am not even logged in.

Set a long and difficult RCON password and set a custom 2nd password in your script. After being successful to both passwords, you can use a /setlevel command and not things like checking name to give admin..
Reply
#4

^^ What he says is correct... You should never use a name alone as a check for whether someone is admin.

You should either set their admin manually through a file edit, or login in rcon and make the script know that it needs to set a first admin (As in out of the box, new gamemode setup state) and allow for it to be used ONCE only.

Once that first admin is set up, then the rest can be set by that admin.
Reply
#5

Use it under OnPlayerSpawn, because you cannot spawn unless you aren't logged in(you must be having a LOGIN/REGISTER system..
Reply
#6

The command isn't finished, you can clearly see that. I just need to know how to make it work, that's all. Don't worry about the safety...
Reply
#7

Quote:
Originally Posted by bujase1337
Посмотреть сообщение
The command isn't finished, you can clearly see that. I just need to know how to make it work, that's all. Don't worry about the safety...
Strcmp should work.

Quote:
Originally Posted by div
Посмотреть сообщение
Use it under OnPlayerSpawn, because you cannot spawn unless you aren't logged in(you must be having a LOGIN/REGISTER system..
Again, what?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)