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

Lua [Actions] Use only in protection zone - need help

jajo776

New Member
Joined
Aug 27, 2015
Messages
40
Reaction score
2
Hi, could you help me with this script?. I would like to use this item only in pz zone. THANKS
function onUse(cid, item, fromPosition, itemEx, toPosition)
local newpos = {x = 226,y = 140,z = 7}


setPlayerStorageValue(cid, 50002, -1)
setPlayerStorageValue(cid, 50003, -1)
setPlayerStorageValue(cid, 50004, -1)
setPlayerStorageValue(cid, 50005, -1)
setPlayerStorageValue(cid, 50006, -1)
setPlayerStorageValue(cid, 50007, -1)
doRemoveItem(item.uid,1)
doTeleportThing(cid, newpos)
doSendMagicEffect(newpos, 121)
doCreatureSay(cid, 'Aura Reset!', TALKTYPE_ORANGE_1)

return true
end
 
Solution
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if not getTilePzInfo(getPlayerPosition(cid)) then
        doPlayerSendCancel(cid, "You must be inside protection zone.")
        return false
    end

    local newpos = {x = 226,y = 140,z = 7}

    setPlayerStorageValue(cid, 50002, -1)
    setPlayerStorageValue(cid, 50003, -1)
    setPlayerStorageValue(cid, 50004, -1)
    setPlayerStorageValue(cid, 50005, -1)
    setPlayerStorageValue(cid, 50006, -1)
    setPlayerStorageValue(cid, 50007, -1)

    doRemoveItem(item.uid,1)
    doTeleportThing(cid, newpos)
    doSendMagicEffect(newpos, 121)
    doCreatureSay(cid, 'Aura Reset!', TALKTYPE_ORANGE_1)

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

    if not getTilePzInfo(getPlayerPosition(cid)) then
        doPlayerSendCancel(cid, "You must be inside protection zone.")
        return false
    end

    local newpos = {x = 226,y = 140,z = 7}

    setPlayerStorageValue(cid, 50002, -1)
    setPlayerStorageValue(cid, 50003, -1)
    setPlayerStorageValue(cid, 50004, -1)
    setPlayerStorageValue(cid, 50005, -1)
    setPlayerStorageValue(cid, 50006, -1)
    setPlayerStorageValue(cid, 50007, -1)

    doRemoveItem(item.uid,1)
    doTeleportThing(cid, newpos)
    doSendMagicEffect(newpos, 121)
    doCreatureSay(cid, 'Aura Reset!', TALKTYPE_ORANGE_1)

    return true
end
 
Solution
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if not getTilePzInfo(getPlayerPosition(cid)) then
        doPlayerSendCancel(cid, "You must be inside protection zone.")
        return false
    end

    local newpos = {x = 226,y = 140,z = 7}

    setPlayerStorageValue(cid, 50002, -1)
    setPlayerStorageValue(cid, 50003, -1)
    setPlayerStorageValue(cid, 50004, -1)
    setPlayerStorageValue(cid, 50005, -1)
    setPlayerStorageValue(cid, 50006, -1)
    setPlayerStorageValue(cid, 50007, -1)

    doRemoveItem(item.uid,1)
    doTeleportThing(cid, newpos)
    doSendMagicEffect(newpos, 121)
    doCreatureSay(cid, 'Aura Reset!', TALKTYPE_ORANGE_1)

    return true
end
Thanks
 
Back
Top