13.12.2009, 09:59
Example of my race array:
We use a different random() to the one that's default to SA-MP. But still, with random, you will probably get the same number a few times. We use random 8 times per race, it's very possible we will get the same number (or race ID in my case) in the vote.
When the race list is generated it reads from A-Z as my example above shows.
What I need help with:
I'd like that when we generate the list, it gives the race a unique ID, but I'm clueless on how to do this. The unique ID would then be used in order to create the race list, 0-7 first vote, 8-15 second vote and so on.
Above is example shows only 8 races, but our actual race list is 2,114.
My alternative solution was that when a number (race) is added to the vote list, it's given a value of -1, then when the vote list is generated again, it would not add races with a value of -1.
The problem with this would be if most of the races have a value of -1, it could create an endless loop while it tries to find races which don't have a value of -1.
Any idea's?
Код:
AndomadaRace BuffaloRace Crazyness DeadRinger ElevenAndOut Friggin3 Grafting HarryHi.... and so on.
When the race list is generated it reads from A-Z as my example above shows.
What I need help with:
I'd like that when we generate the list, it gives the race a unique ID, but I'm clueless on how to do this. The unique ID would then be used in order to create the race list, 0-7 first vote, 8-15 second vote and so on.
Код:
AndomadaRace // 7 BuffaloRace // 4 Crazyness // 2 DeadRinger // 3 ElevenAndOut // 5 Friggin3 // 0 Grafting // 1 HarryHill // 6
My alternative solution was that when a number (race) is added to the vote list, it's given a value of -1, then when the vote list is generated again, it would not add races with a value of -1.
The problem with this would be if most of the races have a value of -1, it could create an endless loop while it tries to find races which don't have a value of -1.
Any idea's?