diff options
author | cheapie <no-email-for-you@example.com> | 2016-05-18 00:00:03 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2016-05-18 00:00:03 -0500 |
commit | 490f4185c1b0634d5da678f76bde1b454030b4a7 (patch) | |
tree | 1a0982f733dfcb3110d3302c22c99388b9439b30 | |
parent | 2557f7f590f0e2b9a93b777d33c6198b5f279a89 (diff) | |
download | newplayer-490f4185c1b0634d5da678f76bde1b454030b4a7.tar newplayer-490f4185c1b0634d5da678f76bde1b454030b4a7.tar.gz newplayer-490f4185c1b0634d5da678f76bde1b454030b4a7.tar.bz2 newplayer-490f4185c1b0634d5da678f76bde1b454030b4a7.tar.xz newplayer-490f4185c1b0634d5da678f76bde1b454030b4a7.zip |
Hide the keyword for players that have interact but not server, and don't reopen the form on esc
-rw-r--r-- | init.lua | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -20,9 +20,14 @@ function newplayer.showrulesform(name) else newplayer.rules_subbed = newplayer.rules end + if newplayer.keyword and minetest.check_player_privs(name,{interact=true}) and not minetest.check_player_privs(name,{server=true}) then + newplayer.rules_subbed_interact = string.gsub(newplayer.rules,"@KEYWORD",minetest.formspec_escape("[Hidden because you already have interact]")) + else + newplayer.rules_subbed_interact = newplayer.rules + end local form_interact = "size[8,10]".. "label[0,0;Server Rules]".. - "textarea[0.25,1;8,7;rules;;"..newplayer.rules.."]" + "textarea[0.25,1;8,7;rules;;"..newplayer.rules_subbed_interact.."]" local form_nointeract = "size[8,10]".. "label[0,0;Server Rules]".. "textarea[0.25,1;8,7;rules;;"..newplayer.rules_subbed.."]".. @@ -70,9 +75,7 @@ end) minetest.register_on_player_receive_fields(function(player,formname,fields) local name = player:get_player_name() if formname == "newplayer:rules_nointeract" then - if fields.quit then - newplayer.showrulesform(name) - elseif fields.yes then + if fields.yes then if not newplayer.keyword or string.lower(fields.keyword) == string.lower(newplayer.keyword) then local privs = minetest.get_player_privs(name) privs.interact = true |