Array errors
#1

Код:
dcmd_setlevel(playerid,params[]) {
		if(level[playerid] == 5) {
		  new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		  if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /setlevel [playerid] [level]");
	  	new player1, string[128];
			player1 = strval(tmp);
		 	level = strval(tmp2);
			if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setlevel [playerid] [level]");

			if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
				if(logged[player1] == 1) {
					SendClientMessage(player1,blue,string);
					level[player1] = level;
					return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
				} else return SendClientMessage(playerid,red,"ERROR: Player must be registered and logged in to be admin");
			} else return SendClientMessage(playerid, red, "Player is not connected");
		} else return SendClientMessage(playerid, red, "Error: You are either not a admin or you are not a admin with the correct level.");
}
Код:
I keep getting errors on this any idea why?

Код:
E:\Users\Chris\Desktop\Projects\SA-MP\SA-MP Elite\gamemodes\Elite.pwn(1003) : error 033: array must be indexed (variable "level")
E:\Users\Chris\Desktop\Projects\SA-MP\SA-MP Elite\gamemodes\Elite.pwn(1009) : error 006: must be assigned to an array
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

you've defined level as an array
Код:
level[player1] = level;
if its defined as an array, you cant use it as a variable like you are
Код:
level = strval(tmp2);
sol'n, rename level to like leveltmp or something
Код:
leveltmp = strval(tmp2);
Код:
level[player1] = leveltmp;
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)