if(classid == 0 || classid == 1 || classid == 2 || classid == 3 || classid == 4) { gTeam[playerid] = TEAM_Usa; } else if(classid >= 5 && classid <= 9) { gTeam[playerid] = TEAM_Iraq; } else if(classid >= 10 && classid <= 14) { gTeam[playerid] = TEAM_Nazi; } else if(classid >= 15 && classid <= 19) { gTeam[playerid] = TEAM_Alqaida; } }
C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\Coding\PAWNO\pawn o\gamemode.pwn(83) : error 029: invalid expression, assumed zero C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\Coding\PAWNO\pawn o\gamemode.pwn(85) : error 029: invalid expression, assumed zero C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\Coding\PAWNO\pawn o\gamemode.pwn(87) : error 029: invalid expression, assumed zero C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\Coding\PAWNO\pawn o\gamemode.pwn(89) : error 029: invalid expression, assumed zero |
if(classid >= 0 && classid <= 4) gTeam[playerid] = TEAM_Usa;
else if(classid >= 5 && classid <= 9) gTeam[playerid] = TEAM_Iraq;
else if(classid >= 10 && classid <= 14) gTeam[playerid] = TEAM_Nazi;
else if(classid >= 15 && classid <= 19) gTeam[playerid] = TEAM_Alqaida;
switch(classid)
{
case 0..4: gTeam[playerid] = TEAM_Usa;
case 5..9: gTeam[playerid] = TEAM_Iraq;
case 10..14: gTeam[playerid] = TEAM_Nazi;
case 15..19: gTeam[playerid] = TEAM_Alqaida;
}
Originally Posted by Finn
switch works just like if-else if's, it's just a bit easier to read.
You guys should learn to respect the way other people are scripting, if he uses if-else if's let him use them. He asked for help with the errors, not with the way he scripts. |
Originally Posted by Finn
switch works just like if-else if's, it's just a bit easier to read.
You guys should learn to respect the way other people are scripting, if he uses if-else if's let him use them. He asked for help with the errors, not with the way he scripts. |
C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\Coding\PAWNO\pawn o\gamemode.pwn(127) : error 029: invalid expression, assumed zero C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\Coding\PAWNO\pawn o\gamemode.pwn(12 : error 001: expected token: ";", but found "case" C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\Coding\PAWNO\pawn o\gamemode.pwn(12 : error 029: invalid expression, assumed zero C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\Coding\PAWNO\pawn o\gamemode.pwn(129) : error 001: expected token: ";", but found "case" C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\Coding\PAWNO\pawn o\gamemode.pwn(129) : error 029: invalid expression, assumed zero C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\Coding\PAWNO\pawn o\gamemode.pwn(130) : error 001: expected token: ";", but found "case" |
SetPlayerTeamFromClass(playerid, classid) { switch(classid) { case 0..4: gTeam[playerid] = TEAM_Usa; case 5..9: gTeam[playerid] = TEAM_Iraq; case 10..14: gTeam[playerid] = TEAM_Nazi; case 15..19: gTeam[playerid] = TEAM_Alqaida; } }