aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/scripts/scriptutility.cpp
diff options
context:
space:
mode:
authorErlite <ys.aameziane@gmail.com>2022-12-22 20:09:33 +0100
committerGitHub <noreply@github.com>2022-12-22 20:09:33 +0100
commit2c5dd95395faab0462c68e7ec676c97e42967860 (patch)
tree312dad4a7f92a647b52b7ad3b5d4f2994f63693f /NorthstarDLL/scripts/scriptutility.cpp
parent743bd2427e112197724d91d432f92093e5982d84 (diff)
downloadNorthstarLauncher-2c5dd95395faab0462c68e7ec676c97e42967860.tar.gz
NorthstarLauncher-2c5dd95395faab0462c68e7ec676c97e42967860.zip
Add NSGetLocalPlayerUID() function. (#371)
* Add NSGetLocalPlayerUID() function. * Format fix. * All VMS actually why not * Add missing includes
Diffstat (limited to 'NorthstarDLL/scripts/scriptutility.cpp')
-rw-r--r--NorthstarDLL/scripts/scriptutility.cpp15
1 files changed, 15 insertions, 0 deletions
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<context>->pushasset(sqvm, g_pSquirrel<context>->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<context>->pushstring(sqvm, R2::g_pLocalPlayerUserID);
+ return SQRESULT_NOTNULL;
+ }
+
+ return SQRESULT_NULL;
+}