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

Use item and get storage

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
931
Solutions
7
Reaction score
128
Location
Brazil
YouTube
caruniawikibr
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local mailuid = 10168
local storage = 100171
local getstorage = getPlayerStorageValue(cid, storage)

    if(getstorage == 7) then
        setPlayerStorageValue(cid, 100168, 6)
        setPlayerStorageValue(cid, 100169, 1)
        doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
        else
        setPlayerStorageValue(cid, 100168, 6)
        setPlayerStorageValue(cid, 10169, 1)
        doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
    return true
end
end




This mission is a postman mission that I did, but I couldn't get the player to crowbar and get storage.
Id crowbar 2416
it's the mission that you crowbar mailbox and then return to kevin
I edited to use in mailbox, but wanted to modify to use the crowbar in mailbox and happen the storages
 
Solution
This one should work if you already has that getstorage == 7 it is from previous mission I think? for me it works if I removed the getstorage == 7 (Because I don't have it already).
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if (item.itemid == 2416 and itemEx.uid == 10168 and getstorage== 7) then
           doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
           setPlayerStorageValue(cid,100168,6)
        setPlayerStorageValue(cid,100169,1)
    end
    return true
end
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)



local mailuid = 9120

local storage = 250

local getstorage = getPlayerStorageValue(cid, storage)



    if(itemEx.itemid == 2593 and itemEx.uid == mailuid and getstorage == 3) then

        doSendMagicEffect(toPosition, 14)

        setPlayerStorageValue(cid, storage, 4)

        return true

    end

 

end
250 is current storage for kevin npc updated to next mission
 
Did the script above work? Don't forget to mark best answer/question solved if a script works/question solved so we can know if you still need further help or not.
 
Try this one
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local mailuid = 10168
local storage = 9999
local getstorage = getPlayerStorageValue(cid, storage)

    if(itemEx.itemid == 2593 and itemEx.uid == mailuid and getstorage == 3) then
        doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
        setPlayerStorageValue(cid, storage, 4)  
    return true
end
end
 
no can use, my script here

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local mailuid = 10168
local storage = 100171
local getstorage = getPlayerStorageValue(cid, storage)

    if(itemEx.itemid == 2416 and itemEx.uid == mailuid and getstorage == 7) then
        doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
        setPlayerStorageValue(cid, 100168, 6)
        setPlayerStorageValue(cid, 100169, 1)
    return true
end
end

and my kevin script mission 2


Code:
elseif (msgcontains(msg, 'mission') or msgcontains(msg, 'report')) then
        if (v == 1) then
        if (v == 1 and getPlayerStorageValue(cid,storage2) == 4) then
            npcHandler:say("So you have finally made it! I did not think that you would have it in you ... However: are you ready for another assignment?",cid)
            setPlayerStorageValue(cid,100171,7)
            Topic[cid] = 8
        else
            npcHandler:say("Come back when you have finished your {mission}.",cid)
        end
    elseif v == 2 then
        if (getPlayerStorageValue(cid,storage2) == 6) then
        npcHandler:say("Excellent, you got it fixed! This will teach this mailbox a lesson indeed! Are you interested in another assignment?",cid)
        Topic[cid] = 9
    else
        npcHandler:say("Come back when you have finished your {mission}.",cid)
    end
    elseif v == 3 then
    if (getPlayerStorageValue(cid,storage2) == 8) then
        npcHandler:say("You truly got him? Quite impressive. You are a very promising candidate! I think I have another mission for you. Are you interested?",cid)
        setPlayerStorageValue(cid,100171,13)
        Topic[cid] = 11
    else
        npcHandler:say("Come back when you have finished your {mission}.",cid)
    end
Screenshot_1.png
 
This one should work if you already has that getstorage == 7 it is from previous mission I think? for me it works if I removed the getstorage == 7 (Because I don't have it already).
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if (item.itemid == 2416 and itemEx.uid == 10168 and getstorage== 7) then
           doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
           setPlayerStorageValue(cid,100168,6)
        setPlayerStorageValue(cid,100169,1)
    end
    return true
end
 
Last edited:
Solution
I don't know why it doesn't work, I know this one works, but it uses without crowbar
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local mailuid = 10168
local storage = 100171
local getstorage = getPlayerStorageValue(cid, storage)

    if(getstorage == 7) then
        setPlayerStorageValue(cid, 100168, 6)
        setPlayerStorageValue(cid, 100169, 1)
        doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
        else
        setPlayerStorageValue(cid, 100168, 6)
        setPlayerStorageValue(cid, 100169, 1)
        doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
    return true
end
end
 
Try the one above, I edited it should work and show me how you added the script to your actions.xml and get sure you write the uniqueID 10168 on mailbox with your map editor.
 
Not the NPC script, I want to see how you added this script above to your actions.xml, It should be added like this
XML:
<action itemid="2416" event="script" value="crowbar.lua"/>
 
I found something,
when I use the old script that I had, it does not red, it does blue, it ignores the first one (if getstorage)

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local mailuid = 10168
local storage = 100171
local getstorage = getPlayerStorageValue(cid, storage)

    if(getstorage == 7) then
        setPlayerStorageValue(cid, 100168, 6)
        setPlayerStorageValue(cid, 100169, 1)
        doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
        else   <----------
        setPlayerStorageValue(cid, 100168, 6)
        setPlayerStorageValue(cid, 100169, 1)
        doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE) <---------
    return true
end
end
Edit/Merged : work now, ty mustafa
 
Last edited by a moderator:
Back
Top