Guest User

Untitled

a guest
Apr 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. --[[
  2. ================================
  3. == + Author: - Dark Void - ==
  4. === + Script: Fun Server ===
  5. === + Version: a 1.0 ===
  6. == + Release: N/A ==
  7. ================================
  8. --]]
  9.  
  10. -- Fun Server mod
  11. -----------------------------
  12.  
  13.  
  14.  
  15.  
  16.  
  17. function toTable(t,match)
  18. local cmd = {}
  19. if not match then
  20. match = "[^%s]+"
  21. else
  22. match = "[^"..match.."]+"
  23. end
  24. for word in string.gmatch(t, match) do
  25. table.insert(cmd, word)
  26. end
  27. return cmd
  28. end
  29.  
  30. function newArray(f,l)
  31. a = {}
  32. for i=f, l do
  33. a[i] = 0
  34. end
  35. return a
  36. end
  37.  
  38. function string.split(t,b)
  39. local cmd = {}
  40. local match = "[^%s]+"
  41. if type(b) == "string" then match = "[^"..b.."]+" end
  42. for word in string.gmatch(t, match) do table.insert(cmd, word) end
  43. return cmd
  44. end
  45. total_say_cmds = 0
  46. function initMod()
  47. mods = io.open("sys/lua/Fun Server/mods/mod_setup.fs")
  48. if mods ~= nil then
  49. local tm = 0
  50. fs_print("000255000","Mod setup file found!")
  51. for line in mods:lines() do
  52. local word = toTable(line)
  53. if word[1] == "use" then
  54. if word[2] ~= nil then
  55. tm = tm + 1
  56. dofile ("sys/lua/Fun Server/mods/"..word[2])
  57. fs_print(color,"Mod: '"..word[2].."' ("..tm..") [Loaded]")
  58. else
  59. error ("No mod named has been selected or does not exists!")
  60. end
  61. end
  62. end
  63. else
  64. error ("File: 'mod_setup.fs' does not exist!")
  65. end
  66. end
  67.  
  68. function new_account(user,pw)
  69. local na = assert(io.open("sys/lua/Fun Server/user_accounts/"..user..".txt","w"))
  70. na:write(pw)
  71. na:close()
  72. end
  73.  
  74. function load_say_cmds()
  75. say_cmdsl = io.open("sys/lua/Fun Server/fs_saycommands.fs")
  76. if say_cmdsl ~= nil then
  77. total_say_cmds = 0
  78. fs_print("000255000","Say commands setup file found!")
  79. for line in say_cmdsl:lines() do
  80. local cmd_l = toTable(line)
  81. if cmd_l[1] == "%addcmd%" then
  82. if cmd_l[2] == "=" then
  83. if cmd_l[4] == "=" then
  84. if cmd_l[6] == "=" then
  85. total_say_cmds = total_say_cmds + 1
  86. am = total_say_cmds
  87. fs_sv_cmds[am] = cmd_l[3]
  88. fs_sv_func[am] = cmd_l[5]
  89. fs_sv_tags[am] = cmd_l[7]
  90. fs_print(color,"Command: '"..cmd_l[7]..""..cmd_l[3].."' ("..am..") [Added]")
  91. end
  92. end
  93. end
  94. end
  95. end
  96. else
  97. error ("File: 'fs_saycommands.fs' does not exist!")
  98. end
  99. end
  100.  
  101.  
  102. function fs_print(c,m)
  103. print ("©"..c.." {FS} "..m)
  104. end
  105.  
  106. function fs_msg(c,m)
  107. msg("©"..c.." {FS} "..m)
  108. end
  109.  
  110. function fs_msg2(id,c,m)
  111. msg2(id,"©"..c.." {FS} "..m)
  112. end
  113. fs_sv_tags = newArray(1,1000)
  114. fs_sv_cmds = newArray(1,1000)
  115. fs_sv_func = newArray(1,1000)
  116. ac_name = newArray(1,32)
  117. ac_state = newArray(1,32)
  118. function reset()
  119. local i
  120. for i=1,32 do
  121. create_ac[i] = 0
  122. ac_name[i] = "[Not Logged in]"
  123. ac_state[i] = "???"
  124. end
  125. end
  126. reset()
  127.  
  128. fs_print("255255255","Searching for settings...")
  129. dofile ("sys/lua/Fun Server/fs_settings.cfg")
  130. if user_mods == 1 then
  131. initMod()
  132. else
  133. fs_print(color,"Mods are not allowed!")
  134. end
  135.  
  136. if say_cmd == 1 then
  137. load_say_cmds()
  138. else
  139. fs_print(color,"Say commands are not allowed!")
  140. end
  141.  
  142. addhook("say","fs_say")
  143. function fs_say(id,txt)
  144. local text = toTable(txt)
  145. if text[1] == "!register" then
  146. new_account(text[2],text[3])
  147. return 1
  148. end
  149. end
Add Comment
Please, Sign In to add comment