[Pomoc] Problem oko "case"

Započeo NemaProblema :), Novembar 05, 2013, 18:27:52 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim:EGRP
Detaljan opis problema:
Greska i 3 warninga su problem
warning 217: loose indentation
error 002: only a single statement (or expression) can follow each "case"
warning 215: expression has no effect
warning 209: function "RankOrg" should return a value


Dio skripte:
case 7: // Rankovi za Novinare
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank

				szRankName = "Producer";

				case 2: // 2. Rank

				szRankName = "Editor";

				case 3: // 3. Rank

				szRankName = "Anchor";

				case 4: // 4. Rank

				szRankName = "Editor";

				case 5: // 5. Rank

				szRankName = "Reporter";

				case 6: // 6. Rank

				szRankName = "Intern";

				default:

				szRankName = "Nema Rank";
	
			}
		}
	return szRankName;
}


Hvala unapred :D

Gangula

warning 217: loose indentation - poravnas linije
error 002: only a single statement (or expression) can follow each "case" - koliko se secam to ti je problem sto imas dva ista case-a, tj. npr. case 7 da imas dva puta
warning 209: function "RankOrg" should return a value - nemas return na kraju trebalo bi da vraca nesto
warning 215: expression has no effect - moras dati liniju

warning 217: loose indentation - poravnas linije 
error 002: only a single statement (or expression) can follow each "case" - koliko se secam to ti je problem sto imas dva ista case-a, tj. npr. case 7 da imas dva puta
warning 209: function "RankOrg" should return a value - nemas return na kraju trebalo bi da vraca nesto
warning 215: expression has no effect - moras dati liniju


warning 217 sve mi je poravnato nzm u cemu je problem
error 002 mislim da nije problem u 2 ista case-a zato sto dok nisam dodao case 7 sve je radilo lepo a npr case 6 imam 3-4 komada ..
warning 209
warning 215 to je ova poslednja linija sto sam dao u kodu gore

Gangula

Citat: NemaProblema :) poslato Novembar 05, 2013, 18:45:58 POSLE PODNE
warning 217: loose indentation - poravnas linije 
error 002: only a single statement (or expression) can follow each "case" - koliko se secam to ti je problem sto imas dva ista case-a, tj. npr. case 7 da imas dva puta
warning 209: function "RankOrg" should return a value - nemas return na kraju trebalo bi da vraca nesto
warning 215: expression has no effect - moras dati liniju


warning 217 sve mi je poravnato nzm u cemu je problem
error 002 mislim da nije problem u 2 ista case-a zato sto dok nisam dodao case 7 sve je radilo lepo a npr case 6 imam 3-4 komada ..
warning 209
warning 215 to je ova poslednja linija sto sam dao u kodu gore
Jeste u linijama ali ajde ne mogu ti objasniti kako to radi, dodaj samo ispod include fajlova ovo:
#pragma tabsize 0
A ako imas case 6 3-4 komada onda je to problem tj. ako se nalase u istom switch-u.
A i daj mi celu funkciju kako si odradio da pogledam...

Pa kazem ti nije u tome problem jer je i pre bilo 3-4 case 6 pa je opet radilo lepo nema greske nigde, a kad sam dodao case 7 ne radi evo pogledaj (Nisam ja radio, ovo je Gamemod, ja sam samo dodao case 7)

stock RankOrg(playerid)
{
	new szRankName[32],iPlayerOrg = (PlayerInfo[playerid][pClan] > 0) ? (PlayerInfo[playerid][pClan]) : (PlayerInfo[playerid][pLider]);
	switch(iPlayerOrg)
	{
		case 1: // Rankovi za LSPD
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank
				szRankName = "Officer";
				case 2: // 2. Rank
				szRankName = "Lieutenant";
				case 3: // 3. Rank
				szRankName = "Captain";
				case 4: // 4. Rank
				szRankName = "Commander";
				case 5: // 5. Rank
				szRankName = "Deputy Chief";
				case 6: // 6. Rank
				szRankName = "Chief";
				default:
				szRankName = "Nema Rank";
			}
		}
		case 2: // Rankovi za RM
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank
				szRankName = "Shestyorka";
				case 2: // 2. Rank
				szRankName = "Torpedo";
				case 3: // 3. Rank
				szRankName = "Sovietnik";
				case 4: // 4. Rank
				szRankName = "Brigadier";
				case 5: // 5. Rank
				szRankName = "Sovietnik";
				case 6: // 6. Rank
				szRankName = "Boss";
				default:
				szRankName = "Nema Rank";
			}
		}
		case 3: // Rankovi za TRIADS
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank
				szRankName = "Blue Lanterns";
				case 2: // 2. Rank
				szRankName = "Straw Sandal";
				case 3: // 3. Rank
				szRankName = "Red Pole";
				case 4: // 4. Rank
				szRankName = "Incense Master";
				case 5: // 5. Rank
				szRankName = "Deputy Mountain Matser";
				case 6: // 6. Rank
				szRankName = "Dragon Head";
				default:
				szRankName = "Nema Rank";
			}
		}
		case 4: // Rankovi za GROVE
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank
				szRankName = "Busta";
				case 2: // 2. Rank
				szRankName = "Homeboy";
				case 3: // 3. Rank
				szRankName = "Hustla";
				case 4: // 4. Rank
				szRankName = "Gangsta";
				case 5: // 5. Rank
				szRankName = "O.G";
				case 6: // 6. Rank
				szRankName = "Kingpin";
				default:
				szRankName = "Nema Rank";
			}
		}
		case 5: // Rankovi za BALLAS
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank
				szRankName = "Gang Master";
				case 2: // 2. Rank
				szRankName = "Thug";
				case 3: // 3. Rank
				szRankName = "Soulja";
				case 4: // 4. Rank
				szRankName = "Gangsta";
				case 5: // 5. Rank
				szRankName = "O.G";
				case 6: // 6. Rank
				szRankName = "Kingpin";
				default:
				szRankName = "Nema Rank";
			}
		}
		case 6: // Rankovi za Novinare
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank
				szRankName = "Producer";
				case 2: // 2. Rank
				szRankName = "Editor";
				case 3: // 3. Rank
				szRankName = "Anchor";
				case 4: // 4. Rank
				szRankName = "Editor";
				case 5: // 5. Rank
				szRankName = "Reporter";
				case 6: // 6. Rank
				szRankName = "Intern";
				default:
				szRankName = "Nema Rank";
			}
		}
		case 7: // Rankovi za Novinare
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank

				szRankName = "Producer";

				case 2: // 2. Rank

				szRankName = "Editor";

				case 3: // 3. Rank

				szRankName = "Anchor";

				case 4: // 4. Rank

				szRankName = "Editor";

				case 5: // 5. Rank

				szRankName = "Reporter";

				case 6: // 6. Rank

				szRankName = "Intern";

				default:

				szRankName = "Nema Rank";
	
			}
		}
		return szRankName;
	}

