Problem with code
#1

Код:
stock GetInvNameByID( playerid )
{
	

	new
	    name[ 65 ];
	new id;
	switch ( id )
	{
	    case PlayerInfo[playerid][Food_Meat] : name = "MEAT";

	    default            : name = "Empty";
	}

	return name;
}
I'm getting error:
Код:
error 008: must be a constant expression; assumed zero
Line: case PlayerInfo[playerid][Food_Meat] : name = "MEAT";
Reply
#2

Maybe Tying case 1: PlayerInfo[playerid][Food_Meat] : name = "MEAT";
Reply
#3

I'm getting more errors
Reply
#4

show errors?
Reply
#5

warning 215: expression has no effect
error 001: expected token: ";", but found ":"
error 014: invalid statement; not in switch
error 029: invalid expression, assumed zero
error 010: invalid function or declaration
error 033: array must be indexed (variable "name")
Reply
#6

Try That
case 0: format(PlayerInfo[playerid][Food_Meat] : name = "MEAT");
Reply
#7

Wtf format?
Reply
#8

You can't use variables as a switch case, you must use a static value.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)