Check if point is occupied
#14

Quote:
Originally Posted by RedFusion
View Post
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.
Another cool idea, maybe nice.

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:
Originally Posted by v1k1nG
View Post
PHP Code:
for(new 0MAX_SPAWN_POINTSi++){
    if(!
IsSpawnPointUsed[i]){
        
SetSpawnInfo(playeridplayerteamplayerskinwcrm_X[i], wcrm_Y[i], wcrm_Z[i], weaponammoweaponammoweaponammo);
        
IsSPawnPointUsed[i] = true;
    }    

You haven't quoted his whole reply, the part you haven't quoted of his reply makes the difference between both ideas.

Quote:
Originally Posted by Private200
View Post
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.
Yeah that's a different way for it, cool.
Reply


Messages In This Thread
Check if point is occupied - by Viggo - 03.04.2019, 17:17
Re: Check if point is occupied - by v1k1nG - 03.04.2019, 17:47
Re: Check if point is occupied - by Viggo - 03.04.2019, 17:49
Re: Check if point is occupied - by Private200 - 03.04.2019, 17:54
Re: Check if point is occupied - by v1k1nG - 03.04.2019, 17:55
Re: Check if point is occupied - by Viggo - 03.04.2019, 17:59
Re: Check if point is occupied - by v1k1nG - 03.04.2019, 18:00
Re: Check if point is occupied - by Viggo - 03.04.2019, 18:01
Re: Check if point is occupied - by v1k1nG - 03.04.2019, 18:02
Re: Check if point is occupied - by RedFusion - 03.04.2019, 18:03
Re: Check if point is occupied - by Viggo - 03.04.2019, 18:03
Re: Check if point is occupied - by v1k1nG - 03.04.2019, 18:06
Re: Check if point is occupied - by Private200 - 03.04.2019, 18:08
Re: Check if point is occupied - by Viggo - 03.04.2019, 18:08
Re: Check if point is occupied - by Viggo - 03.04.2019, 18:13
Re: Check if point is occupied - by CONTROLA - 04.04.2019, 08:57
Re: Check if point is occupied - by Viggo - 04.04.2019, 10:40

Forum Jump:


Users browsing this thread: 2 Guest(s)