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:write(data_stri)
|
||||||
data_file:close()
|
data_file:close()
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -99,14 +99,14 @@ end
|
|||||||
bounty.drop_prize = function(player)
|
bounty.drop_prize = function(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local prize = bounty.get_player_bounty(player_name)
|
local prize = bounty.get_player_bounty(player_name)
|
||||||
print(prize)
|
core.log('info', prize)
|
||||||
core.item_drop(prize, player, player:getpos())
|
core.item_drop(ItemStack(prize), player, player:get_pos())
|
||||||
print(prize)
|
core.log('info', prize)
|
||||||
bounty.penalize(player_name)
|
bounty.penalize(player_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
bounty.get_player_bounty = function(player_name)
|
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
|
if type(bounty.prizes) == 'string' then
|
||||||
local amount = math.floor(bounty.data[player_name] / bounty.points_per_prize)
|
local amount = math.floor(bounty.data[player_name] / bounty.points_per_prize)
|
||||||
if bounty.data[player_name] >= bounty.points_per_prize then
|
if bounty.data[player_name] >= bounty.points_per_prize then
|
||||||
@@ -127,25 +127,25 @@ end
|
|||||||
--chatcommands for testing purposes
|
--chatcommands for testing purposes
|
||||||
core.register_chatcommand('bounty', {
|
core.register_chatcommand('bounty', {
|
||||||
params = '',
|
params = '',
|
||||||
description = 'show all offenders and their bounty',
|
description = 'Place bounty on offenders and increasing the bounty by 20',
|
||||||
privs = { interact = true },
|
privs = { interact = true },
|
||||||
func = function(name, params)
|
func = function(name, params)
|
||||||
bounty.increase(name, 28)
|
bounty.increase(name, 20)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
core.register_chatcommand('forgive', {
|
core.register_chatcommand('forgive', {
|
||||||
params = '',
|
params = '',
|
||||||
description = 'show all offenders and their bounty',
|
description = 'Forgive offender and decrease bounty by 20',
|
||||||
privs = { interact = true },
|
privs = { interact = true },
|
||||||
func = function(name, params)
|
func = function(name, params)
|
||||||
bounty.decrease(name, 28)
|
bounty.decrease(name, 20)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
core.register_chatcommand('bounties', {
|
core.register_chatcommand('bounties', {
|
||||||
params = '',
|
params = '',
|
||||||
description = 'show all offenders and their bounty',
|
description = 'Show all offenders and their bounty',
|
||||||
privs = { interact = true },
|
privs = { interact = true },
|
||||||
func = function(name, params)
|
func = function(name, params)
|
||||||
for key, value in pairs(bounty.data) do
|
for key, value in pairs(bounty.data) do
|
||||||
|
|||||||
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
Reference in New Issue
Block a user