redundant test ?
#5

rks just forgot some = (dunno how to call them :S)

and a switch is easy
pawn Код:
switch(classid) //the value we want switch (much if statments just in a better looking way)
{
    //this is the same as if(classid == 0)
    case 0:     GameTextForPlayer(playerid, "Police Chef", 1000, 6);
    case 1:     GameTextForPlayer(playerid, "Federal Agents - Leader", 1000, 6);
    case 2:     GameTextForPlayer(playerid, "La Costra Nostra - Leader", 1000, 6);
    case 3:     GameTextForPlayer(playerid, "Hitman - Leader", 1000, 6);
    case 4:     GameTextForPlayer(playerid, "Da Nang Boys - Leader", 1000, 6);
    //the two points stand for 5-8 (5, 6, 7, 8) here you can write 5, 6, 7, 8 too but .. is easier
    case 5..8:  GameTextForPlayer(playerid, "Police", 1000, 4);
    case 9..12: GameTextForPlayer(playerid, "Federal Agents", 1000, 4);
    case 13..16:    GameTextForPlayer(playerid, "La Costra Nostra Family", 1000, 4);
    case 17..20:    GameTextForPlayer(playerid, "Hitman", 1000, 4);
    case 21..23:    GameTextForPlayer(playerid, "Da Nang Boys", 1000, 4);
    //default is the same as else (all other classids which you didnt used)
    default:        GameTextForPlayer(playerid, "Undefined Class", 1000, 4);
}
Reply


Messages In This Thread
redundant test ? - by the_driver - 25.02.2009, 18:51
Re: redundant test ? - by yom - 25.02.2009, 18:52
Re: redundant test ? - by Rks25 - 25.02.2009, 18:53
Re: redundant test ? - by the_driver - 25.02.2009, 18:59
Re: redundant test ? - by Nero_3D - 25.02.2009, 19:08
Re: redundant test ? - by Rks25 - 25.02.2009, 20:16

Forum Jump:


Users browsing this thread: 1 Guest(s)