I want to be able to select a class from a client-side vgui, store the choice in the player meta-table and set class server-side, but NWInt doesn't network if set client-side and SetVar doesn't seem to network at all. They print the value client-side but prints the fallback value server-side.
function combobox:OnSelect(index,value,data)
ply = LocalPlayer()
ply:SetVar("Class",index)
print("CLASS: "..ply:GetVar("Class"))
end
I don't think the net library will help in this situation since I'm using a for-loop to set classes. Is there any good solution for this, or alternative method?
for k,v in pairs(team.GetPlayers(0)) do
local charClass = v:GetVar("Class",3)
v:SetClass(charClass)
v:GiveClassWeapons(charClass)
print("CHARCLASS: "..tostring(charClass))
end
Wiki has a note on each page related to SetNW* functions: Running this function clientside will only set it for the client it is called on.
You have to use net library, something like this should work: Pastebin (still waiting for code tag fix)
Thank you! It seems to work for me but I'll report back when I get some of my friends on to test it
Sorry, you need to Log In to post a reply to this thread.