Guest User

sv_admin.lua

a guest
Jul 17th, 2013
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. // PLEASE EDIT THIS FOR YOUR SERVER!
  2. local SuperAdmins = {
  3. /*"STEAMID", NAME
  4. "STEAMID", NAME*/
  5. }
  6.  
  7. local Admins = {
  8. // PLEASE EDIT
  9. }
  10.  
  11. hook.Add( "PlayerInitialSpawn", "AuthAdmin", function( ply )
  12.  
  13. if table.HasValue( SuperAdmins, ply:SteamID() ) then
  14. ply:SetUserGroup( "superadmin" )
  15. end
  16.  
  17. if table.HasValue( Admins, ply:SteamID() ) then
  18. ply:SetUserGroup( "admin" )
  19. end
  20.  
  21. end )
  22.  
  23. concommand.Add( "cinema_runlua", function( ply, cmd, args )
  24.  
  25. if !ply:IsSuperAdmin() then return end
  26.  
  27. local lua = table.concat( args, " " )
  28.  
  29. RunString( "function CinemaRunLua() end" ) // clear out the last function, incase the new code is invalid
  30. RunString( "function CinemaRunLua() " .. lua .. " end " )
  31.  
  32. status, err = pcall( CinemaRunLua )
  33.  
  34. if !status then
  35. ply:PrintMessage( HUD_PRINTCONSOLE, "Lua error: " .. err .. "\n" )
  36. end
  37.  
  38. end )
  39.  
  40. concommand.Add( "cinema_rcon", function( ply, cmd, args )
  41.  
  42. if !ply:IsSuperAdmin() then return end
  43.  
  44. if #args == 0 then
  45. ply:PrintMessage( HUD_PRINTCONSOLE, "No commands specified.\n" )
  46. return
  47. end
  48.  
  49. local cmd = args[ 1 ]
  50. local args = table.concat( args, " ", 2 )
  51.  
  52. RunConsoleCommand( cmd, args )
  53.  
  54. end )
  55.  
  56. concommand.Add( "cinema_changelevel", function( ply, cmd, args )
  57.  
  58. if ply == NULL or ply:IsSuperAdmin() then
  59.  
  60. local map = args[1]
  61.  
  62. if map == nil then
  63. map = game.GetMap()
  64. elseif type( map ) != "string" then
  65. return
  66. end
  67.  
  68. local MapName = string.lower( tostring( map ) )
  69. local FilePlace = "../maps/" .. string.Trim( MapName ) .. ".bsp"
  70.  
  71. ply:PrintMessage( HUD_PRINTCONSOLE, "Starting process to change map to: " .. MapName .. "\n" )
  72.  
  73. if file.Exists( FilePlace, "GAME" ) == false then
  74. ply:PrintMessage( HUD_PRINTCONSOLE, "Map " .. MapName .. " does not exist!\n" )
  75. return
  76. end
  77.  
  78. for k,v in ipairs( player.GetAll() ) do
  79. v:ChatPrint( "Changing level to " .. MapName )
  80. end
  81.  
  82. // Finally, change level!
  83. timer.Simple( 2, function()
  84. RunConsoleCommand( "changelevel", MapName )
  85. end )
  86.  
  87. end
  88.  
  89. end )
Advertisement
Add Comment
Please, Sign In to add comment