Hello
I am not really new to Lua but i just can't get it to work, my code is like this
local SpawnNumber = vgui.Create("DNumSlider")
SpawnNumber:Dock(FILL)
SpawnNumber:SetText( "How many times" )
SpawnNumber:SetMin( 0 )
SpawnNumber:SetMax( 512 )
SpawnNumber:SetDecimals( 0 )
SpawnNumber.OnValueChanged = function(panel, value)
net.Start("ValueSelectedDropper")
net.WriteInt(value)
net.SendToServer()
end
this just says number expected got no value
but this
SpawnNumber.OnValueChanged = function(panel, value)
net.Start("ValueSelectedDropper")
net.WriteInt(SpawnNumber:GetValue())
net.SendToServer()
end
aswell says number expected, got no value
What am I doing wrong?
I think i am fucking dumb...
If you still need help, do
net.Start( "ValueSelectedDropper" )
net.WriteInt( value, 32 )
net.SendToServer()
and, when you're receiving the int, do
net.ReadInt( 32 )
Yeah I've seen in the Documentation, haven't ever looked into the Documentation to WriteInt before so i didnt knew
you dont need to go as high as 32, for 0 to 512 you can use 11
I know, i have read the documentation now^^
32 saves a lot of time and effort
Sorry, you need to Log In to post a reply to this thread.