Prevent cheating restart_gift
This commit is contained in:
parent
d7355a984a
commit
bcc1c7954a
@ -1,5 +1,6 @@
|
||||
local can_gift = true
|
||||
local GIFT_AMOUNT = 50
|
||||
local gifted = {}
|
||||
|
||||
minetest.after(60, function() can_gift = false end)
|
||||
|
||||
@ -9,6 +10,8 @@ minetest.register_on_joinplayer(function(player)
|
||||
local main, match = ctf_stats.player(pname)
|
||||
|
||||
if main and match then
|
||||
if gifted[pname] then GIFT_AMOUNT = -50 end
|
||||
|
||||
main.score = main.score + GIFT_AMOUNT
|
||||
match.score = match.score + GIFT_AMOUNT
|
||||
|
||||
@ -19,6 +22,14 @@ minetest.register_on_joinplayer(function(player)
|
||||
color = 0xc000cd,
|
||||
value = GIFT_AMOUNT
|
||||
})
|
||||
|
||||
if gifted[pname] then
|
||||
GIFT_AMOUNT = -50
|
||||
minetest.chat_send_player(pname, "No reward for the greedy.")
|
||||
return
|
||||
else
|
||||
gifted[pname] = true
|
||||
end
|
||||
end
|
||||
|
||||
minetest.chat_send_player(pname, "Thanks for staying with us through that restart!")
|
||||
|
Loading…
x
Reference in New Issue
Block a user