Advertisement
Guest User

Untitled

a guest
May 26th, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.97 KB | None | 0 0
  1. if (CLIENT) then
  2.  
  3.  
  4. local midW, midH = ScrW() / 2, ScrH() / 2
  5. local function Openmotdshit()
  6. local Frame = vgui.Create( "DFrame" )
  7. Frame:SetSize( 640, 360 )
  8. Frame:SetPos(ScrW() / 2 - Frame:GetWide() / 2, ScrH() / 2 - Frame:GetTall() / 2)
  9. Frame:SetTitle( "Motd" )
  10. Frame:SetVisible( true )
  11. Frame:SetDraggable( false )
  12. Frame:ShowCloseButton( false )
  13. Frame:MakePopup()
  14.  
  15.  
  16. local Shape1 = vgui.Create( "DShape", Frame )
  17. Shape1:SetType( "Rect" ) -- This is the only type it can be
  18. Shape1:SetPos( 3.5, 25 )
  19. Shape1:SetColor( Color( 255, 250, 250, 5 ) )
  20. Shape1:SetSize( 632, 20 )
  21.  
  22.  
  23.  
  24. local Shape2 = vgui.Create( "DShape", Frame )
  25. Shape2:SetType( "Rect" ) -- This is the only type it can be
  26. Shape2:SetPos( 3.5, 50 )
  27. Shape2:SetColor( Color( 255, 250, 250, 5 ) )
  28. Shape2:SetSize( 632, 260 )
  29.  
  30.  
  31. local MyLabel = vgui.Create( "DLabel", Frame )
  32. local av = vgui.Create("AvatarImage", Frame)
  33. av:SetSize( 16, 16 )
  34. av:SetPos( 5, 27.5 )
  35. av:SetPlayer( LocalPlayer(), 32 )
  36. MyLabel:SetPos( 25, 30 )
  37. MyLabel:SetSize( 1200, 10 )
  38. MyLabel:SetTextColor( Color( 0, 191, 255 ) )
  39. MyLabel:SetText( "Welcome to the server" .. " " .. LocalPlayer():Name() .. "!" )
  40.  
  41. local MyButton = vgui.Create( "DButton", Frame )
  42. MyButton:SetPos( 7, 325 )
  43. MyButton:SetTextColor( Color( 0, 51, 25 ))
  44. MyButton:SetText( "Accept" )
  45. MyButton:SetSize( 120, 30 )
  46. MyButton.DoClick = function()
  47.     print( LocalPlayer():Nick() .. " Has accepted the rules" )
  48.             net.Start( "motdaccept" )
  49.             net.SendToServer()
  50.             Frame:Close()
  51. end
  52.  
  53. local MyButton = vgui.Create( "DButton", Frame )
  54. MyButton:SetPos( 512, 325 )
  55. MyButton:SetTextColor( Color( 102, 0, 0 ))
  56. MyButton:SetText( "Decline" )
  57. MyButton:SetSize( 120, 30 )
  58. MyButton.DoClick = function()
  59.     print( LocalPlayer():Nick() .. " Has declined the rules" )
  60.     net.Start( "motddecline" )
  61.     net.SendToServer()
  62.     Frame:Close()
  63. end
  64.  
  65.  
  66. Frame.Paint = function()
  67.     draw.RoundedBox( 8, 0, 0, Frame:GetWide(), Frame:GetTall(), Color( 0, 153, 153, 150 ) )
  68. end
  69. Shape1.Paint = function()
  70.     draw.RoundedBox( 4, 0, 0, Shape1:GetWide(), Shape1:GetTall(), Color( 255, 250, 250, 255) )
  71. end
  72. Shape2.Paint = function()
  73.     draw.RoundedBox( 4, 0, 0, Shape2:GetWide(), Shape2:GetTall(), Color( 255, 250, 250, 255) )
  74. end
  75.  
  76. end
  77.     concommand.Add( "openmotd", Openmotdshit )
  78.  
  79.  
  80.  
  81.     return
  82. end
  83.  
  84.  
  85. if (SERVER) then
  86.     AddCSLuaFile()
  87.  
  88.  
  89. function playspawn( ply )
  90.     ply:PrintMessage( HUD_PRINTTALK, ply:Nick() .. "," .. " " .. "is now alive!" )
  91. end
  92. hook.Add( "PlayerSpawn", "spawning", playspawn )
  93.  
  94. function death( ply )
  95.         ply:PrintMessage( HUD_PRINTTALK, ply:Nick() .. "," .. " " .. " has died!" )
  96. end
  97. hook.Add( "PlayerDeath", "dying", death )
  98.  
  99. function motdopenjoin( ply )
  100.     ply:ConCommand( "openmotd" )
  101. end
  102. hook.Add ( "PlayerInitialSpawn", "openmotd", motdopenjoin )
  103.  
  104.     util.AddNetworkString( "motddecline" )
  105.     net.Receive( "motddecline", function( len, ply )
  106.         ply:Kick( "Bye!" )
  107.     end )
  108.  
  109.     util.AddNetworkString( "motdaccept" )
  110.     net.Receive( "motdaccept", function( ply )
  111.     end )
  112.  
  113. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement