项目作者: Ilusion9

项目描述 :
Get entities outputs.
高级语言: SourcePawn
项目地址: git://github.com/Ilusion9/outputs-list-sm.git
创建时间: 2020-09-11T08:01:44Z
项目社区:https://github.com/Ilusion9/outputs-list-sm

开源协议:

下载


Description

Get entities outputs.

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

Alliedmods

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

Functions

  1. /**
  2. * Returns an output from an entity outputs list
  3. *
  4. * @param hammerId Entity hammer id.
  5. * @param index Index in the output list.
  6. * @param output Buffer to copy the output name.
  7. * @param outputlen Maximum size of the output buffer.
  8. * @param target Buffer to copy the target name.
  9. * @param targetlen Maximum size of the target buffer.
  10. * @param input Buffer to copy the input received.
  11. * @param inputlen Maximum size of the input buffer.
  12. * @param params Buffer to copy the parameters received.
  13. * @param paramslen Maximum size of the parameters buffer.
  14. * @param delay Delay of the output
  15. * @param once True if the output has 'Only Once' flag enabled.
  16. * @return True if the output has been returned.
  17. */
  18. 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);
  19. /**
  20. * Returns an output from an entity outputs list
  21. *
  22. * @param entity Entity index.
  23. * @param index Index in the output list.
  24. * @param output Buffer to copy the output name.
  25. * @param outputlen Maximum size of the output buffer.
  26. * @param target Buffer to copy the target name.
  27. * @param targetlen Maximum size of the target buffer.
  28. * @param input Buffer to copy the input received.
  29. * @param inputlen Maximum size of the input buffer.
  30. * @param params Buffer to copy the parameters received.
  31. * @param paramslen Maximum size of the parameters buffer.
  32. * @param delay Delay of the output
  33. * @param once True if the output has 'Only Once' flag enabled.
  34. * @return True if the output has been returned.
  35. */
  36. 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);
  37. /**
  38. * Returns the entity outputs count.
  39. *
  40. * @param hammerId Entity hammer id.
  41. * @return The entity outputs count.
  42. */
  43. native int GetHammerIdOutputsCount(int hammerId);
  44. /**
  45. * Returns the entity outputs count.
  46. *
  47. * @param entity Entity index.
  48. * @return The entity outputs count.
  49. */
  50. native int GetEntityOutputsCount(int entity);

Examples

Get all outputs from entity index

  1. bool inputOnce;
  2. char outputName[256];
  3. char targetName[256];
  4. char inputName[256];
  5. char params[256];
  6. float inputDelay;
  7. for (int i = 0; i < GetEntityOutputsCount(entity); i++)
  8. {
  9. // get output
  10. if (!GetEntityOutput(entity, i, outputName, sizeof(outputName), targetName, sizeof(targetName), inputName, sizeof(inputName), params, sizeof(params), inputDelay, inputOnce))
  11. {
  12. continue;
  13. }
  14. // do something with this output
  15. }

Get all outputs from entity hammer id

  1. bool inputOnce;
  2. char outputName[256];
  3. char targetName[256];
  4. char inputName[256];
  5. char params[256];
  6. float inputDelay;
  7. for (int i = 0; i < GetHammerIdOutputsCount(hammerId); i++)
  8. {
  9. // get output
  10. if (!GetHammerIdOutput(hammerId, i, outputName, sizeof(outputName), targetName, sizeof(targetName), inputName, sizeof(inputName), params, sizeof(params), inputDelay, inputOnce))
  11. {
  12. continue;
  13. }
  14. // do something with this output
  15. }