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

Hekjuh 10-18-2011 03:00

Re: SendProxy Manager
 
Hi afro, the extensions doesn't seem to load here:

[SM] Unable to load plugin "HealthFix.smx": Required extension "SendProxy Manager" file("sendproxy.ext") not running

(Windows server)

Peace-Maker 10-18-2011 04:23

Re: SendProxy Manager
 
Awesome! Thanks alot. I've always wanted to do that <3

nomy 10-18-2011 07:17

Re: SendProxy Manager
 
[03] <FAILED> file "sendproxy.ext.dll": Could not find interface: ISourceMod

john_dillinger 10-18-2011 07:21

Re: SendProxy Manager
 
file "sendproxy.ext.dll": Could not find interface: ISourceMod

Despirator 10-18-2011 08:04

Re: SendProxy Manager
 
update the SM to the latest snapshot

Afronanny 10-18-2011 08:50

Re: SendProxy Manager
 
This was compiled against SM 1.4
It will not work on 1.3
1.3 is almost out the window, with 1.4 almost released.
Upgrade to 1.4
kthx


caption

Afronanny 10-18-2011 14:18

Re: SendProxy Manager
 
Updated (1.0.5)
Added support for vectors
caption

Afronanny 10-18-2011 21:39

Re: SendProxy Manager
 
Updated (1.0.6)
Now automatically sets sv_parallel_packentities to 0 on extension load to avoid threading errors
caption

ScorpFire 10-19-2011 02:55

Re: SendProxy Manager
 
how are we supposed to get sourcemod 1.4 when its not even released

alongub 10-19-2011 03:39

Re: SendProxy Manager
 
Cool extension, but how is it useful?

FunkyLoveCow 10-19-2011 09:15

Re: SendProxy Manager
 
Quote:

Originally Posted by ScorpFire (Post 1578762)
how are we supposed to get sourcemod 1.4 when its not even released

http://www.sourcemod.net/snapshots.php

Look under the development branch. Select the most recent release for the OS your sever runs.

Afronanny 10-19-2011 09:28

Re: SendProxy Manager
 
Quote:

Originally Posted by alongub (Post 1578775)
Cool extension, but how is it useful?

It allows you to use sendproxies in pawn. How useful it is, that is up to the people developing plugins that use it.
caption

GoD-Tony 10-19-2011 12:40

Re: SendProxy Manager
 
Quote:

Originally Posted by KyleS (Post 1577521)
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.

That's a good idea. You could even send fake crit prediction "notices" to test clients that are only attacking during those times.

Unfortunately I haven't played enough TF2 (5 mins total) to know enough about the game to work on something like that. Eventually though!

Afronanny 10-20-2011 21:55

Re: SendProxy Manager
 
Updated (1.0.7):

Thanks AzuiSleet for cleaning up my mess!
caption

KyleS 10-20-2011 23:39

Re: SendProxy Manager
 
Quote:

Originally Posted by Afronanny (Post 1580181)
Updated (1.0.7):

Thanks AzuiSleet for cleaning up my mess!
caption

:3

steven124 10-22-2011 08:57

Re: SendProxy Manager
 
linux :

Quote:

[14] <FAILED> file "sendproxy.ext.so": /root/SERVER/games/zm/css/cstrike/addons/sourcemod/extensions/sendproxy.ext.so: cannot open shared object file: No such file or directory
Metamod 1.9.0-dev (build 767);
SourceMod 1.4.0-dev (build 3419);

:cry:

Afronanny 10-22-2011 14:21

Re: SendProxy Manager
 
Did you put the extension in the extensions directory?
caption

pheadxdll 10-22-2011 16:41

Re: SendProxy Manager
 
I would really like to see this be able to choose which clients receive the modified SendProp. I did a little peeking and you can set the DataTable proxy function and modify the recipients but that will probably block the table getting sent to all the clients. Good work regardless Afronanny.

captionwhydoyoudothiscaption

Afronanny 10-22-2011 17:06

Re: SendProxy Manager
 
Quote:

Originally Posted by pheadxdll (Post 1581428)
I would really like to see this be able to choose which clients receive the modified SendProp. I did a little peeking and you can set the DataTable proxy function and modify the recipients but that will probably block the table getting sent to all the clients. Good work regardless Afronanny.

I've been trying to do this for months. Entities are only packed for transmission once per tick, and there's only one frame snapshot for all clients.

The Source engine just doesn't support sending different netprop values to different clients. It's possible to hack around it, but it would be a CPU-intensive, memory-hogging mess of a plugin that would have to detour just about every function that had a CFrameSnapshot* in its calling parameters and would be responsible for keeping track of and populating a CFrameSnapshot for every client for every tick.

