From 6f6a6de54bf7a7562ca374a0f30ac854877dbea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9rez-Cerezo?= Date: Sat, 25 Jun 2016 15:09:48 +0200 Subject: Now reads accounts before showing formspec --- init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 5839ce9..ef2e776 100644 --- a/init.lua +++ b/init.lua @@ -2,6 +2,7 @@ atm = {} atm.balance = {} function atm.showform (player) + atm.readaccounts() if not atm.balance[player:get_player_name()] then atm.balance[player:get_player_name()] = 0 end @@ -167,10 +168,10 @@ minetest.register_on_player_receive_fields(function(player, form, pressed) else atm.balance[n] = atm.balance[n] + amount end + atm.saveaccounts() if not pressed.Quit then atm.showform(player) end - atm.saveaccounts() end end) -- cgit v1.2.3