03.04.2019, 18:08
Quote:
Or maybe you could make 2 arrays. One with all of the spawns unmodified, and one where the used spawns get removed as they get used. Then you simply remove it from the array and "compress" the array.
|
But I've just realized that I can have a more efficient idea. Which is adding "wcrm_LastSpawned" adjective to the enum, when the player is spawned, wcrm_LastSpawned will contain the GetTickCount when he spawns, and when someone else respawns, I choose a random point, if the random point was used in less than 60 seconds, then I'll randomize again till I find a random point with LastSpawned higher than 60 seconds.
Quote:
PHP Code:
|
Quote:
If you would not want the player to have any relation to the ID, you can make it all related to the enum itself. Add a player id variable in your spawn position enum and when a player spawns on the said location, set that id to the player id. When the player dies, loop through all the spawn positions and if that player id matches the one of the player that died, reset the boolean.
It is almost similar in terms of efficiency, it will though not change anything to the player variables. |