What's the best way to display a serverside variable in a clientside hudpaint hook?
3 replies, posted
Hello. In a deathmatch gamemode I'm creating I need to display the amount of kills a certain team has... problem is, the variable that shows these kills is serverside.... would I create a shared variable that's value is the serverside variable and use the shared variable in my cl_init script or would I send a net message from the client to the server, containing this variable or vice versa(that might not be a good idea to send a net message every frame, or would it be?), or would I just need to do something else I haven't thought of yet?
[QUOTE=sneakyloz;47841200][url]http://gmodwiki.net/Lua/Global/SetGlobalVar[/url][/QUOTE]
SetGlobalVar results in more data being sent to the client, use the type specific versions.
[editline]30th May 2015[/editline]
There's also this function for getting the amount of kills a team has, [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/team/TotalFrags]team.TotalFrags[/url]
[QUOTE=A Fghtr Pilot;47840292]send a net message from the client to the server, containing this variable or vice versa(that might not be a good idea to send a net message [B]every frame[/B], or would it be?), or would I just need to do something else I haven't thought of yet?[/QUOTE]
Not necessarily every frame, you could make a net channel and make the server increment the clientside variable when a kill is made (hook).
Sorry, you need to Log In to post a reply to this thread.