AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Question Reguarding Playerspawn Event (https://forums.alliedmods.net/showthread.php?t=135390)

Tirant 08-15-2010 15:34

Question Reguarding Playerspawn Event
 
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

Re: Question Reguarding Playerspawn Event
 
Use ham_spawn post. In the forward, check if user alive and that will correctly hook spawn.

Untested
PHP Code:

Register_HamHam_Spawn "player" "fw_Spawn" );

public 
fw_Spawnid )
{
     if ( 
is_user_alive id ) )
          
//player spawned



Tirant 08-15-2010 15:47

Re: Question Reguarding Playerspawn Event
 
That's exactly what I use.

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

Arkshine 08-15-2010 15:54

Re: Question Reguarding Playerspawn Event
 
is_user_alive() is a must like said Bugsy. You use it, right?

ConnorMcLeod 08-15-2010 16:01

Re: Question Reguarding Playerspawn Event
 
Quote:

Originally Posted by Tirant (Post 1271745)
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/sour..._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

Re: Question Reguarding Playerspawn Event
 
( Just a side-note you can use the search box, very useful like : http://www.google.com/codesearch?q=R...G=Search+Trunk )

Tirant 08-15-2010 17:05

Re: Question Reguarding Playerspawn Event
 
if (!is_user_alive(id) || !cs_get_user_team(id))
return

Thanks for the link!


All times are GMT -4. The time now is 21:52.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.