PDA

View Full Version : Question Reguarding Playerspawn Event


Tirant
08-15-2010, 15:34
I know the most efficient way of grabbing the playerspawn forward is though ham, but I have found that it is not always successful. I know that on new rounds, players who didn't die technically don't respawn, but I was curious if it is possible to grab the event on new rounds as well without using get_players. I was thinking of using ResetHUD, but will that work?

Bugsy
08-15-2010, 15:37
Use ham_spawn post. In the forward, check if user alive and that will correctly hook spawn.

UntestedRegister_Ham( Ham_Spawn , "player" , "fw_Spawn" , 1 );

public fw_Spawn( id )
{
if ( is_user_alive ( id ) )
//player spawned
}

Tirant
08-15-2010, 15:47
That's exactly what I use.

RegisterHam(Ham_Spawn, "player", "ham_PlayerSpawn_Post", 1)

Arkshine
08-15-2010, 15:54
is_user_alive() is a must like said Bugsy. You use it, right?

ConnorMcLeod
08-15-2010, 16:01
players who didn't die technically don't respawn

Yes, they do.
Ham_Spawn is called.

Look at multiplay gamerules : http://code.google.com/p/cs-sdk/source/browse/trunk/multiplay_gamerules.cpp

Function : void CHalfLifeMultiplay::RestartRound()
Is called at each new round.

line 514 is called for each player : pPlayer->RoundRespawn();

Arkshine
08-15-2010, 16:13
( Just a side-note you can use the search box, very useful like : http://www.google.com/codesearch?q=RoundRespawn+package:http://cs-sdk\.googlecode\.com&origq=RoundRespawn&btnG=Search+Trunk )

Tirant
08-15-2010, 17:05
if (!is_user_alive(id) || !cs_get_user_team(id))
return

Thanks for the link!