The only other way I can think of is to play with packets as they're being sent, which would probably be the easiest solution, but not if you want an easy API that can send any netprop value to any client. You'd have to know which netprop you want to change, which packet the entity is being transmitted to the client in, and exactly where in the packet that netprop value is. So that isn't the best solution either.

I'll keep trying, but I have little hope that this will work. (Maybe Valve will add this feature in the future. Imagine the endless new plugin possibilities that this feature would bring!)
caption

steven124 10-23-2011 00:51

Re: SendProxy Manager
 
Quote:

Originally Posted by Afronanny (Post 1581325)
Did you put the extension in the extensions directory?
caption

of course

/root/SERVER/games/zm/css/cstrike/addons/sourcemod/extensions
+sendproxy.autoload
+sendproxy.ext.so

/root/SERVER/games/zm/css/cstrike/addons/sourcemod/gamedata
+sendproxy.txt

used files from the original archive :grrr:

Thraka 10-27-2011 11:54

Re: SendProxy Manager
 
Seems very interesting. Can someone spitball some ideas about how this would be used? Why would you want to change the client netprops but not on the server?

Thrawn2 10-27-2011 12:26

Re: SendProxy Manager
 
basically the server calculates with the original values while the clients see faked ones instead.

i didn't test any of those:
make all players think a player is low at health, but really has like 5000.
make a player seem like he's on team blue but he really is red and therefore takes damage inflicted by his seemingly blue teammates.
give a player the uberglow without being ubered and still taking damage.
move entities without moving them.

Afronanny 10-28-2011 22:34

Re: SendProxy Manager
 
I think I did something wrong in string/array proxying. Once I get back to a Windows computer I'll be able to get fixes for that compiled and pushed out.

Mr. Zero 10-28-2011 23:04

Re: SendProxy Manager
 
Very useful extension indeed. Thanks!

Quote:

Originally Posted by Thraka (Post 1584304)
Seems very interesting. Can someone spitball some ideas about how this would be used? Why would you want to change the client netprops but not on the server?

For example right now the m_glow netprops in L4D2 is send to all players with no way to tell the game who should see the glow and who should not.

With this extension I can send glows only to 1 person or only to the infected team.

Afronanny 10-29-2011 00:01

Re: SendProxy Manager
 
Quote:

Originally Posted by Mr. Zero (Post 1585383)
Very useful extension indeed. Thanks!



For example right now the m_glow netprops in L4D2 is send to all players with no way to tell the game who should see the glow and who should not.

With this extension I can send glows only to 1 person or only to the infected team.

No you can't. Proxies are called once for all players per tick. As I mentioned above, you cannot send a modified value to only one client.

Afronanny 10-31-2011 12:32

Re: SendProxy Manager
 
Updated (1.0.8):

Vector and String proxy hooks now copyback correctly

ducksducksducksducks

Thraka 10-31-2011 21:52

Re: SendProxy Manager
 
So for example you could make it appear that your character is sitting in one spot but be in another? lol.

Afronanny 10-31-2011 21:55

Re: SendProxy Manager
 
You could, if you wanted to.
ducks

GoD-Tony 11-13-2011 10:00

Re: SendProxy Manager
 
Any chance of getting array support? I'd like to do something like this:

Code:

CCSPlayerResource:
 Sub-Class Table (1 Deep): DT_CSPlayerResource
  Sub-Class Table (2 Deep): DT_PlayerResource
  Sub-Class Table (3 Deep): m_iPing
  -Member: 000 (offset 0) (type integer) (bits 10)
  -Member: 001 (offset 4) (type integer) (bits 10)
  -Member: 002 (offset 8) (type integer) (bits 10)
  -Member: 003 (offset 12) (type integer) (bits 10)
  -Member: 004 (offset 16) (type integer) (bits 10)
  -Member: 005 (offset 20) (type integer) (bits 10)
... etc ...

Code:
public OnMapStart() {     new ent = FindEntityByClassname(MaxClients + 1, "cs_player_manager");     SendProxy_Hook(ent, "m_iPing", Prop_Array, ProxyCallback); }

Afronanny 11-17-2011 00:30

Re: SendProxy Manager
 
Quote:

Originally Posted by GoD-Tony (Post 1595953)
Any chance of getting array support? I'd like to do something like this:

I'll have to think about the best way to implement this, seeing as array members can consist of any of the other types. Additionally, what if you only wanted to proxy one of the array members?

I shall ponder this and try some things.
ducksducks


All times are GMT -4. The time now is 10:28.

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