vancelorgin
12-12-2004, 23:04
I also posted this on HL2Coding.com, but originally from this IRC channel. This is for those who missed it.
Well (as we all know), Valve's server plugin interface sucks. Rather than bitch I'm being proactive and trying to make it suck less. I'm putting together a set of mod-independant server plugin interface extensions which give access to server.dll functions and singletons that you really shouldn't have access to. Here is a little preview - how to use CBaseEntity::Create. That function, obviously, creates an entity :P It isn't, however, exported by server.dll in any way, and hence usually cannot be used by anything but server.dll itself. Fuck that. The function is in memory, so you can call it. Here is how (on a windows hl2dm box, dedicated or server, as of 12/12/04):
typedef CBaseEntity* (__cdecl* CBaseEntity_CreateFunc)( const char *szName, const Vector &vecOrigin, const QAngle &vecAngles, CBaseEntity *pOwner );
CBaseEntity_CreateFunc CBaseEntity_Create = (CBaseEntity_CreateFunc)0x22227F00;
Yeah - hacked, but works flawlessly. My code auto-derives this address based on a signature scan, but I don't feel like pasting it, and it needs polishing. I'll probably release it soon. As an example of how to use it, try this down in ClientCommand:
if(FStrEq(pcmd, "wtfhelp")){
CBaseEntity* e = pEntity->GetUnknown()->GetBaseEntity();
CBaseEntity_Create("item_healthvial", e->GetAbsOrigin(), e->GetAbsAngles(), NULL);
return PLUGIN_STOP;
}
That spawns a little health vial on whoever types "wtfhelp" into their console. This is just the beginning guys: I'm working on hooking server messages, total ent control, ent class func overrides, and so, so much more. For the time being, play around with this :)
Well (as we all know), Valve's server plugin interface sucks. Rather than bitch I'm being proactive and trying to make it suck less. I'm putting together a set of mod-independant server plugin interface extensions which give access to server.dll functions and singletons that you really shouldn't have access to. Here is a little preview - how to use CBaseEntity::Create. That function, obviously, creates an entity :P It isn't, however, exported by server.dll in any way, and hence usually cannot be used by anything but server.dll itself. Fuck that. The function is in memory, so you can call it. Here is how (on a windows hl2dm box, dedicated or server, as of 12/12/04):
typedef CBaseEntity* (__cdecl* CBaseEntity_CreateFunc)( const char *szName, const Vector &vecOrigin, const QAngle &vecAngles, CBaseEntity *pOwner );
CBaseEntity_CreateFunc CBaseEntity_Create = (CBaseEntity_CreateFunc)0x22227F00;
Yeah - hacked, but works flawlessly. My code auto-derives this address based on a signature scan, but I don't feel like pasting it, and it needs polishing. I'll probably release it soon. As an example of how to use it, try this down in ClientCommand:
if(FStrEq(pcmd, "wtfhelp")){
CBaseEntity* e = pEntity->GetUnknown()->GetBaseEntity();
CBaseEntity_Create("item_healthvial", e->GetAbsOrigin(), e->GetAbsAngles(), NULL);
return PLUGIN_STOP;
}
That spawns a little health vial on whoever types "wtfhelp" into their console. This is just the beginning guys: I'm working on hooking server messages, total ent control, ent class func overrides, and so, so much more. For the time being, play around with this :)