mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
add Shavit_GetLoopingBotByName
This commit is contained in:
parent
d5713824ce
commit
debbf4d87e
@ -2413,6 +2413,15 @@ native void Shavit_GetPlainChatrank(int client, char[] buf, int buflen, bool inc
|
||||
*/
|
||||
native void Shavit_DeleteWR(int style, int track, const char[] map, int accountid, int recordid, bool delete_sql, bool update_cache);
|
||||
|
||||
/*
|
||||
* Used to find a looping replay bot from the loop config name.
|
||||
*
|
||||
* @param name Looping bot config name. An example is "Other Styles" from the default set of looping bots in shavit-replay.cfg
|
||||
*
|
||||
* @return The client index of the looping replay bot. -1 if could not find the config name. 0 if could not find the replay bot client.
|
||||
*/
|
||||
native int Shavit_GetLoopingBotByName(const char[] name);
|
||||
|
||||
public SharedPlugin __pl_shavit =
|
||||
{
|
||||
name = "shavit",
|
||||
@ -2565,5 +2574,6 @@ public void __pl_shavit_SetNTVOptional()
|
||||
MarkNativeAsOptional("Shavit_GetReplayPostFrame");
|
||||
MarkNativeAsOptional("Shavit_GetReplayCachePreFrame");
|
||||
MarkNativeAsOptional("Shavit_GetReplayCachePostFrame");
|
||||
MarkNativeAsOptional("Shavit_GetLoopingBotByName");
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -329,6 +329,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
||||
CreateNative("Shavit_GetClosestReplayVelocityDifference", Native_GetClosestReplayVelocityDifference);
|
||||
CreateNative("Shavit_StartReplayFromFrameCache", Native_StartReplayFromFrameCache);
|
||||
CreateNative("Shavit_StartReplayFromFile", Native_StartReplayFromFile);
|
||||
CreateNative("Shavit_GetLoopingBotByName", Native_GetLoopingBotByName);
|
||||
|
||||
// registers library, check "bool LibraryExists(const char[] name)" in order to use with other plugins
|
||||
RegPluginLibrary("shavit-replay");
|
||||
@ -1361,6 +1362,38 @@ public int Native_SetClosestReplayStyle(Handle plugin, int numParams)
|
||||
gI_TimeDifferenceStyle[GetNativeCell(1)] = GetNativeCell(2);
|
||||
}
|
||||
|
||||
public int Native_GetLoopingBotByName(Handle plugin, int numParams)
|
||||
{
|
||||
char name[PLATFORM_MAX_PATH];
|
||||
GetNativeString(1, name, sizeof(name));
|
||||
|
||||
int configid = -1;
|
||||
|
||||
for (int i = 0; i < MAX_LOOPING_BOT_CONFIGS; i++)
|
||||
{
|
||||
if (StrEqual(gA_LoopingBotConfig[i].sName, name))
|
||||
{
|
||||
configid = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (configid == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 1; i <= MAXPLAYERS; i++)
|
||||
{
|
||||
if (gA_BotInfo[i].iType == Replay_Looping && gA_BotInfo[i].iLoopingConfig == configid)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Action Timer_Cron(Handle Timer)
|
||||
{
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user