Raised This Month: $51 Target: $400
 12% 

[TF2] Set player to "dead" on scoreboard


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 02-05-2012 , 09:24   [TF2] Set player to "dead" on scoreboard
Reply With Quote #1

How would I set a player as "dead" on the scoreboard, even if they're still alive?
I searched a bit in the netprops dump and found out
PHP Code:
m_bAlive 
Is it possible to change this boolean (maybe by manipulating tf_player_manager) in any way?

Thanks in advance

EDIT:
Should I just do
PHP Code:
new offset FindSendPropInfo("CTFPlayerResource""m_bAlive");
new 
ent = -1;
while ((
ent FindEntityByClassname2(ent"tf_player_manager")) != -1)
{
  
SetEntData(ent, (offset+client*4), 0);

On every game frame?

EDIT2:
Fixed it I used OnPreThinkPost hooked to the tf_player_manager entity and changed the values in there.
__________________

Last edited by napalm00; 02-05-2012 at 12:36.
napalm00 is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 02-06-2012 , 05:13   Re: [TF2] Set player to "dead" on scoreboard
Reply With Quote #2

Now that SendProxy supports arrays, it would be much "cleaner" than using post thinks.
__________________

Last edited by GoD-Tony; 02-06-2012 at 05:13.
GoD-Tony is offline
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 02-06-2012 , 08:10   Re: [TF2] Set player to "dead" on scoreboard
Reply With Quote #3

Ooh that's just neat, thanks a lot!

Free for you
__________________
napalm00 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-06-2012 , 13:13   Re: [TF2] Set player to "dead" on scoreboard
Reply With Quote #4

There's likely another way to fake sending that a player is dead... after all, the Dead Ringer does exactly that (to all players, not just the other team).

Then again, maybe this is the way the DR does it.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 02-06-2012 at 13:14.
Powerlord is offline
Calystos
Member
Join Date: Jan 2011
Location: Terra
Old 02-07-2012 , 00:02   Re: [TF2] Set player to "dead" on scoreboard
Reply With Quote #5

napalm00 could you post how you managed to get it working as am trying to work something out for Nuclear Dawn based on similar functionality.

Am gonna look into that SendProxy myself, but if you could offer some code tips that'd help it'd be much appreciated,
Calystos is offline
Send a message via ICQ to Calystos Send a message via AIM to Calystos Send a message via MSN to Calystos Send a message via Yahoo to Calystos Send a message via Skype™ to Calystos
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 02-07-2012 , 00:06   Re: [TF2] Set player to "dead" on scoreboard
Reply With Quote #6

Quote:
Originally Posted by Calystos View Post
napalm00 could you post how you managed to get it working as am trying to work something out for Nuclear Dawn based on similar functionality.

Am gonna look into that SendProxy myself, but if you could offer some code tips that'd help it'd be much appreciated,
Sure, I'll post it as soon as I get back home
__________________
napalm00 is offline
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 02-08-2012 , 09:03   Re: [TF2] Set player to "dead" on scoreboard
Reply With Quote #7

Actually not sure why this doesn't work, I've been following the tutorials on the SendProxy thread step-by-step:
PHP Code:
public OnMapStart()
{
  new 
ent FindEntityByClassname(-1"tf_player_manager");
  for(new 
1<= MaxClientsi++)
   
SendProxy_HookArrayProp(ent"m_bAlive"iProp_IntSendProp_OnSent);

In the above code I just hook 32 different elements of the array, then in the callback function I do:
PHP Code:
public Action:SendProp_OnSent(entity, const String:propname[], &iValueelement)
{
    if(
IsValidClient(element))
    {
     
iValue 0;
     return 
Plugin_Changed;
    }
    return 
Plugin_Continue;

The "IsValidClient" function is a stock function I got from VSH:
PHP Code:
stock IsValidClient(clientbool:replaycheck true)
{
    if (
client <= || client MaxClients) return false;
    if (!
IsClientInGame(client)) return false;
    if (
GetEntProp(clientProp_Send"m_bIsCoaching")) return false;
    if (
replaycheck)
    {
     if (
IsClientSourceTV(client) || IsClientReplay(client)) return false;
    }
    return 
true;

I'm not sure of what I'm missing here, I tried putting some log messages in the callback but it seems it's not even hooked or called at all. There are no errors in the logs and I'm sure I installed the extension correctly, as it's shown as "running" in the "sm exts" list.


EDIT:
Turns out it was a problem with SendProxy, the above code will work with SendProxy version 1.1.1 or greater.
__________________

Last edited by napalm00; 02-09-2012 at 10:52.
napalm00 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:19.


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