PDA

View Full Version : [L4D2] DCExt - Freely Manipulate the m_nSequence netprop!


DeathChaos25
09-06-2015, 10:19
About:
This extension simply provides a forward that allows complete manipulation over the m_nSequence netprop for any survivor or special infected.

This extension does nothing of its own other than provide a forward for other plugins to use.

Installation: Download the zip located at the bottom of the post and extract the contents of the DCExt folder into /left4dead2/addons/sourcemod/

Description:
Provides a forward for the manipulation of the m_nSequence netprop.

Forwards:

/**
* @brief Called when CBaseAnimating::SelectWeightedSequence(int Activity) is invoked for a survivor or si
* @remarks Called every frame to update a client's m_nSequence netprop
*
* @param client the client that is playing as a survivor or special infected
* @param sequence current selected sequence m_nSequence, option to override the return value with it
*
* @return Pl_Handled to override return value, Pl_Continue otherwise.
*/
forward Action:L4D2_OnSelectWSequence(client, &sequence);


Here's an example plugin of what can be done:

#include <sourcemod>
#include <sdktools>
#include <dcext>

public Action:L4D2_OnSelectWSequence(client, &sequence)
{
if (client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && IsPlayerAlive(client))
{
decl String:model[64];
GetEntPropString(client, Prop_Data, "m_ModelName", model, sizeof(model));
if (StrContains(model, "coach", false) != -1 && sequence == 202 //coach_run_pistol)
{
sequence = 227; //Run_SMG
return Plugin_Handled;
}
}
return Plugin_Continue;
}

This plugin for example, replaces Coach's buggy and glitchy Single Pistol/Magnum running animation, with his SMG running animation, which looks good enough while also not being buggy.

Thanks to:
Machine - For helping and compiling this extension for me!

Changelog -
Initial Release (09-06-2015)

NOTE:
As of now, this is a windows only release, since I have no real way of compiling extensions for Linux, if someone could help with that it'd be really appreciated (source is included in the zip)

DOWNLOAD THE EXTENSION (AND SOURCE) HERE (https://www.mediafire.com/?rn1apem15uq2jn2)

DeathChaos25
09-06-2015, 10:21
A plugin using this extension can be found here (https://forums.alliedmods.net/showthread.php?t=271146).

Sev
09-06-2015, 10:27
Very nice and useful extension.

Hopefully someone is kind enough to come through with a linux compile.

:)

psychonic
09-06-2015, 10:52
Hopefully someone is kind enough to come through with a linux compile.
The same hook can be made with the DHooks extension for which there is a Linux build available (as well as a Windows build).

DeathChaos25
09-06-2015, 11:18
The same hook can be made with the DHooks extension for which there is a Linux build available (as well as a Windows build).

I did try DHooks, but my inexperience mostly got in the way, doesn't mean I've given up on it, so I decided to release this for now while I get that solved.

Krufftys Killers
09-06-2015, 11:47
Hi DeathChaos25 am getting this error L 09/06/2015 - 11:33:03: SourceMod error session started
L 09/06/2015 - 11:33:03: Info (map "c8m1_apartment_daytime") (file "errors_20150906.log")
L 09/06/2015 - 11:33:03: [SM] Unable to load extension "DCExt.ext": /home/tcagame/gun/1302/left4dead2/addons/sourcemod/extensions/DCExt.ext.so: cannot open shared object file: No such file or directory

spumer
09-30-2015, 01:02
By Sev request i build version for linux. New binary and sources with updated Makefile in attachment.

Sourcemod 1.6+ supported

GLHF!