automatic teller machine

master
runs 2021-08-04 00:56:40 +02:00
parent 49cf235766
commit cadbafa141
2 changed files with 6 additions and 0 deletions

View File

@ -161,6 +161,8 @@ function elez.transfer_money(src_name,dst_name,amount)
amount = math.abs(amount)
if amount > 32767 then
amount = 32767
elseif amount == 0 then
return false, S("Error: Type an amount greater than 0.")
end
local src = minetest.get_player_by_name(src_name)
local dst = minetest.get_player_by_name(dst_name)
@ -196,6 +198,9 @@ function elez.withdraw_money(player, amount)
if amount > elez.get_money(player) then
return false, S("Error: You has not").." "..tostring(amount).." "..S("of money to withdraw.")
end
if amount == 0 then
return false, S("Error: Type an amount greater than 0.")
end
local inv = player:get_inventory()
local money_stack = ItemStack(coin_name.." "..tostring(amount))
if not inv:room_for_item("main", money_stack) then

View File

@ -37,3 +37,4 @@ You has=Tienes
No space in your inventory for the money.=No hay espacio en tu inventario para el dinero.
Money successfully withdrawn.=Dinero retirado con éxito.
max=máx.
Error: Type an amount greater than 0.=Error: Pon una cantidad mayor de 0