Browse Source

Port to SteamPawn, disable Updater compile requirement

nosoop 2 years ago
parent
commit
af8b535f5c
2 changed files with 33 additions and 5 deletions
  1. 13 5
      scripting/auto_steam_update.sp
  2. 20 0
      third_party/vendored/steampawn.inc

+ 13 - 5
scripting/auto_steam_update.sp

@@ -2,13 +2,13 @@
 
 #include <sourcemod>
 #include <sdktools>
-#include <steamtools>
+#include <steampawn>
 
 #undef REQUIRE_PLUGIN
 #tryinclude <updater>
 
 #define UPDATE_URL    "http://hg.doctormckay.com/public-plugins/raw/default/automatic_steam_update.txt"
-#define PLUGIN_VERSION "1.9.1"
+#define PLUGIN_VERSION "2.0.0"
 
 #define ALERT_SOUND "ui/system_message_alert.wav"
 
@@ -64,7 +64,10 @@ public OnPluginStart() {
 	hudRCvar = CreateConVar("auto_steam_update_hud_text_red", "0", "Amount of red for the HUD timer (only on supported games)", _, true, 0.0, true, 255.0);
 	hudGCvar = CreateConVar("auto_steam_update_hud_text_green", "255", "Amount of red for the HUD timer (only on supported games)", _, true, 0.0, true, 255.0);
 	hudBCvar = CreateConVar("auto_steam_update_hud_text_blue", "0", "Amount of red for the HUD timer (only on supported games)", _, true, 0.0, true, 255.0);
+	
+	#if defined _updater_included
 	updaterCvar = CreateConVar("auto_steam_update_auto_update", "1", "Enables automatic plugin updating (has no effect if Updater is not installed)");
+	#endif
 	
 	sv_password = FindConVar("sv_password");
 	
@@ -102,9 +105,8 @@ public OnClientPostAdminCheck(client) {
 	}
 }
 
-public Action:Steam_RestartRequested() {
+public void SteamPawn_OnRestartRequested() {
 	startTimer();
-	return Plugin_Continue;
 }
 
 public Action:Command_ForceRestart(client, args) {
@@ -226,6 +228,7 @@ IsServerPopulated() {
 
 public OnAllPluginsLoaded() {
 	new Handle:convar;
+	#if defined _updater_included
 	if(LibraryExists("updater")) {
 		Updater_AddPlugin(UPDATE_URL);
 		new String:newVersion[10];
@@ -234,6 +237,9 @@ public OnAllPluginsLoaded() {
 	} else {
 		convar = CreateConVar("auto_steam_update_version", PLUGIN_VERSION, "Automatic Steam Update Version", FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_CHEAT);	
 	}
+	#else
+	convar = CreateConVar("auto_steam_update_version", PLUGIN_VERSION, "Automatic Steam Update Version", FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_CHEAT);	
+	#endif
 	HookConVarChange(convar, Callback_VersionConVarChanged);
 }
 
@@ -241,6 +247,7 @@ public Callback_VersionConVarChanged(Handle:convar, const String:oldValue[], con
 	ResetConVar(convar);
 }
 
+#if defined _updater_included
 public Action:Updater_OnPluginDownloading() {
 	if(!GetConVarBool(updaterCvar)) {
 		return Plugin_Handled;
@@ -256,4 +263,5 @@ public OnLibraryAdded(const String:name[]) {
 
 public Updater_OnPluginUpdated() {
 	ReloadPlugin();
-}
+}
+#endif

+ 20 - 0
third_party/vendored/steampawn.inc

@@ -0,0 +1,20 @@
+/**
+ * SteamPawn
+ */
+#if defined __steampawn_included
+	#endinput
+#endif
+
+#define __steampawn_included
+
+forward void SteamPawn_OnRestartRequested();
+
+public SharedPlugin __pl_steampawn = {
+	name = "steampawn",
+	file = "steampawn.smx",
+#if defined REQUIRE_PLUGIN
+	required = 1,
+#else
+	required = 0,
+#endif
+};