Skip to content

Commit

Permalink
fix: memory leak and update include doc (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rushaway authored Jan 29, 2025
1 parent 0bf4f5b commit bc8aa1e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
7 changes: 5 additions & 2 deletions addons/sourcemod/scripting/FullUpdate.sp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public Plugin myinfo =
name = "FullUpdate",
author = "BotoX, PŠΣ™ SHUFEN, maxime1907",
description = "Serverside cl_fullupdate",
version = "1.3.1"
version = FullUpdate_VERSION,
url = "https://github.com/srcdslab/sm-plugin-FullUpdate"
}

public void OnPluginStart()
Expand All @@ -32,6 +33,7 @@ public void OnPluginStart()
g_pBaseServer = GameConfGetAddress(hGameData, "CBaseServer");
if(g_pBaseServer == Address_Null)
{
delete hGameData;
SetFailState("Couldn't get BaseServer address!");
return;
}
Expand Down Expand Up @@ -71,6 +73,7 @@ public void OnPluginStart()
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
CreateNative("ClientFullUpdate", Native_FullUpdate);

RegPluginLibrary("FullUpdate");

return APLRes_Success;
Expand Down Expand Up @@ -151,4 +154,4 @@ stock Address GetBaseClient(int client)

// The IClient vtable is +4 from the IGameEventListener2 (CBaseClient) vtable due to multiple inheritance.
return pIClientTmp - view_as<Address>(4);
}
}
13 changes: 13 additions & 0 deletions addons/sourcemod/scripting/include/FullUpdate.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
#endif
#define _FullUpdate_Included

#define FullUpdate_V_MAJOR "1"
#define FullUpdate_V_MINOR "3"
#define FullUpdate_V_PATCH "2"

#define FullUpdate_VERSION FullUpdate_V_MAJOR..."."...FullUpdate_V_MINOR..."."...FullUpdate_V_PATCH

/**
* Forces a full update (cl_fullupdate) for a client.
*
* @param client Client index
* @return True if update was successful, false otherwise
* @error Invalid client index, client not in game, or client is fake
*/
native bool ClientFullUpdate(int client);

public SharedPlugin __pl_FullUpdate =
Expand Down

0 comments on commit bc8aa1e

Please sign in to comment.