18.11.2016, 13:28
You could use random(211) + 400 to generate a model between 400 and 611 and check if the model is OK, if it's not then generate a new model. At least I understood that this is what you want. :P
Something like that I guess:
Not sure if goto is good, because wiki says "The use of gotos is widely discouraged due to their effect on program flow."
Or you could do it like this:
Something like that I guess:
Код:
new model; generate_model: model = random(211) + 400; if (model == 519) goto generate_model; //if the vehicle is Shamal (just an example) then generate a new model
Or you could do it like this:
Код:
new model = random(211) + 400; while (modelid == 519) //it will keep generating a new model if the model is a Shamal { model = random(211) + 400; }