From 2c5dd95395faab0462c68e7ec676c97e42967860 Mon Sep 17 00:00:00 2001 From: Erlite Date: Thu, 22 Dec 2022 20:09:33 +0100 Subject: Add NSGetLocalPlayerUID() function. (#371) * Add NSGetLocalPlayerUID() function. * Format fix. * All VMS actually why not * Add missing includes --- NorthstarDLL/scripts/scriptutility.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/NorthstarDLL/scripts/scriptutility.cpp b/NorthstarDLL/scripts/scriptutility.cpp index 8dae49cf..fa35df7b 100644 --- a/NorthstarDLL/scripts/scriptutility.cpp +++ b/NorthstarDLL/scripts/scriptutility.cpp @@ -1,5 +1,7 @@ #include "pch.h" #include "squirrel/squirrel.h" +#include "client/r2client.h" +#include "engine/r2engine.h" // asset function StringToAsset( string assetName ) ADD_SQFUNC( @@ -12,3 +14,16 @@ ADD_SQFUNC( g_pSquirrel->pushasset(sqvm, g_pSquirrel->getstring(sqvm, 1), -1); return SQRESULT_NOTNULL; } + +// string function NSGetLocalPlayerUID() +ADD_SQFUNC( + "string", NSGetLocalPlayerUID, "", "Returns the local player's uid.", ScriptContext::UI | ScriptContext::CLIENT | ScriptContext::SERVER) +{ + if (R2::g_pLocalPlayerUserID) + { + g_pSquirrel->pushstring(sqvm, R2::g_pLocalPlayerUserID); + return SQRESULT_NOTNULL; + } + + return SQRESULT_NULL; +} -- cgit v1.2.3