Community Forum

LUA - Sending server data to players which they do not have

Forum Overview >> Scripting

Created28.09.2017 22:32

Tim (sliv) (Unknown) 28.09.2017 22:32
This mod displays the total money on the server to connected players just underneath their own money amount.

The first revision seemed to work, but when a player first connects, they don't receive an update to their displayed "server money" amount until they take an action that costs the server money amount to change (like refill fuel). I tried to look at HonkEvent in the modding handbook but I couldn't get it to work, then I noticed the official GDN doc for HonkEvent was different than the handbook, so revision 2 is based on that, but I can't seem to get it to work so far.

I'm trying to figure out what I'm doing wrong, and having difficulty coming up with the right way to send the value of the server money to the player when they connect before they do anything, and make sure it keeps updating their display as the server money changes throughout the session. (I'm really guessing at how this works after googling around and looking at LUA code from mods like Glance and ExternalAccount).

(all the conditions for prints are just me trying to figure out what does what and of course will be removed in the end)

Tim (sliv) (Unknown) 30.09.2017 05:01
The latest gist link above now shows a working prototype for this mod :) More testing to be done, now :)

Note: Log in to post. Create a new account here.