• 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 System Storage - Door 7.6

gianflogao

Member
Joined
Jun 6, 2014
Messages
134
Solutions
2
Reaction score
13
Hello guys,

I'm trying to create a system for my Yurots 7.6 server, and I need help from some experienced.

Since the server is XML, and does not have some current server roles, then I'll have to improvise.

Item name: vip scroll
Item Id: 2345

Storage: 5007

actions.xml
Lua:
<action itemid="2345" script="vip.lua" />

actions/scripts/vip.lua

Lua:
function onUse(cid, item)
   if getPlayerStorageValue(cid, 5007) < 1 then
      setPlayerStorageValue(cid, 5007, 1)
      doRemoveItem(item.uid, 1)
   end
   return true
end
as you can see he can only use 1x the item.
I wanted to get the message:
You added 30 days vip to your character.

after already having the "storage":
You already have VIP in your character.

I would like to see the door script with "storage" if someone helps me too ... Because I do not have.
 
Solution
For the scroll:
Code:
function onUse(cid, item)
    if getPlayerStorageValue(cid, 5007) < 1 then
        setPlayerStorageValue(cid, 5007, 1)
        doRemoveItem(item.uid, 1)
        doPlayerSendTextMessage(cid,22,'You added 30 VIP days to your character.')
    else
        doPlayerSendTextMessage(cid,22,'You already have VIP in your character.')
    end
   return true
end

And now the door:
Code:
function onUse(cid, item, frompos, item2, topos)
local vipStorage = 5007

    if getPlayerStorageValue(cid, vipStorage) >= 1 then
        pos = getPlayerPosition(cid)

            if pos.x == topos.x then
                if pos.y < topos.y then
                    pos.y = topos.y + 1
                else
                    pos.y = topos.y - 1...
For the scroll:
Code:
function onUse(cid, item)
    if getPlayerStorageValue(cid, 5007) < 1 then
        setPlayerStorageValue(cid, 5007, 1)
        doRemoveItem(item.uid, 1)
        doPlayerSendTextMessage(cid,22,'You added 30 VIP days to your character.')
    else
        doPlayerSendTextMessage(cid,22,'You already have VIP in your character.')
    end
   return true
end

And now the door:
Code:
function onUse(cid, item, frompos, item2, topos)
local vipStorage = 5007

    if getPlayerStorageValue(cid, vipStorage) >= 1 then
        pos = getPlayerPosition(cid)

            if pos.x == topos.x then
                if pos.y < topos.y then
                    pos.y = topos.y + 1
                else
                    pos.y = topos.y - 1
            end
            elseif pos.y == topos.y then
                if pos.x < topos.x then
                    pos.x = topos.x + 1
                else
                    pos.x = topos.x - 1
            end
            else
                doPlayerSendTextMessage(cid,22,'Stand in front of the door.')
                return 1
            end

            doTeleportThing(cid, pos)
            doSendMagicEffect(topos, 12)
        else
            doPlayerSendTextMessage(cid,22,'You need VIP to pass this door.')
        end
    return true
end
See how similar it is to a previous help thread you created, this time around, instead of checking for the player level, it checks for the storage value that you assigned trough the scroll. Hope you find it useful n_n
 
Solution
For the scroll:
Code:
function onUse(cid, item)
    if getPlayerStorageValue(cid, 5007) < 1 then
        setPlayerStorageValue(cid, 5007, 1)
        doRemoveItem(item.uid, 1)
        doPlayerSendTextMessage(cid,22,'You added 30 VIP days to your character.')
    else
        doPlayerSendTextMessage(cid,22,'You already have VIP in your character.')
    end
   return true
end

And now the door:
Code:
function onUse(cid, item, frompos, item2, topos)
local vipStorage = 5007

    if getPlayerStorageValue(cid, vipStorage) >= 1 then
        pos = getPlayerPosition(cid)

            if pos.x == topos.x then
                if pos.y < topos.y then
                    pos.y = topos.y + 1
                else
                    pos.y = topos.y - 1
            end
            elseif pos.y == topos.y then
                if pos.x < topos.x then
                    pos.x = topos.x + 1
                else
                    pos.x = topos.x - 1
            end
            else
                doPlayerSendTextMessage(cid,22,'Stand in front of the door.')
                return 1
            end

            doTeleportThing(cid, pos)
            doSendMagicEffect(topos, 12)
        else
            doPlayerSendTextMessage(cid,22,'You need VIP to pass this door.')
        end
    return true
end
See how similar it is to a previous help thread you created, this time around, instead of checking for the player level, it checks for the storage value that you assigned trough the scroll. Hope you find it useful n_n
Thanks Bro <3
 
Back
Top