Advertisement
Guest User

Untitled

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