More simple way to do this?
#3

Quote:
Originally Posted by [HiC]TheKiller
View Post
You could always do something like the following:

pawn Code:
stock IsValidSkin(skinid)
{
    new noskin[25] = {0, 165, 166, 211, 217, 294, 265, 266, 267, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288};
    for(new i; i<25; i++)
    {
        if(skinid == noskin[i]) return 0;
    }
    return 1;
}

public OnGameModeInit()
{
    for( new SkinID; SkinID < MAX_SKIN_ID; SkinID ++ )
    {
        if(IsValidSkin(SkinID) == 1) AddPlayerClass( SkinID, 0,0,0,0, 0,0, 0,0, 0,0 );
    }
    return 1;
}
This method is actually probably less efficient than what you have currently though. There are also other methods but they are pretty much similar.
So what you're saying is what I have is pretty much the best it gets? Considering calling a stock is probably less efficient than a switch statement. (like you said) Thank you.
Reply


Messages In This Thread
More simple way to do this? - by 2KY - 14.04.2012, 04:08
Re: More simple way to do this? - by [HiC]TheKiller - 14.04.2012, 05:59
Re: More simple way to do this? - by 2KY - 14.04.2012, 14:18
Re: More simple way to do this? - by Joe Staff - 14.04.2012, 14:21

Forum Jump:


Users browsing this thread: 1 Guest(s)