Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- ================================
- == + Author: - Dark Void - ==
- === + Script: Fun Server ===
- === + Version: a 1.0 ===
- == + Release: N/A ==
- ================================
- --]]
- -- Fun Server mod
- -----------------------------
- function toTable(t,match)
- local cmd = {}
- if not match then
- match = "[^%s]+"
- else
- match = "[^"..match.."]+"
- end
- for word in string.gmatch(t, match) do
- table.insert(cmd, word)
- end
- return cmd
- end
- function newArray(f,l)
- a = {}
- for i=f, l do
- a[i] = 0
- end
- return a
- end
- function string.split(t,b)
- local cmd = {}
- local match = "[^%s]+"
- if type(b) == "string" then match = "[^"..b.."]+" end
- for word in string.gmatch(t, match) do table.insert(cmd, word) end
- return cmd
- end
- total_say_cmds = 0
- function initMod()
- mods = io.open("sys/lua/Fun Server/mods/mod_setup.fs")
- if mods ~= nil then
- local tm = 0
- fs_print("000255000","Mod setup file found!")
- for line in mods:lines() do
- local word = toTable(line)
- if word[1] == "use" then
- if word[2] ~= nil then
- tm = tm + 1
- dofile ("sys/lua/Fun Server/mods/"..word[2])
- fs_print(color,"Mod: '"..word[2].."' ("..tm..") [Loaded]")
- else
- error ("No mod named has been selected or does not exists!")
- end
- end
- end
- else
- error ("File: 'mod_setup.fs' does not exist!")
- end
- end
- function new_account(user,pw)
- local na = assert(io.open("sys/lua/Fun Server/user_accounts/"..user..".txt","w"))
- na:write(pw)
- na:close()
- end
- function load_say_cmds()
- say_cmdsl = io.open("sys/lua/Fun Server/fs_saycommands.fs")
- if say_cmdsl ~= nil then
- total_say_cmds = 0
- fs_print("000255000","Say commands setup file found!")
- for line in say_cmdsl:lines() do
- local cmd_l = toTable(line)
- if cmd_l[1] == "%addcmd%" then
- if cmd_l[2] == "=" then
- if cmd_l[4] == "=" then
- if cmd_l[6] == "=" then
- total_say_cmds = total_say_cmds + 1
- am = total_say_cmds
- fs_sv_cmds[am] = cmd_l[3]
- fs_sv_func[am] = cmd_l[5]
- fs_sv_tags[am] = cmd_l[7]
- fs_print(color,"Command: '"..cmd_l[7]..""..cmd_l[3].."' ("..am..") [Added]")
- end
- end
- end
- end
- end
- else
- error ("File: 'fs_saycommands.fs' does not exist!")
- end
- end
- function fs_print(c,m)
- print ("©"..c.." {FS} "..m)
- end
- function fs_msg(c,m)
- msg("©"..c.." {FS} "..m)
- end
- function fs_msg2(id,c,m)
- msg2(id,"©"..c.." {FS} "..m)
- end
- fs_sv_tags = newArray(1,1000)
- fs_sv_cmds = newArray(1,1000)
- fs_sv_func = newArray(1,1000)
- ac_name = newArray(1,32)
- ac_state = newArray(1,32)
- function reset()
- local i
- for i=1,32 do
- create_ac[i] = 0
- ac_name[i] = "[Not Logged in]"
- ac_state[i] = "???"
- end
- end
- reset()
- fs_print("255255255","Searching for settings...")
- dofile ("sys/lua/Fun Server/fs_settings.cfg")
- if user_mods == 1 then
- initMod()
- else
- fs_print(color,"Mods are not allowed!")
- end
- if say_cmd == 1 then
- load_say_cmds()
- else
- fs_print(color,"Say commands are not allowed!")
- end
- addhook("say","fs_say")
- function fs_say(id,txt)
- local text = toTable(txt)
- if text[1] == "!register" then
- new_account(text[2],text[3])
- return 1
- end
- end
Add Comment
Please, Sign In to add comment