Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.87 KB | None | 0 0
  1. --Vote Force Boss--
  2.  
  3. function ulx.forceboss( calling_ply, target_plys )
  4.     local affected_plys = {}
  5.  
  6.     for i=1, #target_plys do
  7.         local v = target_plys[ i ]
  8.  
  9.         if v:IsFrozen() then
  10.             ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true )
  11.         elseif v:Team() == TEAM_HUMAN then
  12.             ULib.tsayError( calling_ply, v:Nick() .. " is a human!", true )
  13.         else
  14.             GAMEMODE:SpawnBossZombie(v)
  15.             table.insert( affected_plys, v )
  16.         end
  17.     end
  18.  
  19.     ulx.fancyLogAdmin( calling_ply, "#A forced #T to be boss.", affected_plys )
  20. end
  21. local forceboss = ulx.command( CATEGORY_NAME, "ulx forceboss", ulx.forceboss, "!forceboss" )
  22. forceboss:addParam{ type=ULib.cmds.PlayersArg }
  23. forceboss:defaultAccess(ULib.ACCESS_ALL)
  24. forceboss:help( "Sets target(s) as boss." )
  25.  
  26. function ulx.voteboss( calling_ply, target_ply, reason )
  27.     if ulx.voteInProgress then
  28.         ULib.tsayError( calling_ply, "There is already a vote in progress. Please wait for the current one to end.", true )
  29.         return
  30.     end
  31.  
  32.     local msg = "Boss " .. target_ply:Nick() .. "?"
  33.     if reason and reason ~= "" then
  34.         msg = msg .. " (" .. reason .. ")"
  35.     end
  36.  
  37.     ulx.doVote( msg, { "Yes", "No" }, voteBossDone, _, _, _, target_ply, calling_ply )
  38.     if reason and reason ~= "" then
  39.         ulx.fancyLogAdmin( calling_ply, "#A started a voteboss for #T (#s)", target_ply )
  40.     else
  41.         ulx.fancyLogAdmin( calling_ply, "#A started a voteboss for #T", target_ply )
  42.     end
  43. end
  44. local votekick = ulx.command( CATEGORY_NAME, "ulx voteboss", ulx.voteboss, "!voteboss" )
  45. votekick:addParam{ type=ULib.cmds.PlayerArg }
  46. votekick:defaultAccess( ULib.ACCESS_ADMIN )
  47. votekick:help( "Starts a public vote for a forceboss." )
  48. if SERVER then ulx.convar( "votekickSuccessratio", "0.6", _, ULib.ACCESS_ADMIN ) end -- The ratio needed for a votekick to succeed
  49. if SERVER then ulx.convar( "votekickMinvotes", "2", _, ULib.ACCESS_ADMIN ) end -- Minimum votes needed for votekick
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement