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

Use lever to remove a stone...

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
Hi there, well Im very noob at scripting... =(
I tried to make an script that when use the lever with aid x, it removes a stone id y from pos n...

I didn't knew how to do this, can someone make it for me please?
 
Actions/actions.xml
Code:
<action uniqueid="3002" script="demon.lua"/>

actions/scripts/demon.lua
LUA:
function onUse(cid, item, frompos, item2, topos)
gatepos = {x=1421, y=1508, z=11, stackpos=1}
getgate = getThingfromPos(gatepos)

if item.itemid == 1945 and getgate.itemid == 1355 then
doRemoveItem(getgate.uid,1)
doTransformItem(item.uid,item.itemid+1)
elseif item.itemid == 1946
and getgate.itemid == 0 then
doCreateItem(1355,1,gatepos)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return true
end
The lever has to have uniqueid 3002, if actionid change the line in actions.xml
rep if I helped :)
 
Actions/actions.xml
Code:
<action uniqueid="3002" script="demon.lua"/>

actions/scripts/demon.lua
LUA:
function onUse(cid, item, frompos, item2, topos)
gatepos = {x=1421, y=1508, z=11, stackpos=1}
getgate = getThingfromPos(gatepos)

if item.itemid == 1945 and getgate.itemid == 1355 then
doRemoveItem(getgate.uid,1)
doTransformItem(item.uid,item.itemid+1)
elseif item.itemid == 1946
and getgate.itemid == 0 then
doCreateItem(1355,1,gatepos)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return true
end
The lever has to have uniqueid 3002, if actionid change the line in actions.xml
rep if I helped :)

Better for him :

Code:
<action uniqueid="YYYY" script="demon.lua"/>

actions/scripts/demon.lua
LUA:
function onUse(cid, item, frompos, item2, topos)
local stonepos = {x=1421, y=1508, z=11, stackpos=1}
local getgate = getThingfromPos(stonepos)
local stoneID = XXXX

if item.itemid == 1945 and getgate.itemid == stoneID then
doRemoveItem(getgate.uid,1)
doTransformItem(item.uid,item.itemid+1)
elseif item.itemid == 1946
and getgate.itemid == 0 then
doCreateItem(stoneID,1,stonepos)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return true
end

Replace XXXX with your stone ID
Replace YYYY with your unique ID
 
Last edited:
Ehh, I though he can do it by himself - he will guess what he have to write/change :)
Anyway your is better because we have to write all in start of script :P
 
Better for him :

Code:
<action uniqueid="YYYY" script="demon.lua"/>

actions/scripts/demon.lua
LUA:
function onUse(cid, item, frompos, item2, topos)
local gatepos = {x=1421, y=1508, z=11, stackpos=1}
local getgate = getThingfromPos(gatepos)
local stoneID = XXXX

if item.itemid == 1945 and getgate.itemid == stoneID then
doRemoveItem(getgate.uid,1)
doTransformItem(item.uid,item.itemid+1)
elseif item.itemid == 1946
and getgate.itemid == 0 then
doCreateItem(stoneID,1,gatepos)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return true
end

Replace XXXX with your stone ID
Replace YYYY with your unique ID

Du är Bäst Xd hur gör man rep ska göra till dig
 
Back
Top