Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. // private - used to minimize all reflection code
  2. AMS_GetMethod(clientIdx, spellIdx, const String:format[], &Handle:retPlugin, &Function:retFunc)
  3. {
  4. AMS_FixPluginName(AMS_AbilityPack[clientIdx][spellIdx], true);
  5. AMS_FixMethodName(format, AMS_AbilityPrefix[clientIdx][spellIdx]);
  6.  
  7. static String:buffer[256];
  8. new Handle:iter = GetPluginIterator();
  9. new Handle:plugin = INVALID_HANDLE;
  10. while (MorePlugins(iter))
  11. {
  12. plugin = ReadPlugin(iter);
  13.  
  14. GetPluginFilename(plugin, buffer, sizeof(buffer));
  15. if (StrContains(buffer, AMS_PluginName, false) != -1)
  16. break;
  17. else
  18. plugin = INVALID_HANDLE;
  19. }
  20.  
  21. CloseHandle(iter);
  22. if (plugin != INVALID_HANDLE)
  23. {
  24. new Function:func = GetFunctionByName(plugin, AMS_MethodName);
  25. if (func != INVALID_FUNCTION)
  26. {
  27. retPlugin = plugin;
  28. retFunc = func;
  29. }
  30. else
  31. PrintToServer("[sarysapub3] ERROR: Could not find %s:%s()", AMS_PluginName, AMS_MethodName);
  32. }
  33. else
  34. PrintToServer("[sarysapub3] ERROR: Could not find %s. %s() failed.", AMS_PluginName, AMS_MethodName);
  35. }
  36.  
  37. AMS_ExecuteSpell(clientIdx, spellIdx)
  38. {
  39. if (!IsEmptyString(AMS_CastingParticle))
  40. {
  41. new particle = -1;
  42. if (IsEmptyString(AMS_CastingAttachment))
  43. particle = AttachParticle(clientIdx, AMS_CastingParticle, 70.0, true);
  44. else
  45. particle = AttachParticleToAttachment(clientIdx, AMS_CastingParticle, AMS_CastingAttachment);
  46.  
  47. if (IsValidEntity(particle))
  48. CreateTimer(1.0, RemoveEntity, EntIndexToEntRef(particle), TIMER_FLAG_NO_MAPCHANGE);
  49. }
  50.  
  51. new Handle:plugin = INVALID_HANDLE;
  52. new Function:func = INVALID_FUNCTION;
  53. AMS_GetMethod(clientIdx, spellIdx, "%s_Invoke", plugin, func);
  54. if (plugin != INVALID_HANDLE && func != INVALID_FUNCTION)
  55. {
  56. Call_StartFunction(plugin, func);
  57. Call_PushCell(clientIdx);
  58. Call_Finish();
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement