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

Walk on Tile get Item only Once

Ray Rewind

Doctor
Joined
Jun 6, 2009
Messages
1,349
Reaction score
76
Location
Germany
Hello I look for a Script !


If you walk on a Tile you get the item, but only 1 time (quest)

anyone can handle it ?
 
Code:
function onStepIn(cid, item, position, fromPosition)
   if getPlayerStorageValue(cid,24331) == -1 then
     doPlayerAddItem(cid, id, amount)
     setPlayerStorageValue(cid,24331,1)
   end
   return true
end
 
Ty for your helped I edited it abit :p
hope it works


Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local 9queststatus = getPlayerStorageValue(cid, 24331)
    if 9queststatus == 1 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Already got an item.")
    else
        if item.uid == 5000 then
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a holy scarab.")
            doSendMagicEffect(getCreaturePosition(cid),36)
              doPlayerAddItem(cid, 2140, 1)
              setPlayerStorageValue(cid, 24331, 1)
        elseif item.uid == 5001 then
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a holy falcon.")
            doSendMagicEffect(getCreaturePosition(cid),36)           
              doPlayerAddItem(cid,2139,1)
              setPlayerStorageValue(cid, 24331, 1)
        elseif item.uid == 5002 then
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found an ancient tiara.")
            doSendMagicEffect(getCreaturePosition(cid),36)                 
            doPlayerAddItem(cid, 5803, 1)
              setPlayerStorageValue(cid, 24331, 1)
        elseif item.uid == 5003 then
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found 40 Crystal Coins.")
            doSendMagicEffect(getCreaturePosition(cid),36)                 
            doPlayerAddItem(cid, 2160, 40)
              setPlayerStorageValue(cid, 24331, 1)
        elseif item.uid == 5004 then
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found golden fruits.")
            doSendMagicEffect(getCreaturePosition(cid),36)                 
            doPlayerAddItem(cid, 2137, 1)
              setPlayerStorageValue(cid, 24331, 1)
        elseif item.uid == 5005 then
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a spellbook of prophecies.")
            doSendMagicEffect(getCreaturePosition(cid),36)                 
            doPlayerAddItem(cid, 8904, 1)
              setPlayerStorageValue(cid, 24331, 1)
        end
    end
return TRUE
end
 
Code:
function onStepIn(cid, item, position, fromPosition)
   if getPlayerStorageValue(cid,24331) == -1 then
     doPlayerAddItem(cid, id, amount)
     setPlayerStorageValue(cid,24331,1)
   end
   return true
end

can I use this as multiple script so player only get 1 item when there are 5 chest if I use same storage?
 
can I use this as multiple script so player only get 1 item when there are 5 chest if I use same storage?
why not?
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local q = 24331
local rewards = {
   [5000] = {item = {2140, 1}, msg = "a holy scarab"},
   [5001] = {item = {2139, 1}, msg = "a holy falcon"},
   [5002] = {item = {5803, 1}, msg = "an ancient tiara"},
   [5003] = {item = {2160, 40}, msg = "40 Crystal Coins"},
   [5004] = {item = {2137, 1}, msg = "golden fruits"},
   [5005] = {item = {8904, 1}, msg = "a spellbook of prophecies"}
}

   if getPlayerStorageValue(cid, q) > 0 then
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Already got an item.")
     return true
   else
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. rewards[item.uid].msg .. ".")
     doSendMagicEffect(toPosition,36)
     doPlayerAddItem(cid, rewards[item.uid].item[1], rewards[item.uid].item[2])
     setPlayerStorageValue(cid, q, 1)
     return true
   end
end
 
Why the fuck you don't try it yourself?
It's about changing first line and moving this file to movements
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local q = 24331
local rewards = {
   [5000] = {item = {2140, 1}, msg = "a holy scarab"},
   [5001] = {item = {2139, 1}, msg = "a holy falcon"},
   [5002] = {item = {5803, 1}, msg = "an ancient tiara"},
   [5003] = {item = {2160, 40}, msg = "40 Crystal Coins"},
   [5004] = {item = {2137, 1}, msg = "golden fruits"},
   [5005] = {item = {8904, 1}, msg = "a spellbook of prophecies"}
}

   if getPlayerStorageValue(cid, q) > 0 then
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Already got an item.")
     return true
   else
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. rewards[item.uid].msg .. ".")
     doSendMagicEffect(toPosition,36)
     doPlayerAddItem(cid, rewards[item.uid].item[1], rewards[item.uid].item[2])
     setPlayerStorageValue(cid, q, 1)
     return true
   end
end

Can be shortened to:
Code:
function onUse(cid, item, toPosition)
    local q = 24331
    local rewards = {
        [5000] = {2140, 1},
        [5001] = {2139, 1},
        [5002] = {5803, 1},
        [5003] = {2160, 40},
        [5004] = {2137, 1},
        [5005] = {8904, 1}
    }
    local text = "You have found "
    if getPlayerStorageValue(cid, q) == -1 then
        local itemName = getItemNameById(rewards[item.uid][1])
        if rewards[item.uid][2] > 1 then
            text = text.. "" ..rewards[item.uid][2].. " " ..itemName.. "s."
        else
            text = text.. "" ..getItemArticleById(rewards[item.uid][1]).. " " ..itemName.. "."
        end
        doSendMagicEffect(toPosition,36)
        doPlayerAddItem(cid, rewards[item.uid][1], rewards[item.uid][2])
        setPlayerStorageValue(cid, q, 1)
    else
        text = "Already got an item."
    end
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
    return true
end
 
Last edited:
Back
Top