Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (CLIENT) then
- local midW, midH = ScrW() / 2, ScrH() / 2
- local function Openmotdshit()
- local Frame = vgui.Create( "DFrame" )
- Frame:SetSize( 640, 360 )
- Frame:SetPos(ScrW() / 2 - Frame:GetWide() / 2, ScrH() / 2 - Frame:GetTall() / 2)
- Frame:SetTitle( "Motd" )
- Frame:SetVisible( true )
- Frame:SetDraggable( false )
- Frame:ShowCloseButton( false )
- Frame:MakePopup()
- local Shape1 = vgui.Create( "DShape", Frame )
- Shape1:SetType( "Rect" ) -- This is the only type it can be
- Shape1:SetPos( 3.5, 25 )
- Shape1:SetColor( Color( 255, 250, 250, 5 ) )
- Shape1:SetSize( 632, 20 )
- local Shape2 = vgui.Create( "DShape", Frame )
- Shape2:SetType( "Rect" ) -- This is the only type it can be
- Shape2:SetPos( 3.5, 50 )
- Shape2:SetColor( Color( 255, 250, 250, 5 ) )
- Shape2:SetSize( 632, 260 )
- local MyLabel = vgui.Create( "DLabel", Frame )
- local av = vgui.Create("AvatarImage", Frame)
- av:SetSize( 16, 16 )
- av:SetPos( 5, 27.5 )
- av:SetPlayer( LocalPlayer(), 32 )
- MyLabel:SetPos( 25, 30 )
- MyLabel:SetSize( 1200, 10 )
- MyLabel:SetTextColor( Color( 0, 191, 255 ) )
- MyLabel:SetText( "Welcome to the server" .. " " .. LocalPlayer():Name() .. "!" )
- local MyButton = vgui.Create( "DButton", Frame )
- MyButton:SetPos( 7, 325 )
- MyButton:SetTextColor( Color( 0, 51, 25 ))
- MyButton:SetText( "Accept" )
- MyButton:SetSize( 120, 30 )
- MyButton.DoClick = function()
- print( LocalPlayer():Nick() .. " Has accepted the rules" )
- net.Start( "motdaccept" )
- net.SendToServer()
- Frame:Close()
- end
- local MyButton = vgui.Create( "DButton", Frame )
- MyButton:SetPos( 512, 325 )
- MyButton:SetTextColor( Color( 102, 0, 0 ))
- MyButton:SetText( "Decline" )
- MyButton:SetSize( 120, 30 )
- MyButton.DoClick = function()
- print( LocalPlayer():Nick() .. " Has declined the rules" )
- net.Start( "motddecline" )
- net.SendToServer()
- Frame:Close()
- end
- Frame.Paint = function()
- draw.RoundedBox( 8, 0, 0, Frame:GetWide(), Frame:GetTall(), Color( 0, 153, 153, 150 ) )
- end
- Shape1.Paint = function()
- draw.RoundedBox( 4, 0, 0, Shape1:GetWide(), Shape1:GetTall(), Color( 255, 250, 250, 255) )
- end
- Shape2.Paint = function()
- draw.RoundedBox( 4, 0, 0, Shape2:GetWide(), Shape2:GetTall(), Color( 255, 250, 250, 255) )
- end
- end
- concommand.Add( "openmotd", Openmotdshit )
- return
- end
- if (SERVER) then
- AddCSLuaFile()
- function playspawn( ply )
- ply:PrintMessage( HUD_PRINTTALK, ply:Nick() .. "," .. " " .. "is now alive!" )
- end
- hook.Add( "PlayerSpawn", "spawning", playspawn )
- function death( ply )
- ply:PrintMessage( HUD_PRINTTALK, ply:Nick() .. "," .. " " .. " has died!" )
- end
- hook.Add( "PlayerDeath", "dying", death )
- function motdopenjoin( ply )
- ply:ConCommand( "openmotd" )
- end
- hook.Add ( "PlayerInitialSpawn", "openmotd", motdopenjoin )
- util.AddNetworkString( "motddecline" )
- net.Receive( "motddecline", function( len, ply )
- ply:Kick( "Bye!" )
- end )
- util.AddNetworkString( "motdaccept" )
- net.Receive( "motdaccept", function( ply )
- end )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement