Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local CATEGORY_NAME = "Owen Custom"
- print(TEAM_HUNTERS)
- --------------------Rock The Vote--------------------
- RTV = RTV or {}
- RTV.ChatCommands = {
- "!rtv",
- "/rtv",
- "rtv"
- }
- RTV.PlayerCount = 3
- RTV.TotalVotes = 0
- RTV.Wait = 90 -- The wait time in seconds. This is how long a player has to wait before voting when the map changes.
- -- If the "extend" option is picked, you have to wait double this before voting again.
- RTV._ActualWait = CurTime() + RTV.Wait
- function RTV.ShouldChange()
- return RTV.TotalVotes >= math.Round(#player.GetAll()*0.66)
- end
- function RTV.RemoveVote()
- RTV.TotalVotes = math.Clamp( RTV.TotalVotes - 1, 0, math.huge )
- end
- function RTV.Start()
- MapVote.Start(voteLength, allowCurrentMap, mapLimit, mapPrefix)
- end
- function RTV.AddVote( ply )
- if RTV.CanVote( ply ) then
- RTV.TotalVotes = RTV.TotalVotes + 1
- ply.RTVoted = true
- MsgN( ply:Nick().." has voted to Rock the Vote." )
- PrintMessage( HUD_PRINTTALK, ply:Nick().." has voted to Rock the Vote. ("..RTV.TotalVotes.."/"..math.Round(#player.GetAll()*0.66)..")" )
- if RTV.ShouldChange() then
- RTV.Start()
- end
- end
- end
- hook.Add( "PlayerDisconnected", "Remove RTV", function( ply )
- if ply.RTVoted then
- RTV.RemoveVote()
- end
- timer.Simple( 0.1, function()
- if RTV.ShouldChange() then
- RTV.Start()
- end
- end )
- end )
- function RTV.CanVote( ply )
- local plyCount = table.Count(player.GetAll())
- if RTV._ActualWait >= CurTime() then
- return false, "You must wait a bit before voting!"
- end
- if GetGlobalBool( "In_Voting" ) then
- return false, "There is currently a vote in progress!"
- end
- if ply.RTVoted then
- return false, "You have already voted to Rock the Vote!"
- end
- if RTV.ChangingMaps then
- return false, "There has already been a vote, the map is going to change!"
- end
- if plyCount < RTV.PlayerCount then
- return false, "You need more players before you can rock the vote!"
- end
- return true
- end
- function RTV.StartVote( ply )
- local can, err = RTV.CanVote(ply)
- if not can then
- ply:PrintMessage( HUD_PRINTTALK, err )
- return
- end
- RTV.AddVote( ply )
- end
- concommand.Add( "rtv_start", RTV.StartVote )
- hook.Add( "PlayerSay", "RTV Chat Commands", function( ply, text )
- if table.HasValue( RTV.ChatCommands, string.lower(text) ) then
- RTV.StartVote( ply )
- return ""
- end
- end )
- --------------------Unstuck--------------------
- function ulx.unstuck( calling_ply )
- if calling_ply:alive() then
- calling_ply:spawn()
- else
- ULib.tsayError( calling_ply, calling_ply:Nick() .. "You Are Dead!" )
- end
- ulx.fancyLogAdmin( calling_ply, "#A Has Used !unstuck", calling_ply )
- end
- local unstuck = ulx.command ( CATEGORY_NAME, "ulx unstuck", ulx.unstuck, "!unstuck" )
- unstuck:defaultAccess( ULib.ACCESS_ALL )
- unstuck:help( "Teleports A User To Spawn" )
- --------------------Afk--------------------
- function ulx.afk( calling_ply, target_plys )
- if target_plys:Team() == TEAM_HUNTERS then
- target_plys:Kill()
- target_plys:SetTeam(TEAM_SPECTATORS)
- elseif target_plys:Team() == TEAM_PROPS then
- target_plys:Kill()
- target_plys:SetTeam(TEAM_SPECTATORS)
- end
- ulx.fancyLogAdmin( calling_ply, "#A has moved #T to spectator.", target_plys )
- end
- local afk = ulx.command(CATEGORY_NAME, "ulx afk", ulx.afk "!afk" )
- afk:addParam{ type=ULib.cmds.PlayersArg }
- afk:defaultAccess( ULib.ACCESS_ADMIN )
- afk:help ( "Moves A Player To Spectator" )
- --------------------Force Swap--------------------
- function ulx.forceswap( calling_ply, target_plys )
- if target_plys:Team() == TEAM_HUNTERS then
- target_plys:Kill()
- target_plys:SetTeam(TEAM_PROPS)
- elseif
- target_plys:Team() == TEAM_PROPS then
- target_plys:Kill()
- target_plys:SetTeam(TEAM_HUNTERS)
- end
- ulx.fancyLogAdmin( calling_ply, "#A has forceswapped #T", target_plys )
- end
- local forceswap = ulx.command(CATEGORY_NAME, "ulx forceswap", ulx.forceswap "!forceswap" )
- forceswap:addParam{ type=ULib.cmds.PlayersArg }
- forceswap:defaultAccess( ULib.ACCESS_ADMIN )
- forceswap:help ( "Force Swaps A Player To The Opposite Team" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement