Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- User = {}
- UserData = {}
- UserData["RANK"] = 0
- UserData["muteEnd"] = 0
- UserData["speclockEnd"] = 0
- UserData["TRANKTIME"] = 0
- UserData["TRANK"] = 0
- function PlayerLevel(id)
- if (User[id]["TRANKTIME"] ~= nil) and (User[id]["TRANKTIME"] > os.time()) then
- return tonumber(User[id]["TRANK"])
- else
- User[id]["TRANKTIME"] = nil
- User[id]["TRANK"] = nil
- end
- -- 25 Owner
- -- 20 Admin
- -- 15 Moderator
- -- 10 Donator
- -- 5 VIP
- -- 0 Player
- return tonumber(User[id]["RANK"])
- end
- player_tag = {}
- function table.find(t,v)
- for _k,_v in pairs(t) do
- if _v == v then
- return _k
- end
- end
- end
- addhook("clientdata","aow")
- function aow(id,mode,x,y)
- if mode == 2 then
- parse("setpos "..id.." "..x.." "..y)
- end
- end
- addhook("serveraction","bow")
- function bow(id,buton)
- if PlayerLevel(id) >= 20 then
- if buton==1 then
- reqcld(id,2)
- end
- end
- end
- addhook("join","joinhook")
- function joinhook(id,txt)
- msg2(id,"©255255255Welcome to the NoPain Happy Town!")
- msg2(id,"©255255255You can use !help to see all your avalibe commands.")
- msg2(id,"©255255255Please read (press F1) and follow the rules.")
- msg2(id,"©255255255Enjoy!")
- msg(type(TRANKTIME))
- end
- addhook("say","sayCommands")
- function sayCommands(id,txt)
- if string.sub(txt, 1, 5) == "!kick" then
- if PlayerLevel(id) >= 15 then
- local p, reason = string.match(txt, "!kick (%d+) (.+)")
- if (p ~= nil) and (player(p,"exists")) then
- f = io.open("sys/lua/serverfiles/kicks.txt","a+")
- f:write("Kicked: "..player(p,"name").." - "..player(p,"usgn").." \n")
- f:write("Kicked by: "..player(id,"name").." "..player(id,"usgn").." \n")
- f:write("Reason: "..reason.." \n")
- f:write("Date: "..os.date("%x", os.time()).." \n\n")
- f:close()
- msg("©255255255"..player(id,"name").."©255125000 kicked ©255255255"..player(p,"name"))
- msg("©255125000Reason: ©255255255"..reason)
- parse("kick "..p)
- return 1
- else
- msg2(id,"©255255255Please enter a valid ID and reason!")
- return 1
- end
- else
- msg2(id,"255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 4) == "!ban" then
- if PlayerLevel(id) >= 15 then
- local p, reason = string.match(txt, "!ban (%d+) (.+)")
- if (p ~= nil) and (player(p,"exists")) then
- f = io.open("sys/lua/serverfiles/bans.txt","a+")
- f:write("Banned: "..player(p,"name").." - "..player(p,"usgn").." \n")
- f:write("Banned by: "..player(id,"name").." "..player(id,"usgn").." \n")
- f:write("Reason: "..reason.." \n")
- f:write("Date: "..os.date("%x", os.time()).." \n\n")
- f:close()
- msg("©255255255"..player(id,"name").." ©255125000banned ©255255255"..player(p,"name"))
- msg("©255125000Reason: ©255255255"..reason)
- parse("banip "..p)
- parse("banusgn "..p)
- return 1
- else
- msg2(id,"©255255255Please enter a valid ID and reason!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 5) == "!mute" then
- if PlayerLevel(id) >= 10 then
- local p, time, reason = string.match(txt, "!mute (%d+) (%d+) (.+)")
- time = tonumber(time)
- if (p ~= nil) and (player(p,"exists")) then
- if (time <= 60) then
- User[id]["muted"] = 1
- User[id]["muteEnd"] = os.clock() + time*60
- msg("©255255255"..player(p,"name").."©255125000 has been muted for "..time.." minute(s)")
- msg("©255125000Reason: ©255255255"..reason)
- return 1
- else
- msg2(id,"©255125000You can't mute someone for over 60 minutes!")
- return 1
- end
- else
- msg2(id,"©255125000Please enter a valid id, time and reason!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 9) == "!speclock" then
- if PlayerLevel(id) >= 15 then
- local p, time, reason = string.match(txt, "!speclock (%d+) (%d+) (.+)")
- time = tonumber(time)
- if (p ~= nil) and (player(p,"exists")) then
- if (time <= 60) then
- parse("makespec "..p)
- User[id]["speclock"] = 1
- User[id]["speclockEnd"] = os.clock() + time*60
- msg("©255125000"..player(p,"name").." has been speclocked for "..time.." minute(s)")
- msg("©255125000Reason: ©255255255"..reason)
- return 1
- else
- msg2(id,"©255125000You can't speclock someone for over 60 minutes!")
- return 1
- end
- else
- msg2(id,"©255125000Please enter a valid id, time and reason!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 3) == "!pm" then
- local p, message = string.match(txt, "!pm (%d+) (.+)")
- if (p ~= nil) and (player(p,"exists")) then
- msg2(p,"©255125000[PM from] "..player(id,"name").." : ©255255000"..message)
- msg2(id,"©255125000[PM to] "..player(p,"name").." : ©255255000"..message)
- return 1
- else
- msg2(id,"©255255255Please enter a valid ID and message!")
- return 1
- end
- elseif string.sub(txt, 1, 6) == "!bring" then
- if PlayerLevel(id) >= 15 then
- local p = string.match(txt, "!bring (%d+)")
- if (p ~= nil) and (player(p,"exists")) then
- parse("setpos "..p.." "..player(id,"x").." "..player(id,"y"))
- return 1
- else
- msg2(id,"©255255255Please enter a valid ID!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 5) == "!goto" then
- if PlayerLevel(id) >= 15 then
- local p = string.match(txt, "!goto (%d+)")
- if (p ~= nil) and (player(p,"exists")) then
- parse("setpos "..id.." "..player(p,"x").." "..player(p,"y"))
- return 1
- else
- msg2(id,"©255255255Please enter a valid ID!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 10) == "!servermsg" then
- if PlayerLevel(id) >= 20 then
- local text = string.match(txt,"!servermsg (.+)")
- if (text ~= nil) then
- msg("©255125000[Server] ©255255255"..text)
- return 1
- else
- msg2(id,"©255255255Please enter a message!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 7) == "!report" then
- local p, report = string.match(txt, "!report (%d+) (.+)")
- if (p ~= nil) and (player(p,"exists")) then
- f = io.open("sys/lua/serverfiles/reports.txt","a+")
- f:write("Reported player: "..player(p,"name").." "..player(p,"usgn").." \n")
- f:write("Reported by: "..player(id,"name").." "..player(id,"usgn").." \n")
- f:write("Reason: "..report.." \n")
- f:write("Date: "..os.date("%x", os.time()).." \n\n")
- f:close()
- msg2(id,"©255255255Thank you for your report on "..player(p,"name"))
- return 1
- else
- msg2(id,"©255125000Please enter a valid ID and reason!")
- return 1
- end
- elseif string.sub(txt, 1, 8) == "!setrank" then
- if PlayerLevel(id) >= 25 then
- local p, level = string.match(txt, "!setrank (%d+) (%d+)")
- if p and player(p, "exists") then
- if PlayerLevel(id) <= PlayerLevel(p) then
- msg2(id,"©255255255You are not allowed to change people's rank with same or higher rank as you!")
- return 1
- else
- User[p]["RANK"] = level
- msg2(id,"©255125000"..player(p, "name").."'s rank has been changed to "..level)
- msg2(p,"©255125000Your rank has been changed to "..level)
- return 1
- end
- else
- msg2(id,"©255125000Please enter a valid ID and rank!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 6) == "!trank" then
- if PlayerLevel(id) >= 25 then
- local p, level, time = string.match(txt, "!trank (%d+) (%d+) (.+)")
- p = tonumber(p)
- if p and player(p,"exists") then
- if PlayerLevel(id) <= PlayerLevel(p) then
- msg2(id,"©255255255You are not allowed to change people's rank with same or higher rank as you!")
- return 1
- else
- User[p]["TRANK"] = level
- User[p]["TRANKTIME"] = os.time() + time*86400
- msg2(id,"©255125000You have set "..player(p,"name").."'s rank to "..level.." for "..time.." day(s)")
- msg2(p,"©255125000You rank has been set to "..level.." for "..time.." day(s)")
- return 1
- end
- else
- msg2(id,"©255125000Please enter a valid ID, rank and time!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 4) == "!tag" then
- if PlayerLevel(id) >= 5 then
- if player_tag[id] ~= 1 then
- player_tag[id] = 1
- msg2(id,"©000125000Tag activated!")
- return 1
- elseif player_tag[id] ~= 0 then
- player_tag[id] = 0
- msg2(id,"©128000000Tag deactivated!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 7) == "!script" then
- msg2(id,"RD Administration Script")
- msg2(id,"Made by RebornDuck (USGN: 18065)")
- msg2(id,"Credits: EngiN33R and Starkkz")
- return 1
- elseif string.sub(txt, 1, 5) == "!rcon" then
- if PlayerLevel(id) >= 25 then
- local text = string.match(txt, "!rcon (.+)")
- if (text ~= nil) then
- parse(text)
- return 1
- else
- msg2(id,"©255125000Please enter a valid command!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 9) == "!editname" then
- if PlayerLevel(id) >= 15 then
- local p, name = string.match(txt, "!editname (%d+) (.+)")
- p = tonumber(p)
- if (p ~= nil) and (player(p,"exists")) then
- parse("setname "..p.." "..name)
- msg("©255255255Name changed by:©255255000 "..player(id,"name"))
- return 1
- else
- msg2(id,"©255125000Please enter a valid ID, name and reason!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 5) == "!slap" then
- if PlayerLevel(id) >= 15 then
- local p = string.match(txt, "!slap (%d+)")
- if (p ~= nil) and (player(p,"exists")) then
- parse("slap "..p)
- msg2(p,"©255255255You got slapped by ©255255000"..player(id,"name"))
- return 1
- else
- msg2(id,"©255125000Please enter a valid ID!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 6) == "!check" then
- if PlayerLevel(id) >= 10 then
- local p = string.match(txt, "!check (%d+)")
- p = tonumber(p)
- if (p ~= nil) and (player(p,"exists")) then
- for _, id in pairs(player(0,"table")) do
- msg2(id,"©255255255Name: ©255255000"..player(p,"name"))
- msg2(id,"©255255255USGN: ©255255000"..player(p,"usgn"))
- msg2(id,"©255255255IP: ©255255000"..player(p,"ip"))
- if PlayerLevel(p) == 25 then
- msg2(id,"©255255255Rank:©255255000 Owner")
- return 1
- elseif PlayerLevel(p) == 20 then
- msg2(id,"©255255255Rank:©255255000 Admin")
- return 1
- elseif PlayerLevel(p) == 15 then
- msg2(id,"©255255255Rank:©255255000 Moderator")
- return 1
- elseif PlayerLevel(p) == 10 then
- msg2(id,"©255255255Rank:©255255000 Donator")
- return 1
- elseif PlayerLevel(p) == 5 then
- msg2(id,"©255255255Rank:©255255000 VIP")
- return 1
- elseif PlayerLevel(p) == 0 then
- msg2(id,"©255255255Rank:©255255000 Player")
- return 1
- end
- return 1
- end
- else
- msg2(id,"©255125000Please enter a valid ID!")
- return 1
- end
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 11) == "!playerrank" then
- local p = string.match(txt, "!playerrank (%d+)")
- p = tonumber(p)
- if (p ~= nil) and (player(p, "exists")) then
- for _, id in pairs(player(0,"table")) do
- msg2(id,"©255255255Player name: ©255255000"..player(p,"name"))
- if PlayerLevel(p) == 25 then
- msg2(id,"©255255255Player rank: ©255255000Owner")
- return 1
- elseif PlayerLevel(p) == 20 then
- msg2(id,"©255255255Player rank: ©255255000Admin")
- return 1
- elseif PlayerLevel(p) == 15 then
- msg2(id,"©255255255Player rank: ©255255000Moderator")
- return 1
- elseif PlayerLevel(p) == 10 then
- msg2(id,"©255255255Player rank: ©255255000Donator")
- return 1
- elseif PlayerLevel(p) == 5 then
- msg2(id,"©255255255Player rank: ©255255000VIP")
- return 1
- elseif PlayerLevel(p) == 0 then
- msg2(id,"©255255255Player rank: ©255255000Player")
- return 1
- end
- return 1
- end
- else
- msg2(id,"©255125000Please enter a valid ID!")
- return 1
- end
- elseif string.sub(txt, 1, 8) == "!restart" then
- if PlayerLevel(id) >= 15 then
- parse("restart")
- return 1
- else
- msg2(id,"©255255255You are not allowed to use this command!")
- return 1
- end
- elseif string.sub(txt, 1, 5) == "!help" then
- if PlayerLevel(id) == 25 then
- msg2(id,"©255255255!lua ©255255000- Parse lua.")
- msg2(id,"©255255255!kick ©255255000- Kick a player from the server.")
- msg2(id,"©255255255!ban ©255255000- Ban a player from the server.")
- msg2(id,"©255255255!mute ©255255000- Mute a player for a period of time.")
- msg2(id,"©255255255!speclock ©255255000- Lock someone as a spectator for a period of time.")
- msg2(id,"©255255255!pm ©255255000- Send a private message to someone in the server.")
- msg2(id,"©255255255!servermsg ©255255000- Write a message to the whole server.")
- msg2(id,"©255255255!report ©255255000- Report someone.")
- msg2(id,"©255255255!goto ©255255000- Teleport to someone else.")
- msg2(id,"©255255255!bring ©255255000- Bring another player to you.")
- msg2(id,"©255255255!setrank ©255255000- Give someone a new rank.")
- msg2(id,"©255255255!trank ©255255000- Give someone a temporary rank.")
- msg2(id,"©255255255!tag ©255255000- Activate/Deactivate your name tag.")
- msg2(id,"©255255255!slap ©255255000- Slap someone's butt.")
- msg2(id,"©255255255!restart ©255255000- Restart the game.")
- msg2(id,"©255255255!script ©255255000- Information about the script.")
- msg2(id,"©255255255!rcon ©255255000- Execute a rcon command.")
- msg2(id,"©255255255!editname ©255255000- Change someone's name.")
- msg2(id,"©255255255!check ©255255000- Check a players USGN ID, IP, rank and name.")
- msg2(id,"©255255255!playerrank ©255255000- See what rank someone is.")
- msg2(id,"©255255255F2 ©255255000- Teleport to your pointer.")
- return 1
- elseif PlayerLevel(id) == 20 then
- msg2(id,"©255255255!kick ©255255000- Kick a player from the server.")
- msg2(id,"©255255255!ban ©255255000- Ban a player from the server.")
- msg2(id,"©255255255!mute ©255255000- Mute a player for a period of time.")
- msg2(id,"©255255255!speclock ©255255000- Lock someone as a spectator for a period of time.")
- msg2(id,"©255255255!pm ©255255000- Send a private message to someone in the server.")
- msg2(id,"©255255255!servermsg ©255255000- Write a message to the whole server.")
- msg2(id,"©255255255!report ©255255000- Report someone.")
- msg2(id,"©255255255!goto ©255255000- Teleport to someone else.")
- msg2(id,"©255255255!bring ©255255000- Bring another player to you.")
- msg2(id,"©255255255!tag ©255255000- Activate/Deactivate your name tag.")
- msg2(id,"©255255255!slap ©255255000- Slap someone's butt.")
- msg2(id,"©255255255!restart ©255255000- Restart the game.")
- msg2(id,"©255255255!script ©255255000- Information about the script.")
- msg2(id,"©255255255!editname ©255255000- Change someone's name.")
- msg2(id,"©255255255!check ©255255000- Check a players USGN ID, IP, rank and name.")
- msg2(id,"©255255255!playerrank ©255255000- See what rank someone is.")
- msg2(id,"©255255255F2 ©255255000- Teleport to your pointer.")
- return 1
- elseif PlayerLevel(id) == 15 then
- msg2(id,"©255255255!kick ©255255000- Kick a player from the server.")
- msg2(id,"©255255255!ban ©255255000- Ban a player from the server.")
- msg2(id,"©255255255!mute ©255255000- Mute a player for a period of time.")
- msg2(id,"©255255255!speclock ©255255000- Lock someone as a spectator for a period of time.")
- msg2(id,"©255255255!pm ©255255000- Send a private message to someone in the server.")
- msg2(id,"©255255255!report ©255255000- Report someone.")
- msg2(id,"©255255255!goto ©255255000- Teleport to someone else.")
- msg2(id,"©255255255!bring ©255255000- Bring another player to you.")
- msg2(id,"©255255255!tag ©255255000- Activate/Deactivate your name tag.")
- msg2(id,"©255255255!slap ©255255000- Slap someone's butt.")
- msg2(id,"©255255255!restart ©255255000- Restart the game.")
- msg2(id,"©255255255!script ©255255000- Information about the script.")
- msg2(id,"©255255255!editname ©255255000- Change someone's name.")
- msg2(id,"©255255255!check ©255255000- Check a players USGN ID, IP, rank and name.")
- msg2(id,"©255255255!playerrank ©255255000- See what rank someone is.")
- return 1
- elseif PlayerLevel(id) == 10 then
- msg2(id,"©255255255!mute ©255255000- Mute a player for a period of time.")
- msg2(id,"©255255255!pm ©255255000- Send a private message to someone in the server.")
- msg2(id,"©255255255!report ©255255000- Report someone.")
- msg2(id,"©255255255!tag ©255255000- Activate/Deactivate your name tag.")
- msg2(id,"©255255255!script ©255255000- Information about the script.")
- msg2(id,"©255255255!check ©255255000- Check a players USGN ID, IP, rank and name.")
- msg2(id,"©255255255!playerrank ©255255000- See what rank someone is.")
- return 1
- elseif PlayerLevel(id) == 5 then
- msg2(id,"©255255255!pm ©255255000- Send a private message to someone in the server.")
- msg2(id,"©255255255!report ©255255000- Report someone.")
- msg2(id,"©255255255!tag ©255255000- Activate/Deactivate your name tag.")
- msg2(id,"©255255255!script ©255255000- Information about the script.")
- msg2(id,"©255255255!playerrank ©255255000- See what rank someone is.")
- return 1
- elseif PlayerLevel(id) == 0 then
- msg2(id,"©255255255!pm ©255255000- Send a private message to someone in the server.")
- msg2(id,"©255255255!report ©255255000- Report someone.")
- msg2(id,"©255255255!script ©255255000- Information about the script.")
- msg2(id,"©255255255!playerrank ©255255000- See what rank someone is.")
- return 1
- end
- elseif string.sub(txt, 1, 1) == "!" then
- msg2(id,"©255125000Unknown command!")
- return 1
- elseif player_tag[id] then
- if PlayerLevel(id) == 25 then
- if player(id,"team") == 1 then
- msg("©255000000(Owner) "..player(id,"name").."©255255000: "..txt)
- return 1
- elseif player(id,"team") == 2 then
- msg("©000128255(Owner) "..player(id,"name").."©255255000: "..txt)
- return 1
- elseif player(id,"team") == 0 then
- msg("©128128128(Owner) "..player(id,"name").."©255255000: "..txt)
- return 1
- end
- elseif PlayerLevel(id) == 20 then
- if player(id,"team") == 1 then
- msg("©255000000(Admin) "..player(id,"name").."©255255000: "..txt)
- return 1
- elseif player(id,"team") == 2 then
- msg("©000128255(Admin) "..player(id,"name").."©255255000: "..txt)
- return 1
- elseif player(id,"team") == 0 then
- msg("©128128128(Admin) "..player(id,"name").."©255255000: "..txt)
- return 1
- end
- elseif PlayerLevel(id) == 15 then
- if player(id,"team") == 1 then
- msg("©255000000(Mod) "..player(id,"name").."©255255000: "..txt)
- return 1
- elseif player(id,"team") == 2 then
- msg("©000128255(Mod) "..player(id,"name").."©255255000: "..txt)
- return 1
- elseif player(id,"team") == 0 then
- msg("©128128128(Mod) "..player(id,"name").."©255255000: "..txt)
- return 1
- end
- elseif PlayerLevel(id) == 10 then
- if player(id,"team") == 1 then
- msg("©255000000(Donator) "..player(id,"name").."©255255000: "..txt)
- return 1
- elseif player(id,"team") == 2 then
- msg("©000128255(Donator) "..player(id,"name").."©255255000: "..txt)
- return 1
- elseif player(id,"team") == 0 then
- msg("©128128128(Donator) "..player(id,"name").."©255255000: "..txt)
- return 1
- end
- elseif PlayerLevel(id) == 5 then
- if player(id,"team") == 1 then
- msg("©255000000(VIP) "..player(id,"name").."©255255000: "..txt)
- return 1
- elseif player(id,"team") == 2 then
- msg("©000128255(VIP) "..player(id,"name").."©255255000: "..txt)
- return 1
- elseif player(id,"team") == 0 then
- msg("©128128128(VIP) "..player(id,"name").."©255255000: "..txt)
- return 1
- end
- end
- end
- User(id)["muted"] = false
- if os.clock - User[id]["muteEnd"] > 0 then
- User[id]["muted"] = 0
- elseif os.clock() - User[id]["speclockEnd"] > 0 then
- User[id]["speclock"] = 0
- end
- if User[id]["muted"] == true and User[id]["muteEnd"] < 0 then
- return 1
- end
- end
- addhook("team","TeamHook")
- function TeamHook(id,team)
- if User[id]["speclock"] and os.clock() - User[id]["speclockEnd"] < 0 then
- if team == 0 then
- return 0
- else
- parse("makespec "..id)
- msg2(id,"©255255255You are speclocked!")
- return 1
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement