I'm trying to have users send tickets for assistance and then the admins will be able to see the ticket in their admin panels via DListView and assist the user. However, My DListView is not updating and i cannot figure it out.
init.lua
net.Receive("ticket", function(len,ply)
filter = RecipientFilter()
for k,v in pairs(player.GetAll()) do
if v:IsAdmin() then
filter:AddPlayer(v)
end
end
local players = filter:GetPlayers()
PrintTable(players)
net.Start("SndB")
net.WriteEntity(ply)
net.WriteTable(filter:GetPlayers())
net.WriteString(net.ReadString())
net.Send(filter:GetPlayers())
end)
cl_init.lua
function Refreshlist()
for k,v in ipairs(table) do
if (v == LocalPlayer() or IsValid(LocalPlayer(v))) then
print(v)
list:Clear()
if (IsValid(entity)) then
list:AddLine(entity:Nick(),string,"Open")
end
end
end
end
net.Receive("SndB", function()
print("Received SndB net message from server.")
local table = net.ReadTable()
local entity = net.ReadEntity()
local string = net.ReadString()
if (IsValid(frame55)) then
Refreshlist()
frame55:Show()
else
AdminGUI()
end
end)
Any assistance would be appreciated!
use Panel/Refresh
You're looping through the global 'table' instead of the table you sent from the server.
Even removing the local table = net.ReadTable() from cl_init.lua doesn't solve the issue. The only individuals receiving the ticket clientside are Superadmins(me) from the server.
That's because you're only adding admins to the filter. You also need to read in the same order you write.
Should i be doing net.Broadcast() or net.Send()(with no table of players?)
Depends on what you're trying to do. Read what the functions do on the gmod wiki and decide after that.
Sorry, you need to Log In to post a reply to this thread.