Skip to content

Commit

Permalink
Detect Unloaded Plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Batfoxkid committed Feb 16, 2023
1 parent 06c404e commit ab5faf3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions scripting/filenetwork.sp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ public void OnClientDisconnect_Post(int client)
CurrentlySending[client][0] = 0;
}

public void OnNotifyPluginUnloaded(Handle plugin)
{
int match = -1;
while((match = FileListing.FindValue(plugin, FileEnum::Plugin)) != -1)
{
FileListing.Erase(match);
}
}

public Action Timer_SendingClient(Handle timer, int client)
{
CNetChan chan = CNetChan(client);
Expand All @@ -192,8 +201,8 @@ public Action Timer_SendingClient(Handle timer, int client)
FileListing.GetArray(i, info);
if(info.Client == client && StrEqual(info.Filename, CurrentlySending[client], false))
{
CallSentFileFinish(info, true);
FileListing.Erase(i);
CallSentFileFinish(info, true);
break;
}
}
Expand All @@ -215,8 +224,8 @@ public Action Timer_SendingClient(Handle timer, int client)
else
{
// Failed reasons tend to be bad names, bad sizes, etc.
CallSentFileFinish(info, false);
FileListing.Erase(i);
CallSentFileFinish(info, false);
}

return Plugin_Continue;
Expand Down

0 comments on commit ab5faf3

Please sign in to comment.