AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hook for dead player spectate (https://forums.alliedmods.net/showthread.php?t=126665)

Phant 05-12-2010 07:36

Hook for dead player spectate
 
2 Attachment(s)
Hello, when Player has dead (by world or by killer, whatever), then camera targeted and follow to Killer (if Player killed by another Player) or targeted to Player corpse (if killed by world), this camera active ~5 seconds, after this dead Player change view camera to spectate (Free look, First Person, etc.) how I can hook this event (event of move player to "dead spectators")?

See screenshots if not understand. Thanks!

Leon M. 05-12-2010 09:02

Re: Hook for dead player spectate
 
To hook this event add this code to plugin_init()


PHP Code:

register_event("ClCorpse""event_client_corpse""b"


Phant 05-12-2010 10:45

Re: Hook for dead player spectate
 
Thasnk, I use:
Code:

register_message(get_user_msgid("ClCorpse"), "event_client_corpse")
But "id" in:
Code:

event_client_corpse(id) {
}

Not Player ID, how I can get Player ID whose corpse?

xPaw 05-12-2010 11:48

Re: Hook for dead player spectate
 
http://wiki.amxmodx.org/Half-Life_1_...vents#ClCorpse

Phant 05-12-2010 12:44

Re: Hook for dead player spectate
 
Ok, this work:
PHP Code:

new plid get_msg_arg_int(12

Need to fade Player screen (g_msg_screen_fade) after Player death (ClCorpse event), but ClCorpse event refresh sreen and my screen (g_msg_screen_fade) not set :(.
This is for mp_fadetoblack analog (by IPs). Any solution?

xPaw 05-12-2010 12:58

Re: Hook for dead player spectate
 
Quote:

Originally Posted by Phant (Post 1178372)
Ok, this work:
PHP Code:

new plid get_msg_arg_int(12

Need to fade Player screen (g_msg_screen_fade) after Player death (ClCorpse event), but ClCorpse event refresh sreen and my screen (g_msg_screen_fade) not set :(.
This is for mp_fadetoblack analog (by IPs). Any solution?

Different way would be setting mp_fadetoblack 1 and blocking screenfade message being sent to players you dont need :mrgreen:

ConnorMcLeod 05-12-2010 13:02

Re: Hook for dead player spectate
 
Don't use register_message when you only need the event, use register_event.
If you really need register_message (assuming you need to alter a param or block the message when some conditions matches), then don't name your callback "event_XXX" but rather "message_XXX"


Quote:

Originally Posted by xPaw (Post 1178391)
Different way would be setting mp_fadetoblack 1 and blocking screenfade message being sent to players you dont need :mrgreen:

Fade starts right when you die.

xPaw 05-12-2010 13:14

Re: Hook for dead player spectate
 
Quote:

Originally Posted by ConnorMcLeod (Post 1178396)
Fade starts right when you die.

This is why i said him to hook the message and block for players who doesnt need it

Phant 05-12-2010 13:27

Re: Hook for dead player spectate
 
Quote:

Different way would be setting mp_fadetoblack 1 and blocking screenfade message being sent to players you dont need
Hmm... Not bad idea, and mp_fadetoblack function very better. How about method to block mp_fadetoblack :P?

ConnorMcLeod
, ok, I understand, thanks.

Phant 05-28-2010 18:22

Re: Hook for dead player spectate
 
Quote:

How about method to block mp_fadetoblack :P?
Guys? Please...


All times are GMT -4. The time now is 03:46.

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