AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   SendProxy Manager (https://forums.alliedmods.net/showthread.php?t=169795)

Afronanny 10-16-2011 21:17

SendProxy Manager
 
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

psychonic 10-16-2011 21:33

Re: SendProxy Manager
 
captioncaptioncaption

KyleS 10-17-2011 02:24

Re: SendProxy Manager
 
L 10/16/2011 - 19:26:49: [SM] Native "SendProxy_Hook" reported: Could not find prop m_iHealth in sendtable DT_CSPlayer

Just so it doesn't get lost.

GoD-Tony 10-17-2011 04:06

Re: SendProxy Manager
 
This looks useful.

Quote:

Originally Posted by KyleS (Post 1577388)
[SM] Native "SendProxy_Hook" reported: Could not find prop m_iHealth in sendtable DT_CSPlayer

I get the same error using the example posted.

Despirator 10-17-2011 04:21

Re: SendProxy Manager
 
same for me

McFlurry 10-17-2011 08:47

Re: SendProxy Manager
 
Sounds very useful.

KyleS 10-17-2011 09:53

Re: SendProxy Manager
 
Quote:

Originally Posted by GoD-Tony (Post 1577408)
I get the same error using the example posted.

While I'm not completely sure, I think you can detect the "Shoot on Crits" hack(s) with this by hooking the prop (I could also be insane). This has so many use cases it isn't even funny.

Afronanny 10-17-2011 12:03

Re: SendProxy Manager
 
Fixed your error (Could not find prop m_iHealth in sendtable DT_CSPlayer) hopefully. It now searches all datatables within datatables for the prop you want. Redownload for the updated version.

Also it handles client disconnects now, so you don't need to manually unhook it for client disconnects.
captioncaption

\\
captioncaption

Afronanny 10-17-2011 18:21

Re: SendProxy Manager
 
Updated (1.0.3).

The integer and float SendProp values are now passed through iValue and flValue in the callback.
caption

Afronanny 10-18-2011 00:46

Re: SendProxy Manager
 
Updated again (1.0.4)

Fixed crashes related to plugin unloading/reloading.
caption


All times are GMT -4. The time now is 18:21.

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