Having trouble respawning a player

  • Thread starter Thread starter VigilanteP
  • Start date Start date
V

VigilanteP

Guest
I am working on a function to reset the entites at the end of a round and so far it works fine except that it doesnt actually respawn the players, and that is where i am at the moment.

What i am trying to do is to get an instance of the player so that i can change its location, health, ammo etc... How could i do this? I need to know how to get hte isntance of a particular player whose index i found by using the GameResource function isAlive(int i). If he is alive i will need to move him... but i cant seem to find a function to let me access a player.

Is there perhaps a simpler way to do this that i am overlooking?
 
You sound like a clever bloke, so I won't go too deeply into this.

Wouldn't it simply be something like this?
(Warning, pseudocode)
Code:
CBaseEntity *pPicked;
CBasePlayer *pPlayer;

(while (pPicked = findentitybyclassname("info_player") != NULL)
{
  pPlayer = dynamic_cast< CDMBasePlayer * >(pPicked);
  if (pPlayer != NULL)
  {
    *do your stuff here, including checks for 'still living'*
  }
}
-Angry Lawyer
 
Each time you call "findentitybyclassname("info_player")" it will return a different player (ie the next one in the list of players, wherever that might be)?

If that is the case, how would you pick a specific player that you wanted after this code.. what controls which player it will return to you?
 
Back
Top