Original extension by BotoX:
https://gogs.botox.bz/CSSZombieEscape/sm-ext-outputinfo
Almost all credits to him.
The original extension would let you get info about entity output actions, but was kind of limited in that it only let you read them without modifying them in any way, so I added functionality to also let you set those values.
I also added Insert/RemoveOutputAction, but these 2 natives currently only work on CS:GO on windows. This is because they need a bit of gamedata to achieve without leaking any memory. Getting the gamedata was bad enough with all of the inlining on windows, and I can't test it on linux.
Feel free to contribute by adding gamedata for other games/systems or suggesting a method of doing this without using any gamedata. Other than those 2 natives, the extension
should work on any game
What are entity output actions?
^ Basically this stuff
Fields:
"OnTrigger" - The output
"!activator" - The target, in this context means apply this action to activator
"AddOutput" - Target input, what action to call
"gravity -0.5" - Parameter, value passed into 'AddOutput'
"0.00" - Delay in seconds before applying this action
"No" - Times to fire, in this context 'No' means fire indefinitely
Example plugin:
Here's a simple example plugin that modifies trigger_multiples that set your gravity to 1 so that they instead set your gravity to 0.5
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <outputinfo>
public void OnPluginStart()
{
HookEvent( "round_start", Event_RoundStartPost );
}
public void Event_RoundStartPost( Event event, const char[] name, bool dontBroadcast )
{
// loops through all trigger_multiple and change any 'gravity 1' parameters into 'gravity 0.5'
int ent = -1;
while( ( ent = FindEntityByClassname( ent, "trigger_multiple" ) ) != -1 )
{
int count = GetOutputActionCount( ent, "m_OnTrigger" );
for( int i = 0; i < count; i++ )
{
char buffer[32];
GetOutputActionParameter( ent, "m_OnTrigger", i, buffer, sizeof( buffer ) );
if( StrEqual( buffer, "gravity 1" ) )
{
SetOutputActionParameter( ent, "m_OnTrigger", i, "gravity 0.5" );
}
}
}
}
Changelog:
Code:
- Added "times to fire" field
- Added setters for all of the action fields
- Added insert/remove action natives (CS:GO windows only)
Planned:
Code:
- Change the bool return to instead throw an error when an action index is out of bounds
- Make EventAction methodmaps for sexier syntax