• 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 YurOTS 0.9.4d 7.6 - Lever - Switch

gianflogao

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

10ehpar.jpg


A - Create Stone id: 1304 "pos: 1027 1015 6"

4jp3bs.jpg


B - Switch id: 1945 "pos: 1027 1013 5"
(B- Creat and remove A);

Thanks!
 
Hello, @gianflogao

Try this.

Lua:
function onUse(cid, item, frompos, item2, topos)
    stone_pos = {x=1027, y=1015, z=6}
    stone = getThingfromPos(stone_pos)
    if item.actionid == 1234 and item.itemid == 1945 then
        doCreateItem(1304, 1, stone_pos)
    elseif item.actionid == 1234 and item.itemid == 1946 and stone.itemid > 0 then
        doRemoveItem(stone.uid, stone.type)
    end
    return 1
end
 
Hello, @gianflogao

Try this.

Lua:
function onUse(cid, item, frompos, item2, topos)
    stone_pos = {x=1027, y=1015, z=6}
    stone = getThingfromPos(stone_pos)
    if item.actionid == 1234 and item.itemid == 1945 then
        doCreateItem(1304, 1, stone_pos)
    elseif item.actionid == 1234 and item.itemid == 1946 and stone.itemid > 0 then
        doRemoveItem(stone.uid, stone.type)
    end
    return 1
end
Thanks, i go test :D
 
Lua:
    elseif item.actionid == 1234 and item.itemid == 1946 and stone.itemid > 0 then
        doRemoveItem(stone.uid, stone.type)

that part of code does not work;

Lua:
function onUse(cid, item, frompos, item2, topos)
    stone_pos = {x=1027, y=1015, z=6}
    stone = getThingfromPos(stone_pos)
    if item.actionid == 1234 and item.itemid == 1945 then
        doCreateItem(1304, 1, stone_pos)

This part worked out
 
Lua:
    elseif item.actionid == 1234 and item.itemid == 1946 and stone.itemid > 0 then
        doRemoveItem(stone.uid, stone.type)

that part of code does not work;

Lua:
function onUse(cid, item, frompos, item2, topos)
    stone_pos = {x=1027, y=1015, z=6}
    stone = getThingfromPos(stone_pos)
    if item.actionid == 1234 and item.itemid == 1945 then
        doCreateItem(1304, 1, stone_pos)

This part worked out

@gianflogao try:
Lua:
function onUse(cid, item, frompos, item2, topos)
    stone_pos = {x=1027, y=1015, z=6}
    stone = getThingfromPos(stone_pos)
    if item.actionid == 1234 and item.itemid == 1945 then
        doCreateItem(1304, 1, stone_pos)
    elseif item.actionid == 1234 and item.itemid == 1946 and stone.itemid > 0 then
        doRemoveItem(stone.uid, 1)
    end
    return 1
end
 
@gianflogao try:
Lua:
function onUse(cid, item, frompos, item2, topos)
    stone_pos = {x=1027, y=1015, z=6}
    stone = getThingfromPos(stone_pos)
    if item.actionid == 1234 and item.itemid == 1945 then
        doCreateItem(1304, 1, stone_pos)
    elseif item.actionid == 1234 and item.itemid == 1946 and stone.itemid > 0 then
        doRemoveItem(stone.uid, 1)
    end
    return 1
end

not work...

What can it be?
 
What if you tell me what happens because I cant help you with the message "not work...".

I need some details on whats going wrong.
sorry bro,

Lua:
function onUse(cid, item, frompos, item2, topos)
    stone_pos = {x=1027, y=1015, z=6}
    stone = getThingfromPos(stone_pos)
    if item.actionid == 1234 and item.itemid == 1945 then
        doCreateItem(1304, 1, stone_pos)

until this part the script works, after that the "lever" does not go to 1946 it stays in the 1945 ...

but the stone was created!
 
actions.xml
Code:
<action actionid="1234" script="levers/leverdepot.lua" />

scripts/levers/leverdepot.lua
Lua:
function onUse(cid, item, frompos, item2, topos)
    stone_pos = {x=1027, y=1015, z=6}
    stone = getThingfromPos(stone_pos)
    if item.actionid == 1234 and item.itemid == 1945 then
        doCreateItem(1304, 1, stone_pos)
    elseif item.actionid == 1234 and item.itemid == 1946 and stone.itemid > 0 then
        doRemoveItem(stone.uid, 1)
    end
    return 1
end

Switch in map : action: 1234
 
@53701688

Working...

Lua:
function onUse(cid, item, frompos, item2, topos)
piece1pos = {x=1027, y=1015, z=6, stackpos=1}
rockpos = {x=1027, y=1015, z=6, stackpos=1}
getpiece1 = getThingfromPos(piece1pos)
if item.uid == 7050 and item.itemid == 1945 then
doCreateItem(1355,1,rockpos)
doPlayerSendTextMessage(cid,22,"You add stone.")
doTransformItem(item.uid,item.itemid+1)
elseif item.uid == 7050 and item.itemid == 1946 then
doPlayerSendTextMessage(cid,22,"You remove stone.")
doSendMagicEffect(piece1pos,2)
doRemoveItem(getpiece1.uid,1)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendTextMessage(cid,22,"Sorry, not possible.")
end
return 1
end

Thanks broo!
 
Back
Top