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

Dhq chests

AnDy1990

New Member
Joined
Mar 6, 2008
Messages
104
Reaction score
0
Hi I got some problems with my dhq chests.

I can get the items, but I can get them as many times as I want ...


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

   	if item.uid == 7043 then
   		queststatus = getPlayerStorageValue(cid,4013)
   		if queststatus == 1 then
   			doPlayerSendTextMessage(cid,22,"You have found a Demon Helmet.")
   			doPlayerAddItem(cid,2493,1)
   			setPlayerStorageValue(cid,4013,1)
   		else
   			doPlayerSendTextMessage(cid,22,"It is empty.")
   		end
   	elseif item.uid == 7044 then
   		queststatus = getPlayerStorageValue(cid,4013)
   		if queststatus == 1 then
   			doPlayerSendTextMessage(cid,22,"You have found a Demon shield.")
   			doPlayerAddItem(cid,2645,1)
   			setPlayerStorageValue(cid,4013,1)
   		else
   			doPlayerSendTextMessage(cid,22,"It is empty.")
   		end
   	elseif item.uid == 7045 then
   		queststatus = getPlayerStorageValue(cid,4013)
   		if queststatus == 1 then
   			doPlayerSendTextMessage(cid,22,"You have found Steel boots.")
   			doPlayerAddItem(cid,2520,1)
   			setPlayerStorageValue(cid,4013,1)
   		else
   			doPlayerSendTextMessage(cid,22,"It is empty.")
   		end
	else
		return 0
   	end

   	return 1
end
 
Using TheForgottenServer? ......

If so then:

Make quest.lua file on data/actios/scripts.
Add this in it:
PHP:
local quests =
    {
                  [6201] = {
                  storageId = 12008,
                  rewardId = 2493,
                  count = 1
                  },
    }

function useQuestChest(cid, quest)
    local queststatus = getPlayerStorageValue(cid, quest.storageId)
    if queststatus == -1 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. getItemName(quest.rewardId) .. ".")
        doPlayerAddItem(cid, quest.rewardId, quest.count)
        setPlayerStorageValue(cid, quest.storageId, 1)
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
    end
end

function onUse(cid, item, frompos, item2, topos)
    if quests[item.uid] ~= nil then
        useQuestChest(cid, quests[item.uid])
    end
    return TRUE
end

Now add on data/actions/actions.xml this line:
PHP:
<action uniqueid="6201" script="quest.lua" />

After all go on your map editor and set uniqueId on the chests on the demon helmet quest. In this case add 6201.
 
Then you will have to have 3 different storageValues. 2 secs, I will make it for ya.

EDIT: Like this:

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

       if item.uid == 7043 then
           queststatus = getPlayerStorageValue(cid,4013)
           if queststatus == 1 then
               doPlayerSendTextMessage(cid,22,"You have found a Demon Helmet.")
               doPlayerAddItem(cid,2493,1)
               setPlayerStorageValue(cid,4013,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 7044 then
           queststatus = getPlayerStorageValue(cid,4014)
           if queststatus == 1 then
               doPlayerSendTextMessage(cid,22,"You have found a Demon shield.")
               doPlayerAddItem(cid,2645,1)
               setPlayerStorageValue(cid,4013,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 7045 then
           queststatus = getPlayerStorageValue(cid,4015)
           if queststatus == 1 then
               doPlayerSendTextMessage(cid,22,"You have found Steel boots.")
               doPlayerAddItem(cid,2520,1)
               setPlayerStorageValue(cid,4013,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
    else
        return 0
       end

       return 1
end
 
Then you will have to have 3 different storageValues. 2 secs, I will make it for ya.

EDIT: Like this:

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

       if item.uid == 7043 then
           queststatus = getPlayerStorageValue(cid,4013)
           if queststatus == 1 then
               doPlayerSendTextMessage(cid,22,"You have found a Demon Helmet.")
               doPlayerAddItem(cid,2493,1)
               setPlayerStorageValue(cid,4013,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 7044 then
           queststatus = getPlayerStorageValue(cid,4014)
           if queststatus == 1 then
               doPlayerSendTextMessage(cid,22,"You have found a Demon shield.")
               doPlayerAddItem(cid,2645,1)
               setPlayerStorageValue(cid,4013,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 7045 then
           queststatus = getPlayerStorageValue(cid,4015)
           if queststatus == 1 then
               doPlayerSendTextMessage(cid,22,"You have found Steel boots.")
               doPlayerAddItem(cid,2520,1)
               setPlayerStorageValue(cid,4013,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
    else
        return 0
       end

       return 1
end

hmm, I can only take one chest, and I can take it as many times as i want..


- empty got a msn that we can talk over?

- pm me if you feel like helping
 
Last edited:
Nps, I know what I did wrong... :p

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

       if item.uid == 7043 then
           queststatus = getPlayerStorageValue(cid,4013)
           if queststatus == 1 then
               doPlayerSendTextMessage(cid,22,"You have found a Demon Helmet.")
               doPlayerAddItem(cid,2493,1)
               setPlayerStorageValue(cid,4013,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 7044 then
           queststatus = getPlayerStorageValue(cid,4014)
           if queststatus == 1 then
               doPlayerSendTextMessage(cid,22,"You have found a Demon shield.")
               doPlayerAddItem(cid,2645,1)
               setPlayerStorageValue(cid,4014,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 7045 then
           queststatus = getPlayerStorageValue(cid,4015)
           if queststatus == 1 then
               doPlayerSendTextMessage(cid,22,"You have found Steel boots.")
               doPlayerAddItem(cid,2520,1)
               setPlayerStorageValue(cid,4015,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
    else
        return 0
       end

       return 1
end

Use this instead.... :p
 
Back
Top