From acdf6cf1ff629f7ddf0ab0bd610ca421fcf38157 Mon Sep 17 00:00:00 2001 From: legonzaur Date: Fri, 18 Aug 2023 21:46:12 +0200 Subject: [PATCH] add shared function file --- mod.json | 4 ++++ mod/scripts/vscripts/killstat.nut | 11 ++--------- mod/scripts/vscripts/toneapi_shared.nut | 7 +++++++ 3 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 mod/scripts/vscripts/toneapi_shared.nut diff --git a/mod.json b/mod.json index 44c87cd..5fbe54b 100644 --- a/mod.json +++ b/mod.json @@ -23,6 +23,10 @@ } ], "Scripts": [ + { + "Path": "toneapi_shared.nut", + "RunOn": "SERVER" + }, { "Path": "matchstat.nut", "RunOn": "SERVER", diff --git a/mod/scripts/vscripts/killstat.nut b/mod/scripts/vscripts/killstat.nut index 717d62f..ec9f77c 100644 --- a/mod/scripts/vscripts/killstat.nut +++ b/mod/scripts/vscripts/killstat.nut @@ -35,15 +35,13 @@ function killstat_Init() { AddCallback_OnClientConnected(JoinMessage) } -string prefix = "\x1b[38;5;81m[TONE API]\x1b[0m " - bool function hasCustomAirAccel(){ return Code_GetCurrentPlaylistVarOrUseValue("custom_air_accel_pilot", "null") != "null" } void function JoinMessage(entity player) { - //Chat_ServerPrivateMessage(player, prefix + "This server collects data using the Tone API. Check your data here: \x1b[34mtoneapi.com/" + player.GetPlayerName()+ "\x1b[0m", false, false) - Chat_ServerPrivateMessage(player, prefix + "This server collects data using the WIP Tone API. View statistics at https://toneapi.github.io/ToneAPI_webclient/", false, false) + //Chat_ServerPrivateMessage(player, killstat_prefix + "This server collects data using the Tone API. Check your data here: \x1b[34mtoneapi.com/" + player.GetPlayerName()+ "\x1b[0m", false, false) + Chat_ServerPrivateMessage(player, killstat_prefix + "This server collects data using the WIP Tone API. View statistics at https://toneapi.github.io/ToneAPI_webclient/", false, false) } void @@ -276,11 +274,6 @@ var function GetTitan(entity player) { return null } -void -function Log(string s) { - print(prefix + s) -} - void function Tone_Test_Auth() { HttpRequest request diff --git a/mod/scripts/vscripts/toneapi_shared.nut b/mod/scripts/vscripts/toneapi_shared.nut new file mode 100644 index 0000000..d4c2e98 --- /dev/null +++ b/mod/scripts/vscripts/toneapi_shared.nut @@ -0,0 +1,7 @@ +globalize_all_functions + +global string killstat_prefix = "\x1b[38;5;81m[TONE API]\x1b[0m " + +void function Log(string s) { + print(killstat_prefix + s) +} \ No newline at end of file