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

Different Chest

Joined
Apr 11, 2015
Messages
102
Reaction score
6
0.4
Mah Dudes, Im here to ask for a little help. I have a simple quest script, where the player right-click on the chest and gain their items. What im asking for is for the script to tell the player to remove all of his items before clicking on the chest.
So, the script have to identify all of his equipment (not the backpack) and if he is wearing something (weapon, ring, necklace, armor, anything) to tell him to remove before trying to open the chest.

C++:
function onUse(cid, item, frompos, item2, topos)
if item.uid == 37179 then
queststatus = getPlayerStorageValue(cid,37179)
if queststatus == -1 or queststatus == 0 then
doPlayerSendTextMessage(cid,22,"")
item_uid = doPlayerAddItem(cid,12852,1)
setPlayerStorageValue(cid,37179,1)


else
doPlayerSendTextMessage(cid,22,"its empty.")
end
else
return 0
end
return 1
end
 
Solution
I did something quick try it.
Lua:
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 37179 then
queststatus = getPlayerStorageValue(cid,37179)
if queststatus == -1 or queststatus == 0 then
doPlayerSendTextMessage(cid,22,"")
item_uid = doPlayerAddItem(cid,12852,1)
setPlayerStorageValue(cid,37179,1)

if getPlayerSlotItem(cid, CONST_SLOT_HEAD).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your helmet.')
end

if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your armor.')
end

if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have...
I did something quick try it.
Lua:
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 37179 then
queststatus = getPlayerStorageValue(cid,37179)
if queststatus == -1 or queststatus == 0 then
doPlayerSendTextMessage(cid,22,"")
item_uid = doPlayerAddItem(cid,12852,1)
setPlayerStorageValue(cid,37179,1)

if getPlayerSlotItem(cid, CONST_SLOT_HEAD).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your helmet.')
end

if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your armor.')
end

if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your amulet.')
end

if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your shield.')
end

if getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your weapon.')
end

if getPlayerSlotItem(cid, CONST_SLOT_LEGS).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your legs.')
end

if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your boots.')
end

if getPlayerSlotItem(cid, CONST_SLOT_RING).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your ring.')
end

if getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your arrow.')
end

else
doPlayerSendTextMessage(cid,22,"its empty.")
end
else
return 0
end
return 1
end
 
I did something quick try it.
Lua:
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 37179 then
queststatus = getPlayerStorageValue(cid,37179)
if queststatus == -1 or queststatus == 0 then
doPlayerSendTextMessage(cid,22,"")
item_uid = doPlayerAddItem(cid,12852,1)
setPlayerStorageValue(cid,37179,1)

if getPlayerSlotItem(cid, CONST_SLOT_HEAD).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your helmet.')
end

if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your armor.')
end

if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your amulet.')
end

if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your shield.')
end

if getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your weapon.')
end

if getPlayerSlotItem(cid, CONST_SLOT_LEGS).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your legs.')
end

if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your boots.')
end

if getPlayerSlotItem(cid, CONST_SLOT_RING).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your ring.')
end

if getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid > 0 then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have to remove your arrow.')
end

else
doPlayerSendTextMessage(cid,22,"its empty.")
end
else
return 0
end
return 1
end
Some tabs would look nice.

Lua:
function onUse(cid, item, frompos, item2, topos)
    if item.uid == 37179 then
        queststatus = getPlayerStorageValue(cid, 37179)
        if queststatus == -1 or queststatus == 0 then
            for i = 1, 10 do
                if getPlayerSlotItem(cid, i).itemid > 0 and i ~= 3 then
                    doPlayerSendTextMessage(cid, 22, "You must get rid of all your equipment!")
                    return false
                end
            end
            doPlayerSendTextMessage(cid, 22, "Here you go!")
            item_uid = doPlayerAddItem(cid, 12852, 1)
            setPlayerStorageValue(cid, 37179, 1)
        else
            doPlayerSendTextMessage(cid, 22, "its empty.")
        end
    else
        return false
    end
    return true
end
 
Solution
Back
Top