• Sending a table to client and waiting for it to be recieved?
    2 replies, posted
I'm trying to work on a 'bounty hunter'-esque system for DarkRP, and want to make it where when the client opens the F4 menu (by hitting F4) if they're a certain team, wait for a table to be gotten, and populate data from it into a derma gui. In a hook triggered by opening the DarkRP F4 menu I send a net message requesting the server to send the table. My problem is that I need the gui to either update or wait on receiving the table from the server. Is there an easier way to do this rather than sending it with net messages? This is in the client hook. Outside of it there is a net.recieve waiting for the server to just send the table back and setting it to a variable for the client. hook.Add("F4MenuTabs","BountyTab", function() if(LocalPlayer():Team()!=TEAM_HITMAN) then DarkRP.removeF4MenuTab("Bounties") return end net.Start("requestServer") net.SendToServer() bountyTab() DarkRP.addF4MenuTab("Bounties",PANEL.pan) end)
What you'd want to do it make sure you keep a reference to the panel object (PANEL.pan). Create a net receiver for the server's response outside of the hook you posted, and if the panel object is still valid, populate it.
Typically you would cache these sorts of things, meaning send it to the client beforehand so it's already on hand for when the menu is opened. But that is not easier than what you're currently doing and this can depend on what the table is for, how much data there is etc.
Sorry, you need to Log In to post a reply to this thread.