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
|
-- user /money chat command
|
||||||
core.register_chatcommand("money", {
|
core.register_chatcommand("money", {
|
||||||
description = S("Return your emeralds in your bank account."),
|
description = S("Return your emeralds in your bank account."),
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local emeralds = emeraldbank.get_emeralds(name)
|
-- Determine the target player: either the command issuer or the specified player
|
||||||
if emeralds then
|
local target_player = param ~= "" and minetest.check_player_privs(name, {server=true}) and param or name
|
||||||
minetest.chat_send_player(name, S("Emeralds in Bank: @1", emeralds))
|
|
||||||
return true
|
-- Check and return the emerald balance
|
||||||
end
|
local emeralds = emeraldbank.get_emeralds(target_player)
|
||||||
return false
|
if emeralds then
|
||||||
end
|
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
|
-- admin chat command
|
||||||
core.register_chatcommand("emeralds", {
|
core.register_chatcommand("emeralds", {
|
||||||
params = "<player> <num>",
|
params = "<player> <num>",
|
||||||
|
Loading…
Reference in New Issue
Block a user