• 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!

Solved set actionid and text to an item with another item [tfs1.2]

Aeronx

Intermediate OT User
Joined
Dec 17, 2015
Messages
746
Solutions
9
Reaction score
125
Hello everyone, and thanks for reading this post and for your time.

Basicaly is what the tittle says. I want to use an item on a (for exemple) a weapon and add an actionid and a text to it.

I did this script here and works perfect when set to a chest for exemple:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local key = doCreateItemEx(2382, 1)
local text = "XXXXX"

doPlayerSendTextMessage(cid,25,"YYYYYYY")
doSetItemActionId(2382, 3520)
doSetItemSpecialDescription(2382, text)
doPlayerAddItemEx(cid, key, 1)

end
return true
end

I've been messing around and tried many versions of this:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local text = "XXXXXX"
    if target.itemid == 2382 then
doPlayerSendTextMessage(cid,25,"YYYYYY")
doSetItemActionId(2382, 3520)
doSetItemSpecialDescription(2382, text)

end
return true
end

I get the error target (a nil value).. so what im doing wrong? Im not an expert obviously, not even close, very amateur.

Thanks again!

NOTE: Solved the error on console target (a nil value) by adding <function onUse(cid, target...)>

So now, after using the item on the item 2382 nothing happens.
 
Last edited:
try?
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

     local text = "XXXXXX"
     if itemEx.itemid == 2382 then
         doPlayerSendTextMessage(cid, 25, "YYYYYY")
         doSetItemActionId(itemEx.uid, 3520)
         doSetItemSpecialDescription(itemEx.uid, text)
     end
     
     return true
end
 
Back
Top