View Single Post
Author Message
Afronanny
Veteran Member
Join Date: Aug 2009
Old 10-16-2011 , 21:17   SendProxy Manager
Reply With Quote #1

SendProxy Manager

SendVar Proxies allow you to send netprop values to clients without actually changing them on the server. If you've coded with SDKHooks before, this should be easy to use, as I designed it to be very similar to SDKHooks. This extension only works on and is only supported on the following engines: ep2, ep2v, and css.

Download (1.1.3): removed
or view the source removed

Here's some example code to get you started.

PHP Code:
#include <sourcemod>
#include <sendproxy>

public OnPluginStart()
{
    
RegConsoleCmd("test_hook"Command_TestHook);
}

public 
Action:Command_TestHook(clientargs)
{
    
SendProxy_Hook(client"m_iTeamNum"Prop_IntProxyCallback);
    return 
Plugin_Handled;
}

public 
Action:ProxyCallback(entity, const String:propname[], &iValueelement)
{
    
//Set iValue to whatever you want to send to clients
    
iValue 3;
    return 
Plugin_Changed;

The proxy callback prototype varies for the type of prop you are proxying:
PHP Code:
funcenum SendProxyCallback
{
    
Action:public(entity, const String:PropName[], &iValueelement), //Prop_Int
    
Action:public(entity, const String:PropName[], &Float:flValueelement), //Prop_Float
    
Action:public(entity, const String:PropName[], String:modifiedValue[4096], element), //Prop_String
    
Action:public(entity, const String:PropName[], Float:vecValues[3], element), //Prop_Vector
}; 
The currently supported types are:
Code:
enum SendPropType {
    Prop_Int = 0,
    Prop_Float = 1,
    Prop_String = 2,
    //Prop_Array = 3, //Don't use yet, not fully implemented
    Prop_Vector = 4,
    Prop_Max
};
If you return Plugin_Changed in a callback, the extension will mark the edict as changed to avoid console spam from the engine. The actual values of the prop are passed through iValue, flValue, modifiedValue, and vecValues, which you can change as you see fit.

If you manage to crash this, please do provide me with some debug data and the source to whatever crashed it so that I may fix said crash as quickly as possible.

glhfducksducksducksducksducksducksducksducks

Last edited by asherkin; 03-01-2015 at 10:45.
Afronanny is offline