Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ServerControl-Script v0.1a
- dofile("sys/lua/wrapper.lua")
- function table.newDynArray()
- array = {}
- array.content = {}
- function array:push(el)
- array.content[#self.content + 1] = el
- end
- return array
- end
- function parse(str)
- flag_brackets = false
- current_token = ""
- tokens = table.newDynArray()
- for c in str:gmatch(".") do
- if (c == '"') then
- flag_brackets = not flag_brackets
- if (current_token ~= "") then
- tokens:push(current_token)
- end
- elseif (c == " ") then
- if (flag_brackets) then
- current_token = current_token .. " "
- else
- if (current_token ~= "") then
- tokens:push(current_token)
- current_token = ""
- end
- end
- else
- current_token = current_token .. c
- end
- end
- tokens:push(current_token)
- return tokens.content
- end
- ------------------------------------------
- function flare(id, tokens)
- print("yo")
- print(player(id, "x"))
- print(player(id, "y"))
- e = "explosion " ..math.floor(player(id, "x")).. " " ..math.floor(player(id, "y")).." 5 5 0"
- print("\""..e.."\"")
- parse(e)
- explosion(2544, 694, 5, 5, 0)
- print("eh")
- end
- ------------------------------------------
- admin_list = {}
- functions = {}
- functions["#flare"] = flare
- function isAdmin(id)
- if (id == 1) then
- return true
- end
- end
- addhook("say", "on_say")
- function on_say(id,message)
- if (isAdmin(id)) then
- tokens = parse(message)
- if (string.byte(tokens[1], 1) == 35) then
- functions[tokens[1]](id, tokens)
- end
- end
- return 0
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement