-hi everyone, well.. im a begginer in all the scripting area so i took things from here and there and made this script for obsidian knife and i'd like elite scripters a little help improving it and in shorting it...
- the second script is my food.lua but i have some doubts.. i add item 9005 to the script as you can see.. but when i right clicked it, i get the cannot use this object message.. does it have something to do with the item itself??.. thank you all
obsidian knife / with ice cube part.
- the second script is my food.lua but i have some doubts.. i add item 9005 to the script as you can see.. but when i right clicked it, i get the cannot use this object message.. does it have something to do with the item itself??.. thank you all
obsidian knife / with ice cube part.
PHP:
local chance = 20
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.itemid == 7441 then
if (math.random(1, 100) <= chance*3) then
doTransformItem(itemEx.uid, 7442)
doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You broke it.")
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
doRemoveItem(itemEx.uid)
end
elseif itemEx.itemid == 7442 then
if (math.random(1, 100) <= chance*2) then
doTransformItem(itemEx.uid, 7444)
doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You broke it.")
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
doRemoveItem(itemEx.uid)
end
elseif itemEx.itemid == 7444 then
if (math.random(1, 100) <= chance) then
doTransformItem(itemEx.uid, 7445)
doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You broke it.")
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
doRemoveItem(itemEx.uid)
end
elseif itemEx.itemid == 7445 then
if (math.random(1, 100) <= chance/4) then
doTransformItem(itemEx.uid, 7446)
doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You broke it.")
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
doRemoveItem(itemEx.uid)
end
end
return TRUE
end
Last edited: