mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-11-14 17:46:03 +00:00
Added some features
some extra functions added
This commit is contained in:
parent
11c8f7064d
commit
b903434a8b
1 changed files with 28 additions and 14 deletions
36
dist/ba_root/mods/setting.py
vendored
36
dist/ba_root/mods/setting.py
vendored
|
|
@ -1,19 +1,33 @@
|
||||||
# Released under the MIT License. See LICENSE for details.
|
# Released under the MIT License. See LICENSE for details.
|
||||||
|
import ba,_ba,json,os
|
||||||
|
from stats import mystats
|
||||||
settings={}
|
statsFile = mystats.statsfile
|
||||||
|
|
||||||
def get_setting():
|
def get_setting():
|
||||||
global settings
|
s = {}
|
||||||
if settings=={}:
|
|
||||||
f=open("setting.json","r")
|
f=open("setting.json","r")
|
||||||
dat=json.loads(f.read())
|
d = json.loads(f.read())
|
||||||
settings=dat
|
|
||||||
f.close()
|
f.close()
|
||||||
return settings
|
return d
|
||||||
|
|
||||||
def commit():
|
def commit(updated_settings: dict):
|
||||||
global settings
|
if updated_settings == {}: return
|
||||||
f=open("setting.json",'w')
|
f=open("setting.json",'w')
|
||||||
json.dump(setting,f,indent=4)
|
json.dump(updated_settings,f,indent=4)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
def sendError(msg: str, ID: int = None):
|
||||||
|
if ID is not None:
|
||||||
|
ba.screenmessage(msg, color=(1,0,0), clients=[ID], transient=True)
|
||||||
|
else:
|
||||||
|
ba.screenmessage(msg, color=(1,0,0), transient=True)
|
||||||
|
|
||||||
|
def getStats():
|
||||||
|
try:
|
||||||
|
f = open(statsFile, 'r')
|
||||||
|
a = json.loads(f.read())
|
||||||
|
f.close()
|
||||||
|
return a
|
||||||
|
except:
|
||||||
|
print("Stats not found")
|
||||||
|
return {}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue