Set player privs correctly
Before this commit, you loose all the previous privs and get only interact when push the Ok button. Also the 'true' in ‘return true’ makes the other register_on_player_receive_fields unusable (for example, the inventory form).
This commit is contained in:
parent
820493bf27
commit
6c554b8def
@ -53,13 +53,15 @@ end
|
|||||||
minetest.register_on_player_receive_fields(
|
minetest.register_on_player_receive_fields(
|
||||||
function(player, form_name, fields)
|
function(player, form_name, fields)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
local privs = minetest.get_player_privs(name)
|
||||||
|
|
||||||
if minetest.check_player_privs(name, {interact = true}) or fields.rules then
|
if privs.interact or fields.rules then
|
||||||
return true
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields.accept_rules then
|
if fields.accept_rules then
|
||||||
minetest.set_player_privs(name, {interact = true})
|
privs.interact = true
|
||||||
|
minetest.set_player_privs(name, privs)
|
||||||
minetest.chat_send_player(name, "You now have interact, follow the rules and have fun!")
|
minetest.chat_send_player(name, "You now have interact, follow the rules and have fun!")
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, "If you want to interact, please read and accept the rules. Type /welcome to show rules.")
|
minetest.chat_send_player(name, "If you want to interact, please read and accept the rules. Type /welcome to show rules.")
|
||||||
|
Loading…
Reference in New Issue
Block a user