• Help please
    2 replies, posted
surface.CreateFont("hud12", { size = 25, weight = 350, antialias = true, extended = true, font = "Roboto"})       local ply = LocalPlayer() local x,y = ScrW(), ScrH() if ply:Team() == TEAM_RUK then local f = vgui.Create("DFrame") f:SetSize(400,200) f:MakePopup() f:Center() f.Paint = function(s,w,h) draw.RoundedBox(0,0,0,w,h,Color(0,0,0,180)) draw.SimpleTextOutlined("Напишите объявление", "hud12",w/2,25,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER,1,Color(0,0,0)) end local t = vgui.Create("DTextEntry",f) t:SetSize(f:GetWide() -10, 25) t:SetPos(5,50) t.OnEnter = function() net.Start("obiava") net.WriteUInt( t:GetValue(), 8 ) for k,v in pairs(player.GetAll()) do net.Send(v) end end end net.Receive("obiava", function() hook.Add("HUDPaint", "HudXuy",function() local z = 0 if z > ScrW() then z=-ScrW() else z = z + 1 end local text = net.ReadUInt( 8 ) draw.RoundedBox(0,0,0,ScrW(),35,Color(60,60,60,255)) draw.RoundedBox(0,0,0,320,35,Color(0,180,255,255)) draw.SimpleTextOutlined(t:GetText(), "hud12", 320+z, 5, Color(255,255,255),0,0,1,Color(0,0,0)) draw.SimpleTextOutlined("Объявление Главы Комплекса:"..text, "hud12", 5, 5, Color(255,255,255),0,0,1,Color(0,0,0)) end) end) What is the problem? help me please [ERROR] RunString:25: bad argument #1 to 'WriteUInt' (number expected, got string)   1. WriteUInt - [C]:-1    2. OnEnter - RunString:25     3. unknown - lua/vgui/dtextentry.lua:79
if all this code in the same file , why you networking in the same file ?
This guys lives in year 3000 net.Start("obiava") net.WriteUInt( t:GetValue(), 8 ) for k,v in pairs(player.GetAll()) do net.Send(v) end First at all, that's not how this works at all! net.WriteUInt requires a number, not a text, even if you write "40" in your textentry, it's still a string, not a number, you need to manually check that you're introducing a number by doing if tonumber(t:GetValue()) then Then you can send that, after that I have no idea at all what are you trying to achieve, but you can't send a net message from client to all players, you need to send that message to server with net.SendToServer() and then receiving it and sending it back again to all clients with net.Broadcast() or net.SendOmit(player_who_sent_the_message) Then we have this net.Receive("obiava", function() hook.Add("HUDPaint", "HudXuy",function() local z = 0 if z > ScrW() then z=-ScrW() else z = z + 1 end local text = net.ReadUInt( 8 ) draw.RoundedBox(0,0,0,ScrW(),35,Color(60,60,60,255)) draw.RoundedBox(0,0,0,320,35,Color(0,180,255,255)) draw.SimpleTextOutlined(t:GetText(), "hud12", 320+z, 5, Color(255,255,255),0,0,1,Color(0,0,0)) draw.SimpleTextOutlined("Объявление Главы Комплекса:"..text, "hud12", 5, 5, Color(255,255,255),0,0,1,Color(0,0,0)) end) end) You're creating a hud paint hook...What a damn minute, local text = net.ReadUInt()????? Are you even understanding what the function does? Oh my god, every line i read after that it gets worse and worse You're doing t:GetText()??? Why, it's not networked on all players, also t it's not guaranteed to be always valid...I really recommend you to slow down the features you're trying to create, you need a better understanding on hooks and net messages, even more about how functions works
Sorry, you need to Log In to post a reply to this thread.