Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)if inv:contains_item("main", ItemStack("default:dirt 99")) then
print("Inventory contains at least 99 dirt!")
else
print("Inventory doesn't contain 99 dirt (either less than 99, or no dirt)!")
end
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)minetest.register_craftitem("bandage:bandage", {
description = "Bandage",
inventory_image = "bandage_bandage.png",
})
local inv = minetest.get_inventory("main")
if inv:contains_item("main", ItemStack("default:dirt 99")) then
print("Inventory contains at least 99 dirt!")
else
print("Inventory doesn't contain 99 dirt (either less than 99, or no dirt)!")
endHi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)minetest.register_craftitem("bandage:bandage", {
description = "Bandage",
inventory_image = "bandage_bandage.png",
--i'm doing thing wrong :P
minetest.register_on_player_hpchange(function(player, hp_change)
function minetest.get_content_id(...)
if hp_change>0 then
user:set_hp(hp + 2)
itemstack:take_item()
end
end
end
)})
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)minetest.register_craftitem("bandage:bandage", {
description = "Bandage",
inventory_image = "bandage_bandage.png",
})
minetest.register_on_player_hpchange(function(player, hp_change)
if hp_change >= 0 then
return hp_change
end
local inv = player:get_inventory()
local itemstack = inv:remove_item("main", ItemStack("bandage:bandage"))
if itemstack:get_count() == 1 then
-- cancel hp change
return 0
else
-- no bandages, don't cancel
return hp_change
end
end, true) local inv = player:get_inventory()
local itemstack = inv:remove_item("main", ItemStack("bandage:bandage"))
if itemstack:get_count() == 1 then
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)Users browsing this forum: No registered users and 4 guests