Raised This Month: $51 Target: $400
 12% 

[EXTENSION] Output Info


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 02-16-2018 , 13:37   [EXTENSION] Output Info
Reply With Quote #1

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_RoundStartPostEvent event, const char[] namebool dontBroadcast )
{
    
// loops through all trigger_multiple and change any 'gravity 1' parameters into 'gravity 0.5'
    
int ent = -1;
    while( ( 
ent FindEntityByClassnameent"trigger_multiple" ) ) != -)
    {
        
int count GetOutputActionCountent"m_OnTrigger" );
        for( 
int i 0counti++ )
        {
            
char buffer[32];
            
GetOutputActionParameterent"m_OnTrigger"ibuffersizeofbuffer ) );
            
            if( 
StrEqualbuffer"gravity 1" ) )
            {
                
SetOutputActionParameterent"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



Last edited by hmmmmm; 02-16-2018 at 14:46.
hmmmmm is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:19.


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