From cadbafa14171123d08d26473919669876bba5c31 Mon Sep 17 00:00:00 2001 From: runs Date: Wed, 4 Aug 2021 00:56:40 +0200 Subject: [PATCH] automatic teller machine --- init.lua | 5 +++++ locale/elez.es.tr | 1 + 2 files changed, 6 insertions(+) diff --git a/init.lua b/init.lua index cbbb844..a3ea50a 100644 --- a/init.lua +++ b/init.lua @@ -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 diff --git a/locale/elez.es.tr b/locale/elez.es.tr index 4e59e8a..e14f4c9 100644 --- a/locale/elez.es.tr +++ b/locale/elez.es.tr @@ -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