Skip to content

Commit

Permalink
Add a native for getting Shavit's replay folder path for personal rep…
Browse files Browse the repository at this point in the history
…lays
  • Loading branch information
BoomShotKapow committed Nov 3, 2021
1 parent b3f8949 commit 70ca6ac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions addons/sourcemod/scripting/include/shavit/replay-playback.inc
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,15 @@ native void Shavit_GetReplayName(int style, int track, char[] buffer, int length
*/
native void Shavit_GetReplayCacheName(int bot, char[] buffer, int length);

/**
* Retrieves the folder path where the replay files are saved.
*
* @param buffer Buffer string.
* @param length String length.
* @noreturn
*/
native void Shavit_GetReplayFolderPath(char[] buffer, int length);

/**
* Checks if there's loaded replay data for a bhop style or not.
*
Expand Down
6 changes: 6 additions & 0 deletions addons/sourcemod/scripting/shavit-replay-playback.sp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
CreateNative("Shavit_StartReplayFromFile", Native_StartReplayFromFile);
CreateNative("Shavit_GetLoopingBotByName", Native_GetLoopingBotByName);
CreateNative("Shavit_SetReplayCacheName", Native_SetReplayCacheName);
CreateNative("Shavit_GetReplayFolderPath", Native_GetReplayFolderPath);

if (!FileExists("cfg/sourcemod/plugin.shavit-replay-playback.cfg") && FileExists("cfg/sourcemod/plugin.shavit-replay.cfg"))
{
Expand Down Expand Up @@ -1390,6 +1391,11 @@ public int Native_SetReplayCacheName(Handle plugin, int numParams)
return 0;
}

public int Native_GetReplayFolderPath(Handle handler, int numParams)
{
return SetNativeString(1, gS_ReplayFolder, GetNativeCell(2));
}

public Action Timer_Cron(Handle Timer)
{
for (int i = 1; i <= MaxClients; i++)
Expand Down

0 comments on commit 70ca6ac

Please sign in to comment.