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

More storages at once

70011983

Ners
Joined
Nov 21, 2011
Messages
354
Solutions
1
Reaction score
56
Location
Croatia
Hello,
I've been trying to make a quest involving a NPC.
The NPC is asking to bring him an item from somewhere but the player can take the item only once and if he accepted the mission from the NPC.
What I don't know is how to add a secondary Storage so the player won't be able to pick the item more than once and still check if the player has accepted the mission from the NPC.

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

if (getPlayerStorageValue(cid, 8950) == 1) then
        if doPlayerAddItem(cid, 192, 1) then
            doSendMagicEffect(getPlayerPosition(cid), 34)
            doCreatureSay(cid, "There isn't really much left but this ring. Bring it back to Monica.", TALKTYPE_ORANGE_1, cid)
       end
else
         doSendMagicEffect(getPlayerPosition(cid), 2)
            doCreatureSay(cid, "There is nothing left.", TALKTYPE_ORANGE_1, cid)       
    end
return TRUE
end
Now I need to add in the script Storage 8949 so the player can take the item only once regardless of the Storage 8950 which gives the ability to take the item.

Posting errors I think isn't needed because I had many different errors while trying to add another storage in the script.
If it's needed:
Code:
The Forgotten Server, version 0.3.6 (Crying Damson)
 
Last edited:
Code:
function onUse(cid, item, frompos, item2, topos)

if (getPlayerStorageValue(cid,8949) == 1) then
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already took this item.")
elseif (getPlayerStorageValue(cid, 8950) == 1) then
    if doPlayerAddItem(cid, 192, 1) then
        doSendMagicEffect(getPlayerPosition(cid), 34)  
        doCreatureSay(cid, "There isn't really much left but this ring. Bring it back to Monica.", TALKTYPE_ORANGE_1, cid)
    end
    else
        doSendMagicEffect(getPlayerPosition(cid), 2)
        doCreatureSay(cid, "There is nothing left.", TALKTYPE_ORANGE_1, cid)         
end
return TRUE  
end
 
Code:
function onUse(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid, 8949) == 1 then
        doPlayerSendCancel(cid, "You already found the ring.")
        return TRUE
    end

    if getPlayerStorageValue(cid, 8950) == 1 then
        if doPlayerAddItem(cid, 192, 1) then
            doSendMagicEffect(getPlayerPosition(cid), 34)
            doPlayerSetStorageValue(cid, 8949, 1)
            doCreatureSay(cid, "There isn't really much left but this ring. Bring it back to Monica.", TALKTYPE_ORANGE_1, cid)
        end
    else
        doSendMagicEffect(getPlayerPosition(cid), 2)
        doCreatureSay(cid, "There is nothing left.", TALKTYPE_ORANGE_1, cid)
    end
    return TRUE
end
 
8949 should be -1 right?
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

   if getPlayerStorageValue(cid, 8949) == -1 then
       if getPlayerStorageValue(cid, 8950) == 1 then
           doPlayerAddItem(cid, 192, 1)
           doSendMagicEffect(getPlayerPosition(cid), CONST_ME_GROUNDSHAKER)  
           setPlayerStorageValue(cid, 8949, 1)
           doCreatureSay(cid, "There isn't really much left but this ring. Bring it back to Monica.", TALKTYPE_ORANGE_1)
       else
           doCreatureSay(cid, "First do some npc quest.", TALKTYPE_ORANGE_1)
       end
   else
       doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
       doCreatureSay(cid, "There is nothing left.", TALKTYPE_ORANGE_1)  
  end
   return TRUE  
end

Edit: I'm slow :p
 
That was... fast... didn't expect an answer that early, works fine now, thanks all!
Anyway I got 1 more question. What do i have to add in the script so the key that is rewarded has an action ID on it?
Code:
                 doPlayerAddItem(cid, 2090, 1)
Note:
This is from the npc.lua file
 
Back
Top