So iv been just work so f***ing hard on doing something so simple and iv only got one thing working using net library.
This is the code that im trying to put into net.
concommand.Add( "1server_1", function( ply, cmd, args )
if (ply == LocalPlayer() and groups[ LocalPlayer():GetUserGroup() ] ) then
local SMSG = vgui.Create( "DFrame" )
SMSG:SetSize( 249, 186 )
SMSG:Center()
SMSG:MakePopup()
SMSG:SetTitle( "Post an Announcment!" )
SMSG:SetBackgroundBlur( true )
SMSG:SetPaintShadow( true )
--SMSG:SetBackgroundColor( BGPanColor )
local SERVERNAME = vgui.Create( "DTextEntry", SMSG )
SERVERNAME:SetPos( 18, 45 )
SERVERNAME:SetSize( 211, 26 )
SERVERNAME:SetText( "CommunityName" )
SERVERNAME:SetEditable ( true )
local MESSAG = vgui.Create( "DTextEntry", SMSG )
MESSAG:SetPos( 18, 90 )
MESSAG:SetSize( 211, 26 )
MESSAG:SetText( "Type out a server message here" )
MESSAG:SetEditable ( true )
MESSAG.OnEnter = function( self )
timer.Create('advert1', 1, 1, function()
chat.AddText( servercommuntiycolor, '[', servercommuntiycolor, SERVERNAME:GetValue(), ']', messagecolor, ' ', messagecolor, self:GetValue() )
end)
end
end
end)
Here is the snip it iv done so far that works but I am not sure if it will send to all clients. Not the local client.
Client Side
net.Receive( 'battlestat', function()
surface.PlaySound( "battle_stations.wav" )
chat.AddText(servercommuntiycolor, '[ATTENTION] ', messagecolor, 'Everyone to your battle stations!')
end)
Server Side
util.AddNetworkString( 'battlestat' )
concommand.Add( "battle_stations", function( ply, cmd )
net.Start( 'battlestat' )
net.Send( ply )
net.Broadcast()
end)
Any help on making both of these send to all of the players?