From 0ff2829ecd31e409d616f90bb98c836b3e1e783b Mon Sep 17 00:00:00 2001 From: Zoephix Date: Wed, 17 Feb 2021 16:10:30 +0100 Subject: [PATCH 1/2] Author name fetching via Steam ID --- gamemode/core/hooks/cl_hooks.lua | 17 +++++++++++++++++ plugins/persistence.lua | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gamemode/core/hooks/cl_hooks.lua b/gamemode/core/hooks/cl_hooks.lua index b52d03d2..82bd1978 100644 --- a/gamemode/core/hooks/cl_hooks.lua +++ b/gamemode/core/hooks/cl_hooks.lua @@ -537,3 +537,20 @@ function GM:ScreenResolutionChanged(oldW, oldH) nut.config.get("genericFont") ) end + +function GM:NutScriptLoaded() + for _, PLUGIN in pairs(nut.plugin.list) do + local author64ID = tonumber(PLUGIN.author) + local authorSteamID = string.find(PLUGIN.author, "STEAM") + + if (author64ID or authorSteamID) then + -- Store the Steam ID + PLUGIN.authorID = author64ID and util.SteamIDFrom64(PLUGIN.author) or PLUGIN.author + + steamworks.RequestPlayerInfo(authorSteamID and util.SteamIDTo64(PLUGIN.author) or PLUGIN.author, function(steamName) + -- Update the author name + PLUGIN.author = steamName + end) + end + end +end diff --git a/plugins/persistence.lua b/plugins/persistence.lua index cf46adb0..6ed006b9 100644 --- a/plugins/persistence.lua +++ b/plugins/persistence.lua @@ -2,7 +2,7 @@ local PLUGIN = PLUGIN PLUGIN.name = "Persistence" PLUGIN.desc = "Saves persisted entities through restarts." -PLUGIN.author = "Zoephix" +PLUGIN.author = "STEAM_0:0:50197118" -- Storage for persisted map entities PLUGIN.entities = PLUGIN.entities or {} From abcbf7ba56adaebe4a5286cba35ed708f43102f2 Mon Sep 17 00:00:00 2001 From: Zoephix Date: Wed, 17 Feb 2021 16:11:01 +0100 Subject: [PATCH 2/2] string.match --- gamemode/core/hooks/cl_hooks.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemode/core/hooks/cl_hooks.lua b/gamemode/core/hooks/cl_hooks.lua index 82bd1978..54b99732 100644 --- a/gamemode/core/hooks/cl_hooks.lua +++ b/gamemode/core/hooks/cl_hooks.lua @@ -541,7 +541,7 @@ end function GM:NutScriptLoaded() for _, PLUGIN in pairs(nut.plugin.list) do local author64ID = tonumber(PLUGIN.author) - local authorSteamID = string.find(PLUGIN.author, "STEAM") + local authorSteamID = string.match(PLUGIN.author, "STEAM_", 1) if (author64ID or authorSteamID) then -- Store the Steam ID