Well, at first I did use do-while loop with a valid condition, kinda like ****** posted. Exact code was ( I think ):
pawn Код:
do
{
skinid = random(300);
}
while (SkinDB[skinid][Gender] != gender && SkinDB[skinid][Skin] != skin && SkinDB[skinid][Price] != price);
But this didn't work like its supposed to. It have me a wrong skinID. I figured it did a loop one more time, and returned the next random value instead. Maybe, there was some other mistake..
The truth is, I'm a bit ill today, and it's kind of hard to focus. So some stupid little mistakes are keen to come. Still, I wish to get something done despite it.
The code will be used only once, when the player registers. All of the
gender/skin combinations are there, and the
price variable is there for another reason, for later. For now, the function will only search for skins with the price of -1. So there shouldn't be a condition where the loop can't break.
For now I will stick with the infinite
for loop, as it's something new for me, and it works
I doubt there's much room for optimization anyway. ( I hope someone proves me wrong here :P )