mirror of
https://codeberg.org/usrib/emeraldbank.git
synced 2024-12-22 22:22:25 +01:00
Added ability to inspect other players money if have server priv
This commit is contained in:
parent
7b826ac527
commit
c33c4be134
27
commands.lua
27
commands.lua
@ -43,17 +43,26 @@ core.register_chatcommand("pay", {
|
||||
|
||||
-- user /money chat command
|
||||
core.register_chatcommand("money", {
|
||||
description = S("Return your emeralds in your bank account."),
|
||||
func = function(name, param)
|
||||
local emeralds = emeraldbank.get_emeralds(name)
|
||||
if emeralds then
|
||||
minetest.chat_send_player(name, S("Emeralds in Bank: @1", emeralds))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
description = S("Return your emeralds in your bank account."),
|
||||
func = function(name, param)
|
||||
-- Determine the target player: either the command issuer or the specified player
|
||||
local target_player = param ~= "" and minetest.check_player_privs(name, {server=true}) and param or name
|
||||
|
||||
-- Check and return the emerald balance
|
||||
local emeralds = emeraldbank.get_emeralds(target_player)
|
||||
if emeralds then
|
||||
if target_player == name then
|
||||
minetest.chat_send_player(name, S("Emeralds in Bank: @1", emeralds))
|
||||
else
|
||||
minetest.chat_send_player(name, S("@1's Emeralds in Bank: @2", target_player, emeralds))
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- admin chat command
|
||||
core.register_chatcommand("emeralds", {
|
||||
params = "<player> <num>",
|
||||
|
Loading…
Reference in New Issue
Block a user