• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

item change script on tfs 1.2+

zxzxzx

New Member
Joined
Mar 12, 2011
Messages
334
Reaction score
3
Hello! I have script which change item 2191 to item 8921 when I use item id 10305 and then items id 2191 and 10305 remove - this is ok but when I use item 10305 on the ground (not backpack) item 10305 not remove and this is the problem..

Help me to make item 10305 remove when it is on the ground too!

Thanks for help!++

code:
Code:
function onUse(cid, item, frompos, item2, topos)

if item.itemid == 10305 then

if doPlayerRemoveItem(cid,2191,1) == true then
doPlayerAddItem(cid,8921,1)
doPlayerRemoveItem(cid,10305,1)
doPlayerSendTextMessage(cid,21,"Your weapon has been upgraded!")
end
else
doPlayerSendCancel(cid, "You do not have any pro items to uprgade!")
end
return true
end
 
tell me how.. I'm not scripter. just wan't to make this works. I forgot something?
you need to make an effort to become one, you cant just have everyone do every single little thing for you because you don't know how to do it
try to learn
 
To be more clear.. look at other scripts in your | data/actions/scripts | folder where the function onUse is.. and you should instantly see what's wrong.

Another hint;

The error is advising that onUse on line 6 is not a known function/formula.
Basically the system has no idea what you want it to do.
 
To be more clear.. look at other scripts in your | data/actions/scripts | folder where the function onUse is.. and you should instantly see what's wrong.

Another hint;

The error is advising that onUse on line 6 is not a known function/formula.
Basically the system has no idea what you want it to do.
Thanks for hint, I add return true end and function onUse(player, item) - now in console I don't see error but when I use it I see still error on use "attempt to index global 'item2' (a nil value) in line 7 realy don't know what to do I need to change this:
Code:
function onUse(player, item)
or this?
Code:
local tmp = upg[item2:getId()]
need another hint :<
 
Thanks for hint, I add return true end and function onUse(player, item) - now in console I don't see error but when I use it I see still error on use "attempt to index global 'item2' (a nil value) in line 7 realy don't know what to do I need to change this:
Code:
function onUse(player, item)
or this?
Code:
local tmp = upg[item2:getId()]
need another hint :<
need change this, again. Try to use the full formula instead of partial.
Code:
function onUse(player, item)
 
if player:getItemCount(10305) >= 1 then means if play has in his current inventory. If player were to use off ground, script wouldn't find one in inventory then.
 
Back
Top