help else..
#1

Help please!


gamemodes\modRPG.pwn(9450) : error 029: invalid expression, assumed zero
gamemodes\modRPG.pwn(9451) : error 029: invalid expression, assumed zero



Код:
		new string[75];
		new Float:pancel;
		GetPlayerArmour(damagedid, pancel);
		if(PlayerInfo[damagedid][pSWATTag] != 0 && pancel > 50.0)	return 1;
		Msg(damagedid,"Meglőttek!");
		new loves = random(2)+1;
		new lovesname[20];
		if(loves == 1) { lovesname = "gyomrбba"; }
		else { lovesname = "mбjбba"; }
		else { lovesname ="tьdejйbe"; } <<<error
		else { lovesname ="beleibe"; } <<<error 
		format(string, sizeof(string), "*Valaki golyуt kapott a %s.", lovesname);
		ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
Reply
#2

there are two "else"'s too much, the if-conditional accepts one "else" only. which values are assigned to the variable loves? if its ranging from 1 to 4, then you can use a switch/case, if its a wider range, then you need to add the exact condition. here's an example for the if / else if / else if / else:
Код:
		if(loves == 1) { lovesname = "gyomrбba"; }
		else if (loves == 2) { lovesname = "mбjбba"; } //on both of those lines...
		else if (loves == 3) { lovesname ="tьdejйbe"; } //...the exact conditional check is required.
		else { lovesname ="beleibe"; } //here you can ommit the "if", since its the last.
you can do it like this, too:
Код:
		if(loves == 1) { lovesname = "gyomrбba"; }
		else if (loves >1 & loves =<10) { lovesname = "mбjбba"; } // bigger than 1 and smaller/equal to 10
		else if (loves >10 & loves <51) { lovesname ="tьdejйbe"; } // bigger than 10 upto (not including) 51. so from 11 to 50
		else { lovesname ="beleibe"; } // not 1, not from 2 to 10, not 11 to 50, therefore any value. it could be negative, too!
Reply
#3

thanks Babul! ++
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)