You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is actually set to use 2 bones to craft a skull, but it doesn't work, the craft is successfull even if i use only one bone.
I mean if i use 2 bones they both disapear from my inventory and i got the skull but if i use only one bone it will give me the skull aswell and remove the single bone.
I'm sorry for terrible explanation, i'm not very good at explaining things.
Can you help me with this i don't know what i need to change in the code to make it properly work, i know i need to modify something in this area but i'm new to lua and i don't know how to fix this myself :
function RECIPES:Register( tbl )
if !tbl.CanCraft then
function tbl:CanCraft( player )
for k, v in pairs( self.items ) do
if !player:HasItem( k, v ) then
return false
end
end
return true
end
end
if !tbl.ProcessCraftItems then
function tbl:ProcessCraftItems( player )
player:EmitSound( "items/ammo_pickup.wav" )
for k, v in pairs( self.items ) do
for i = 1, v do
if player:getChar():getInv():hasItem( k ) then
player:getChar():getInv():remove( player:getChar():getInv():hasItem( k ):getID() )
end
end
end
for k, v in pairs( self.result ) do
--print(player:getChar():getInv():add(k, v))
--if (!player:getChar():getInv():add(k, v)) then
for i = 1, v do
nut.item.spawn(k, player:getItemDropPos())
end
--else
--netstream.Start(client, "vendorAdd", uniqueID)
--end
end
player:notifyLocalized( "donecrafting", self.name )
end
end
self.recipes[ tbl.uid ] = tbl
end
Hope it is clear, and thanks for any help by advance :).
The text was updated successfully, but these errors were encountered:
Hello I know I am almost a year late, but better late than never!
I managed to fix this script with just a few small edits
for k, v in pairs( self.items ) do
if player:HasItem( k, v ) then
if player:getChar():getInv():getItemCount(k) < v then
return false
end
end
if !player:HasItem( k, v ) then
return false
end
end
return true
when you craft something, that has multiple items, for example i want to do that :
It is actually set to use 2 bones to craft a skull, but it doesn't work, the craft is successfull even if i use only one bone.
I mean if i use 2 bones they both disapear from my inventory and i got the skull but if i use only one bone it will give me the skull aswell and remove the single bone.
I'm sorry for terrible explanation, i'm not very good at explaining things.
Can you help me with this i don't know what i need to change in the code to make it properly work, i know i need to modify something in this area but i'm new to lua and i don't know how to fix this myself :
Hope it is clear, and thanks for any help by advance :).
The text was updated successfully, but these errors were encountered: