automatic teller machine
parent
49cf235766
commit
cadbafa141
5
init.lua
5
init.lua
|
@ -161,6 +161,8 @@ function elez.transfer_money(src_name,dst_name,amount)
|
||||||
amount = math.abs(amount)
|
amount = math.abs(amount)
|
||||||
if amount > 32767 then
|
if amount > 32767 then
|
||||||
amount = 32767
|
amount = 32767
|
||||||
|
elseif amount == 0 then
|
||||||
|
return false, S("Error: Type an amount greater than 0.")
|
||||||
end
|
end
|
||||||
local src = minetest.get_player_by_name(src_name)
|
local src = minetest.get_player_by_name(src_name)
|
||||||
local dst = minetest.get_player_by_name(dst_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
|
if amount > elez.get_money(player) then
|
||||||
return false, S("Error: You has not").." "..tostring(amount).." "..S("of money to withdraw.")
|
return false, S("Error: You has not").." "..tostring(amount).." "..S("of money to withdraw.")
|
||||||
end
|
end
|
||||||
|
if amount == 0 then
|
||||||
|
return false, S("Error: Type an amount greater than 0.")
|
||||||
|
end
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
local money_stack = ItemStack(coin_name.." "..tostring(amount))
|
local money_stack = ItemStack(coin_name.." "..tostring(amount))
|
||||||
if not inv:room_for_item("main", money_stack) then
|
if not inv:room_for_item("main", money_stack) then
|
||||||
|
|
|
@ -37,3 +37,4 @@ You has=Tienes
|
||||||
No space in your inventory for the money.=No hay espacio en tu inventario para el dinero.
|
No space in your inventory for the money.=No hay espacio en tu inventario para el dinero.
|
||||||
Money successfully withdrawn.=Dinero retirado con éxito.
|
Money successfully withdrawn.=Dinero retirado con éxito.
|
||||||
max=máx.
|
max=máx.
|
||||||
|
Error: Type an amount greater than 0.=Error: Pon una cantidad mayor de 0
|
||||||
|
|
Loading…
Reference in New Issue