• 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 onUse monster, get teleported or storage

BugaS

Donżuan
Joined
Mar 12, 2009
Messages
1,219
Reaction score
9
Location
NYC
Hey guys!

I'm looking for the script which: Player must use item on monster and then he get teleported to another position. Is it possible? Thanks!
 
Solution
X
I was literally
I've got:

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getCreatureName(itemEx.uid):lower() == "Bubbles" then
        if getPlayerStorageValue(cid, 1330) < 1 then
            setPlayerStorageValue(cid, 1330, 1)
                    doRemoveItem(itemEx.uid, 1)
                    doCreatureSay(cid, "You caught Bubbles!", TALKTYPE_ORANGE_1)


        else
            doPlayerSendCancel(cid, "Nope..")
        end
      
    end    
    return true
end

But it's not working. Nothing happens
LUA:
:lower()
Your only comparing lowercase letters, but you've placed a capital in the quotation marks.

I've altered the script and fixed your tabbing.
I'm not sure if you want to remove the item.. or...
Always let people know what TFS version or Engine you are using so that they can help you better.
 
I've got:

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getCreatureName(itemEx.uid):lower() == "Bubbles" then
        if getPlayerStorageValue(cid, 1330) < 1 then
            setPlayerStorageValue(cid, 1330, 1)
                    doRemoveItem(itemEx.uid, 1)
                    doCreatureSay(cid, "You caught Bubbles!", TALKTYPE_ORANGE_1)


        else
            doPlayerSendCancel(cid, "Nope..")
        end
       
    end     
    return true
end

But it's not working. Nothing happens
 
I was literally
I've got:

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getCreatureName(itemEx.uid):lower() == "Bubbles" then
        if getPlayerStorageValue(cid, 1330) < 1 then
            setPlayerStorageValue(cid, 1330, 1)
                    doRemoveItem(itemEx.uid, 1)
                    doCreatureSay(cid, "You caught Bubbles!", TALKTYPE_ORANGE_1)


        else
            doPlayerSendCancel(cid, "Nope..")
        end
      
    end    
    return true
end

But it's not working. Nothing happens
LUA:
:lower()
Your only comparing lowercase letters, but you've placed a capital in the quotation marks.

I've altered the script and fixed your tabbing.
I'm not sure if you want to remove the item.. or the creature, so I added both options in green-text.
Just disable the green-text for the option you were trying to accomplish.
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getCreatureName(itemEx.uid):lower() == "bubbles" then
        if getPlayerStorageValue(cid, 1330) < 1 then
            setPlayerStorageValue(cid, 1330, 1)
            -- doRemoveItem(item.uid, 1)
            -- doRemoveCreature(itemEx.uid)
            doCreatureSay(cid, "You've caught Bubbles!", TALKTYPE_ORANGE_1)
        else
            doPlayerSendCancel(cid, "Nope..")
        end
    end    
    return true
end
 
Solution
Back
Top