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

[Help]Problem with my script.

chito

Learning Lua
Joined
Apr 18, 2008
Messages
87
Reaction score
1
Location
Mexico
This is my script, it removes a walls on certain time and then add again, the problem is that there is a stair i want it to transform into a white tile and then into the stair again. When i pull the switch all works except to transform the stairs into the tile.
Please help me.

Code:
function onUse(cid, item, frompos, item2, topos)
local minutes = 0
local seconds = 30

	stone1 = {x=208, y=209, z=3, stackpos=1}
	getstone1 = getThingfromPos(stone1)

	stone2 = {x=208, y=207, z=3, stackpos=1}
	getstone2 = getThingfromPos(stone2)
	
	stone3 = {x=210, y=206, z=3, stackpos=1}
	getstone3 = getThingfromPos(stone3)
	
	stone4 = {x=213, y=206, z=3, stackpos=1}
	getstone4 = getThingfromPos(stone4)

	stone5 = {x=212, y=208, z=3, stackpos=1}
	getstone5 = getThingfromPos(stone5)

	if item.actionid == 7000 and item.itemid == 1945 then
		doRemoveItem(getstone1.uid,1)
		doRemoveItem(getstone2.uid,1)
		doRemoveItem(getstone3.uid,1)
		doRemoveItem(getstone4.uid,1)
		doTransformItem(getstone5.uid,1)
		doCreateItem(406,1,stone5)
		addEvent(timeToPas,(1000*60*minutes) + (1000*seconds))
	else
		doPlayerSendTextMessage(cid, 22, 'You already switched the tile.')
	end
end

function timeToPas()
	doCreateItem(1025,1,stone1)
	doCreateItem(1025,1,stone2)
	doCreateItem(1026,1,stone3)
	doCreateItem(1026,1,stone4)
	doCreateItem(4835,1,stone5)
	return TRUE
end
 
1. Just put a white tile under the stairs.
2. when pull liver DONT transfer but DELETE the stairs and your done =)
 
In your map editor give the downstair tile in your image a uniqueID then use that in the doTransformItem function, also get the itemID of the white tile.

doTransformItem(uniqueID, white tile itemID)

Jo3
 
Same error Sad

(I'M SURE THIS MIGHT BUG FROM TIME TO TIME)
Try

if item.actionid == 7000 and item.itemid == 1945 then
doRemoveItem(getstone1.uid,1)
doRemoveItem(getstone2.uid,1)
doRemoveItem(getstone3.uid,1)
doRemoveItem(getstone4.uid,1)
doCreateItem(TILE ITEM ID, 1, pos)
ADD FEW MILLISECONDS DELAY HERE
doCreateItem(406,1,stone5)



Anywais get me the item id of the while tile and the black tile i got another idea


THis function might work bether
doTransformItem(itemEx.uid, itemEx.itemid + 1)
 
Yeah, works now, i have one more question after pulling the switch they can keep pulling it and giving me error how do i avoid them?

Thanks in advance.

@Edit
After that dont works again because it loses the unique id.
 
(I'M SURE THIS MIGHT BUG FROM TIME TO TIME)
Try

if item.actionid == 7000 and item.itemid == 1945 then
doRemoveItem(getstone1.uid,1)
doRemoveItem(getstone2.uid,1)
doRemoveItem(getstone3.uid,1)
doRemoveItem(getstone4.uid,1)
doCreateItem(TILE ITEM ID, 1, pos)
ADD FEW MILLISECONDS DELAY HERE
doCreateItem(406,1,stone5)



Anywais get me the item id of the while tile and the black tile i got another idea


THis function might work bether
doTransformItem(itemEx.uid, itemEx.itemid + 1)

I tryed that the tile appears one floor below.
 
Yeah, works now, i have one more question after pulling the switch they can keep pulling it and giving me error how do i avoid them?

Thanks in advance.

@Edit
After that dont works again because it loses the unique id.

Is there a function to set an item's uniqueID?

Jo3
 
Back
Top