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

Solved Item gives mount need storage

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
923
Location
Chile
Hello guys, first i'm not sure of this has to be here or in request.
My server is otx 2.52 and version 9.83

this is the thing, i have this script
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 13295 then
    local pPos = getPlayerPosition(cid)
        doSendMagicEffect(pPos, 50)
        doPlayerAddMount(cid, 4)
        doRemoveItem(item.uid, 1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You Have the Black Sheep mount!")
    end
return TRUE
end

but i would like to add something where the player uses the item for the second time, it says something like sorry, you already have this mount, and the item doesn't dissapear (only in this situation)
i know i have to use storage, but how? i wish someone could tell me what to add and where
Thanks ! :D
 
Use the function canPlayerRideMount.
Code:
    local mountId = 4
    if canPlayerRideMount(cid, mountId) then
        doPlayerSendCancel(cid, "You already have this mount.")
        return true
    end

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mountId = 4
    if canPlayerRideMount(cid, mountId) then
        doPlayerSendCancel(cid, "You already have this mount.")
        return true
    end

    doSendMagicEffect(getPlayerPosition(cid), 50)
    doPlayerAddMount(cid, mountId)
    doRemoveItem(item.uid, 1)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You Have the Black Sheep mount!")
    return true
end
 
Use the function canPlayerRideMount.
Code:
    local mountId = 4
    if canPlayerRideMount(cid, mountId) then
        doPlayerSendCancel(cid, "You already have this mount.")
        return true
    end

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mountId = 4
    if canPlayerRideMount(cid, mountId) then
        doPlayerSendCancel(cid, "You already have this mount.")
        return true
    end

    doSendMagicEffect(getPlayerPosition(cid), 50)
    doPlayerAddMount(cid, mountId)
    doRemoveItem(item.uid, 1)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You Have the Black Sheep mount!")
    return true
end

Awesome man! it worked perfectly, thanks :D!
 
ugjuFmC.png
 
Back
Top