Giter VIP home page Giter VIP logo

outputs-list-sm's Introduction

Description

Get entities outputs.

Credits to: https://github.com/kidfearless/output-info-plugin/

Alliedmods

https://forums.alliedmods.net/showthread.php?t=327344

Functions

/**
 * Returns an output from an entity outputs list
 *
 * @param hammerId          Entity hammer id.
 * @param index             Index in the output list.
 * @param output            Buffer to copy the output name.
 * @param outputlen         Maximum size of the output buffer.
 * @param target            Buffer to copy the target name.
 * @param targetlen         Maximum size of the target buffer.
 * @param input             Buffer to copy the input received.
 * @param inputlen          Maximum size of the input buffer.
 * @param params            Buffer to copy the parameters received.
 * @param paramslen         Maximum size of the parameters buffer.
 * @param delay             Delay of the output
 * @param once              True if the output has 'Only Once' flag enabled.
 * @return                  True if the output has been returned.
 */
native bool GetHammerIdOutput(int hammerId, int index, char[] output, int outputlen, char[] target, int targetlen, char[] input, int inputlen, char[] params, int paramslen, float& delay, bool& once);

/**
 * Returns an output from an entity outputs list
 *
 * @param entity            Entity index.
 * @param index             Index in the output list.
 * @param output            Buffer to copy the output name.
 * @param outputlen         Maximum size of the output buffer.
 * @param target            Buffer to copy the target name.
 * @param targetlen         Maximum size of the target buffer.
 * @param input             Buffer to copy the input received.
 * @param inputlen          Maximum size of the input buffer.
 * @param params            Buffer to copy the parameters received.
 * @param paramslen         Maximum size of the parameters buffer.
 * @param delay             Delay of the output
 * @param once              True if the output has 'Only Once' flag enabled.
 * @return                  True if the output has been returned.
 */
native bool GetEntityOutput(int entity, int index, char[] output, int outputlen, char[] target, int targetlen, char[] input, int inputlen, char[] params, int paramslen, float& delay, bool& once);

/**
 * Returns the entity outputs count.
 *
 * @param hammerId          Entity hammer id.
 * @return                  The entity outputs count.
 */
native int GetHammerIdOutputsCount(int hammerId);

/**
 * Returns the entity outputs count.
 *
 * @param entity            Entity index.
 * @return                  The entity outputs count.
 */
native int GetEntityOutputsCount(int entity);

Examples

Get all outputs from entity index

bool inputOnce;
char outputName[256];
char targetName[256];
char inputName[256];
char params[256];
float inputDelay;
  
for (int i = 0; i < GetEntityOutputsCount(entity); i++)
{		
	// get output
	if (!GetEntityOutput(entity, i, outputName, sizeof(outputName), targetName, sizeof(targetName), inputName, sizeof(inputName), params, sizeof(params), inputDelay, inputOnce))
	{
		continue;
	}

	// do something with this output
}

Get all outputs from entity hammer id

bool inputOnce;
char outputName[256];
char targetName[256];
char inputName[256];
char params[256];
float inputDelay;
  
for (int i = 0; i < GetHammerIdOutputsCount(hammerId); i++)
{		
	// get output
	if (!GetHammerIdOutput(hammerId, i, outputName, sizeof(outputName), targetName, sizeof(targetName), inputName, sizeof(inputName), params, sizeof(params), inputDelay, inputOnce))
	{
		continue;
	}

	// do something with this output
}

outputs-list-sm's People

Contributors

ilusion9 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zipcore pmarkive

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.