Gangula

stock RankOrg(playerid)
{
	new szRankName[32],iPlayerOrg = (PlayerInfo[playerid][pClan] > 0) ? (PlayerInfo[playerid][pClan]) : (PlayerInfo[playerid][pLider]);
	switch(iPlayerOrg)
	{
		case 1: // Rankovi za LSPD
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank
				szRankName = "Officer";
				case 2: // 2. Rank
				szRankName = "Lieutenant";
				case 3: // 3. Rank
				szRankName = "Captain";
				case 4: // 4. Rank
				szRankName = "Commander";
				case 5: // 5. Rank
				szRankName = "Deputy Chief";
				case 6: // 6. Rank
				szRankName = "Chief";
				default:
				szRankName = "Nema Rank";
			}
		}
		case 2: // Rankovi za RM
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank
				szRankName = "Shestyorka";
				case 2: // 2. Rank
				szRankName = "Torpedo";
				case 3: // 3. Rank
				szRankName = "Sovietnik";
				case 4: // 4. Rank
				szRankName = "Brigadier";
				case 5: // 5. Rank
				szRankName = "Sovietnik";
				case 6: // 6. Rank
				szRankName = "Boss";
				default:
				szRankName = "Nema Rank";
			}
		}
		case 3: // Rankovi za TRIADS
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank
				szRankName = "Blue Lanterns";
				case 2: // 2. Rank
				szRankName = "Straw Sandal";
				case 3: // 3. Rank
				szRankName = "Red Pole";
				case 4: // 4. Rank
				szRankName = "Incense Master";
				case 5: // 5. Rank
				szRankName = "Deputy Mountain Matser";
				case 6: // 6. Rank
				szRankName = "Dragon Head";
				default:
				szRankName = "Nema Rank";
			}
		}
		case 4: // Rankovi za GROVE
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank
				szRankName = "Busta";
				case 2: // 2. Rank
				szRankName = "Homeboy";
				case 3: // 3. Rank
				szRankName = "Hustla";
				case 4: // 4. Rank
				szRankName = "Gangsta";
				case 5: // 5. Rank
				szRankName = "O.G";
				case 6: // 6. Rank
				szRankName = "Kingpin";
				default:
				szRankName = "Nema Rank";
			}
		}
		case 5: // Rankovi za BALLAS
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank
				szRankName = "Gang Master";
				case 2: // 2. Rank
				szRankName = "Thug";
				case 3: // 3. Rank
				szRankName = "Soulja";
				case 4: // 4. Rank
				szRankName = "Gangsta";
				case 5: // 5. Rank
				szRankName = "O.G";
				case 6: // 6. Rank
				szRankName = "Kingpin";
				default:
				szRankName = "Nema Rank";
			}
		}
		case 6: // Rankovi za Novinare
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank
				szRankName = "Producer";
				case 2: // 2. Rank
				szRankName = "Editor";
				case 3: // 3. Rank
				szRankName = "Anchor";
				case 4: // 4. Rank
				szRankName = "Editor";
				case 5: // 5. Rank
				szRankName = "Reporter";
				case 6: // 6. Rank
				szRankName = "Intern";
				default:
				szRankName = "Nema Rank";
			}
		}
		case 7: // Rankovi za Novinare
		{
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: // 1. Rank

				szRankName = "Producer";

				case 2: // 2. Rank

				szRankName = "Editor";

				case 3: // 3. Rank

				szRankName = "Anchor";

				case 4: // 4. Rank

				szRankName = "Editor";

				case 5: // 5. Rank

				szRankName = "Reporter";

				case 6: // 6. Rank

				szRankName = "Intern";

				default:

				szRankName = "Nema Rank";
	
			}
		}
	}
	return szRankName;
}

E hvala ti, puno si mi pomogao! :D
Nema ni jedan warning ni error   :)