• 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
8
Reaction score
1
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

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,903
Solutions
248
Reaction score
1,797
Location
Norway
GitHub
Znote
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
OP
J

jajo776

New Member
Joined
Aug 27, 2015
Messages
8
Reaction score
1
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
 
Top