second commit
This commit is contained in:
20
init.lua
20
init.lua
@@ -42,7 +42,7 @@ bounty.save = function()
|
||||
data_file:write(data_stri)
|
||||
data_file:close()
|
||||
else
|
||||
print('[bounty] Could not open ' .. bounty.file .. ' with write permission')
|
||||
core.log('error', '[bounty] Could not open ' .. bounty.file .. ' with write permission')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -99,14 +99,14 @@ end
|
||||
bounty.drop_prize = function(player)
|
||||
local player_name = player:get_player_name()
|
||||
local prize = bounty.get_player_bounty(player_name)
|
||||
print(prize)
|
||||
core.item_drop(prize, player, player:getpos())
|
||||
print(prize)
|
||||
core.log('info', prize)
|
||||
core.item_drop(ItemStack(prize), player, player:get_pos())
|
||||
core.log('info', prize)
|
||||
bounty.penalize(player_name)
|
||||
end
|
||||
|
||||
bounty.get_player_bounty = function(player_name)
|
||||
prize = ' has griefed a little bit'
|
||||
local prize = ' has griefed a little bit'
|
||||
if type(bounty.prizes) == 'string' then
|
||||
local amount = math.floor(bounty.data[player_name] / bounty.points_per_prize)
|
||||
if bounty.data[player_name] >= bounty.points_per_prize then
|
||||
@@ -127,25 +127,25 @@ end
|
||||
--chatcommands for testing purposes
|
||||
core.register_chatcommand('bounty', {
|
||||
params = '',
|
||||
description = 'show all offenders and their bounty',
|
||||
description = 'Place bounty on offenders and increasing the bounty by 20',
|
||||
privs = { interact = true },
|
||||
func = function(name, params)
|
||||
bounty.increase(name, 28)
|
||||
bounty.increase(name, 20)
|
||||
end
|
||||
})
|
||||
|
||||
core.register_chatcommand('forgive', {
|
||||
params = '',
|
||||
description = 'show all offenders and their bounty',
|
||||
description = 'Forgive offender and decrease bounty by 20',
|
||||
privs = { interact = true },
|
||||
func = function(name, params)
|
||||
bounty.decrease(name, 28)
|
||||
bounty.decrease(name, 20)
|
||||
end
|
||||
})
|
||||
|
||||
core.register_chatcommand('bounties', {
|
||||
params = '',
|
||||
description = 'show all offenders and their bounty',
|
||||
description = 'Show all offenders and their bounty',
|
||||
privs = { interact = true },
|
||||
func = function(name, params)
|
||||
for key, value in pairs(bounty.data) do
|
||||
|
||||
Reference in New Issue
Block a user