Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // private - used to minimize all reflection code
- AMS_GetMethod(clientIdx, spellIdx, const String:format[], &Handle:retPlugin, &Function:retFunc)
- {
- AMS_FixPluginName(AMS_AbilityPack[clientIdx][spellIdx], true);
- AMS_FixMethodName(format, AMS_AbilityPrefix[clientIdx][spellIdx]);
- static String:buffer[256];
- new Handle:iter = GetPluginIterator();
- new Handle:plugin = INVALID_HANDLE;
- while (MorePlugins(iter))
- {
- plugin = ReadPlugin(iter);
- GetPluginFilename(plugin, buffer, sizeof(buffer));
- if (StrContains(buffer, AMS_PluginName, false) != -1)
- break;
- else
- plugin = INVALID_HANDLE;
- }
- CloseHandle(iter);
- if (plugin != INVALID_HANDLE)
- {
- new Function:func = GetFunctionByName(plugin, AMS_MethodName);
- if (func != INVALID_FUNCTION)
- {
- retPlugin = plugin;
- retFunc = func;
- }
- else
- PrintToServer("[sarysapub3] ERROR: Could not find %s:%s()", AMS_PluginName, AMS_MethodName);
- }
- else
- PrintToServer("[sarysapub3] ERROR: Could not find %s. %s() failed.", AMS_PluginName, AMS_MethodName);
- }
- AMS_ExecuteSpell(clientIdx, spellIdx)
- {
- if (!IsEmptyString(AMS_CastingParticle))
- {
- new particle = -1;
- if (IsEmptyString(AMS_CastingAttachment))
- particle = AttachParticle(clientIdx, AMS_CastingParticle, 70.0, true);
- else
- particle = AttachParticleToAttachment(clientIdx, AMS_CastingParticle, AMS_CastingAttachment);
- if (IsValidEntity(particle))
- CreateTimer(1.0, RemoveEntity, EntIndexToEntRef(particle), TIMER_FLAG_NO_MAPCHANGE);
- }
- new Handle:plugin = INVALID_HANDLE;
- new Function:func = INVALID_FUNCTION;
- AMS_GetMethod(clientIdx, spellIdx, "%s_Invoke", plugin, func);
- if (plugin != INVALID_HANDLE && func != INVALID_FUNCTION)
- {
- Call_StartFunction(plugin, func);
- Call_PushCell(clientIdx);
- Call_Finish();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement