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

Lua Multiple Lever

jestem pro

That is the question
Joined
Apr 20, 2013
Messages
650
Solutions
14
Reaction score
88
Hello, everyone and pretty girls :D

Version: 8.6(0.3.6)
Description: A player can choose how many players can take part.

I had a first and quick thought, and I wanna make something like this:
3ohc0S3uqGLLnFIDo4

giphy.gif

So I made this:
LUA:
local pos2 = {x=880, y=975, z=7}
local pos3 = {x=881, y=975, z=7}
local pos4 = {x=882, y=975, z=7}

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

    if getStorage(84657) == -1 then
            doSetStorage(84657, 0)
           doTransformItem(getTileItemById(pos2, 18465).uid, 11059)
        elseif getStorage(84657) == 0 then
            doSetStorage(84657, 1)
           doTransformItem(getTileItemById(pos3, 18465).uid, 11059)
        elseif getStorage(84657) == 1 then
            doSetStorage(84657, 2)
           doTransformItem(getTileItemById(pos4, 18465).uid, 11059)
        elseif getStorage(84657) == 2 then
            doSetStorage(84657, -1)
           doTransformItem(getTileItemById(pos2, 11059).uid, 18465)
           doTransformItem(getTileItemById(pos3, 11059).uid, 18465)
           doTransformItem(getTileItemById(pos4, 11059).uid, 18465)
    end
 return true
end

yeah there should be a loop, but it's not what I want to know.

I thought how to solve that in other way. So, is there a solution more optimal and better than by storage?
I think there isn't, but I'm still thinking.

Thanks for any suggestions.
 
Two ways.

Check for the specific tile's itemID to be present before counting/teleporting players.
or
Just teleport all players on the tiles without counting them.
 
Back
Top