Thread: [FF2] [Abilities] Move Speed
View Single Post
xXDeathreusXx
Veteran Member
Join Date: Mar 2013
Location: pPlayer->GetOrigin();
Old 08-22-2015 , 22:12   Re: [Subplugin] Move Speed
Reply With Quote #8

Quote:
Originally Posted by SHADoW NiNE TR3S View Post
v1.3.0:
Code:
stock Handle:FindPlugin(String: pluginName[])
{
	new String: buffer[256];
	new String: path[PLATFORM_MAX_PATH];
	new Handle: iter = GetPluginIterator();
	new Handle: pl = INVALID_HANDLE;
	
	while (MorePlugins(iter))
	{
		pl = ReadPlugin(iter);
		Format(path, sizeof(path), "freaks/%s.ff2", pluginName);
		GetPluginFilename(pl, buffer, sizeof(buffer));
		if (!StrContains(buffer, path, false))
			break;
		else
			pl = INVALID_HANDLE;
	}
	
	CloseHandle(iter);

	return pl;
}
v1.3.1: Attempt 1
Code:
stock Handle:FindPlugin(String: pluginName[])
{
	new String: buffer[256];
	new String: path[PLATFORM_MAX_PATH];
	new Handle: iter = GetPluginIterator();
	new Handle: pl = INVALID_HANDLE;
	
	while (MorePlugins(iter))
	{
		pl = ReadPlugin(iter);
		Format(path, sizeof(path), "%s.ff2", pluginName);
		GetPluginFilename(pl, buffer, sizeof(buffer));
		if (!StrContains(buffer, path, false))
			break;
		else
			pl = INVALID_HANDLE;
	}
	
	CloseHandle(iter);

	return pl;
}
v1.3.2: Actually fixed (because i realized i was passing another .ff2)
Code:
stock Handle:FindPlugin(String: pluginName[])
{
	new String: buffer[256];
	new String: path[PLATFORM_MAX_PATH];
	new Handle: iter = GetPluginIterator();
	new Handle: pl = INVALID_HANDLE;
	
	while (MorePlugins(iter))
	{
		pl = ReadPlugin(iter);
		Format(path, sizeof(path), "%s.ff2", pluginName);
		GetPluginFilename(pl, buffer, sizeof(buffer));
		if (StrContains(buffer, path, false) >= 0)
			break;
		else
			pl = INVALID_HANDLE;
	}
	
	CloseHandle(iter);

	return pl;
}

stock AMS_InitSubability(bossIdx, clientIdx, const String: pluginName[], const String: abilityName[], const String: prefix[])
{
	new Handle:plugin = FindPlugin("ff2_sarysapub3");
	if (plugin != INVALID_HANDLE)
	{
		new Function:func = GetFunctionByName(plugin, "AMS_InitSubability");
		if (func != INVALID_FUNCTION)
		{
			Call_StartFunction(plugin, func);
			Call_PushCell(bossIdx);
			Call_PushCell(clientIdx);
			Call_PushString(pluginName);
			Call_PushString(abilityName);
			Call_PushString(prefix);
			Call_Finish();
		}
		else
			LogError("ERROR: Unable to initialize ff2_sarysapub3:AMS_InitSubability()");
	}
	else
		LogError("ERROR: Unable to initialize ff2_sarysapub3:AMS_InitSubability(). Make sure this plugin exists!");
}
Oh, >= 0
__________________
Plugins|Profile
Requests closed

I'm a smartass by nature, get used to it
xXDeathreusXx is offline