• 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 Use item on, set Storage TFS 1.1

Hokku

Member
Joined
Jul 25, 2013
Messages
95
Reaction score
17
Location
Extremadura, Spain
Hello!
Im trying to do a quest script, when use a crowbar on item with uid, set storage value, here's the script.

fixed by Peonso down.

crossbar id: 2416
itemid 9347, itemuid 3074
storage:12251

Code:
    <action itemid="2416" script="quests/in service of yalahar/crowbar.lua"/>

Code:
local key = 12251
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.itemid == 9347 and itemEx.uniqueid == 3074 then
        if getCreatureStorage(cid, key) == -1 then
            doCreatureSetStorage(cid, key, 1)
            doCreatureSay(cid, 'Success', TALKTYPE_ORANGE_1)
        else
            doCreatureSay(cid, 'Failure', TALKTYPE_ORANGE_1)
        end
    end
    return true
end

using TFS 1.1.
Thanks!
 
Last edited:
Solution
Code:
local key = 12251
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
   if target.uid == 3074 and player:getStorageValue(key) < 0 then
     player:setStorageValue(key, 1)
     player:say('Success.', TALKTYPE_MONSTER_SAY)   
   elseif target.uid == 3074 and player:getStorageValue(key) == 1 then
     player:say('Already done.', TALKTYPE_MONSTER_SAY)
   else
     player:say('Failure.', TALKTYPE_MONSTER_SAY)
   end
   return true
end
Code:
local key = 12251
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
   if target.uid == 3074 and player:getStorageValue(key) < 0 then
     player:setStorageValue(key, 1)
     player:say('Success.', TALKTYPE_MONSTER_SAY)   
   elseif target.uid == 3074 and player:getStorageValue(key) == 1 then
     player:say('Already done.', TALKTYPE_MONSTER_SAY)
   else
     player:say('Failure.', TALKTYPE_MONSTER_SAY)
   end
   return true
end
 
Solution
Back
Top