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

SendProxy Manager


Post New Thread Reply   
 
Thread Tools Display Modes
smast
AlliedModders Donor
Join Date: Aug 2012
Old 03-19-2013 , 16:07   Re: SendProxy Manager
Reply With Quote #161

hey,

Code:
public OnPluginStart()
{
	RegConsoleCmd("sm_hook", Cmd_Hook);
	RegConsoleCmd("sm_unhook", Cmd_Unhook);
}

public Action:Cmd_Hook(client, args)
{
	SendProxy_HookArrayProp(FindEntityByClassname(-1, "cs_player_manager"), "m_bAlive", client, Prop_Int, SendProxy_HookPlayer);

	return Plugin_Handled;
}


public Action:Cmd_Unhook(client, args)
{
	SendProxy_UnhookArrayProp(FindEntityByClassname(-1, "cs_player_manager"), "m_bAlive", client, Prop_Int, SendProxy_UnhookPlayer);

	return Plugin_Handled;
}

public Action:SendProxy_HookPlayer(entity, const String:propname[], &iValue, element)
{
	PrintToChatAll("Hook!");
	
	iValue = 1;
	return Plugin_Changed;
}

public Action:SendProxy_UnhookPlayer(entity, const String:propname[], &iValue, element)
{
	PrintToChatAll("Unhook!");
}
The Unhook is not working. But why?

Last edited by smast; 03-21-2013 at 06:20.
smast is offline
Afronanny
Veteran Member
Join Date: Aug 2009
Old 03-19-2013 , 17:55   Re: SendProxy Manager
Reply With Quote #162

Quote:
Originally Posted by smast View Post
hey,

Code:
new g_PlayerManager;


public OnPluginStart()
{
    RegConsoleCmd("sm_hook", Cmd_Hook);
    RegConsoleCmd("sm_unhook", Cmd_Unhook);

    g_PlayerManager = FindEntityByClassname(-1, "cs_player_manager");
}

public Action:Cmd_Hook(client, args)
{
    SendProxy_HookArrayProp(g_PlayerManager, "m_bAlive", client, Prop_Int, SendProxy_HookPlayer);

    return Plugin_Handled;
}


public Action:Cmd_Unhook(client, args)
{
    SendProxy_UnhookArrayProp(g_PlayerManager, "m_bAlive", client, Prop_Int, SendProxy_UnhookPlayer);

    return Plugin_Handled;
}

public Action:SendProxy_HookPlayer(entity, const String:propname[], &iValue, element)
{
    PrintToChatAll("Hook!");
    
    iValue = 1;
    return Plugin_Changed;
}

public Action:SendProxy_UnhookPlayer(entity, const String:propname[], &iValue, element)
{
    PrintToChatAll("Unhook!");
}
The Unhook is not working. But why?

You need to pass the callback you're using to the unhook function, like so:

PHP Code:
new g_PlayerManager;


public 
OnPluginStart()
{
    
RegConsoleCmd("sm_hook"Cmd_Hook);
    
RegConsoleCmd("sm_unhook"Cmd_Unhook);

    
g_PlayerManager FindEntityByClassname(-1"cs_player_manager");
}

public 
Action:Cmd_Hook(clientargs)
{
    
SendProxy_HookArrayProp(g_PlayerManager"m_bAlive"clientProp_IntSendProxy_HookPlayer);

    return 
Plugin_Handled;
}


public 
Action:Cmd_Unhook(clientargs)
{
    
SendProxy_UnhookArrayProp(g_PlayerManager"m_bAlive"clientProp_IntSendProxy_HookPlayer);

    return 
Plugin_Handled;
}

public 
Action:SendProxy_HookPlayer(entity, const String:propname[], &iValueelement)
{
    
PrintToChatAll("Hook!");
    
    
iValue 1;
    return 
Plugin_Changed;

Afronanny is offline
smast
AlliedModders Donor
Join Date: Aug 2012
Old 03-20-2013 , 05:18   Re: SendProxy Manager
Reply With Quote #163

Thanks for your reply.

I have tried your example, but it does not work?
smast is offline
Afronanny
Veteran Member
Join Date: Aug 2009
Old 03-20-2013 , 08:27   Re: SendProxy Manager
Reply With Quote #164

I can't really help you if all you tell me is that it doesn't work. What are you expecting to happen that isn't happening? What specifically doesn't work?
Afronanny is offline
smast
AlliedModders Donor
Join Date: Aug 2012
Old 03-20-2013 , 10:32   Re: SendProxy Manager
Reply With Quote #165

For the Code above: When I'm dead and i use sm_hook => I am shown as alive in the scoreboard (the Hook works).

But sm_unhook changes nothing:
Scoreboard -> Alive
The Message "Hook" is displayed again and again.
smast is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 03-20-2013 , 10:54   Re: SendProxy Manager
Reply With Quote #166

wouldn't you want iValue = 0 in the unhook? set m_bAlive to 0 to show as dead or am I not understanding?
__________________
View my Plugins | Donate
TnTSCS is offline
smast
AlliedModders Donor
Join Date: Aug 2012
Old 03-20-2013 , 11:14   Re: SendProxy Manager
Reply With Quote #167

I thought, that a Unhook would be enough to ensure that the server-side value is sent to the clients.

But i think the unhook is not working, because the Chat Message will be printed again and again. A unhook should stop the output or i'm wrong?

Last edited by smast; 03-20-2013 at 11:14.
smast is offline
Afronanny
Veteran Member
Join Date: Aug 2009
Old 03-20-2013 , 13:59   Re: SendProxy Manager
Reply With Quote #168

Unhook should stop the output, yes. I won't be able to help debug this until Sunday when I get back to my main PC. It sounds like it could be a bug in the extension. For now though, you can just return Plugin_Continue in the callback to mimic an unhook.

Last edited by Afronanny; 03-20-2013 at 14:00.
Afronanny is offline
Antlions
Member
Join Date: Sep 2012
Old 03-20-2013 , 16:32   Re: SendProxy Manager
Reply With Quote #169

Is there a way to send a proxy in tf2 for mvm mode.
GameRules_SetProp( "m_bPlayingMannVsMachine", 1 );
i cant find a way to turn that into a proxy
Antlions is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 03-20-2013 , 17:32   Re: SendProxy Manager
Reply With Quote #170

Quote:
Originally Posted by Antlions View Post
Is there a way to send a proxy in tf2 for mvm mode.
GameRules_SetProp( "m_bPlayingMannVsMachine", 1 );
i cant find a way to turn that into a proxy
Did you try using FindEntityByClassname on the tf_gamerules class?

Not sure why you'd want to change that prop, though. It's liable to cause all sorts of issues with the UI.
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 18:04.


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