|
Veteran Member
|
03-19-2013
, 17:55
Re: SendProxy Manager
|
#162
|
Quote:
Originally Posted by smast
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(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_HookPlayer);
return Plugin_Handled; }
public Action:SendProxy_HookPlayer(entity, const String:propname[], &iValue, element) { PrintToChatAll("Hook!"); iValue = 1; return Plugin_Changed; }
|
|
|
|