how do you condense this code
#4

You'd generally use an array for this.

pawn Код:
stock IsChoiceVehMid(playerid)
{
    stock const gChoiceVehMid[] = {
    435,
    441,
    449,
    450,
    464,
    465,
    501,
    537,
    538,
    539,
    564,
    569,
    570,
    584,
    590,
    591,
    594,
    606,
    607,
    608,
    610,
    611
    };

    for(new i=0; i<sizeof(gChoiceVehMid); i++)
    {
        if(gChoiceVehMid[i] == choicevehiclemid[playerid]) return 1;
    }
    return 0;
}
Not tested, and I wasn't sure what to call the function/array etc. because I have no idea what the hell it is.

Simply replace your code with this:

pawn Код:
if(IsChoiceVehMid(playerid))
Reply


Messages In This Thread
how do you condense this code - by horsemeat - 15.04.2013, 23:45
Re: how do you condense this code - by iJumbo - 15.04.2013, 23:51
Re: how do you condense this code - by horsemeat - 15.04.2013, 23:56
Re: how do you condense this code - by MP2 - 16.04.2013, 00:01

Forum Jump:


Users browsing this thread: 1 Guest(s)