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

skrypt transform item

xexam

New Member
Joined
Aug 3, 2010
Messages
172
Reaction score
1
mam tyle

function onUse(cid, item, fromPosition, itemEx, toPosition)
local stone_id = 1304
local pos = {x = 776, y = 831, z = 8}
local stone = getTileItemById(pos, stone_id)
if stone.uid > 0 then
doRemoveItem(stone.uid)
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
addEvent(function() doCreateItem(stone_id, 1, pos) end, 5*1000)
doCreatureSay(cid, "You have removed the first stone. You have 5 seconds to pass!", TALKTYPE_ORANGE_1)
return true
else
return doPlayerSendCancel(cid,"The stone is already removed.")
end
end


po przesunięciu dźwigni kamień znika na 5 sekund. po tym czasie pojawia się, ale dźwignia nie wraca do pierwotnej pozycji (1945) jak to zrobić? próbowalem z addevent transform item ale nie wychodzi. dodatkowo chce żeby po tych 5 sekundach był efekt CONST_ME_TELEPORT na miejscu dźwigni. Ktoś pomoże?
 
Code:
function onBack(item)
	doTransformItem(item.uid, 1945)
	doSendMagicEffect(pos, CONST_ME_TELEPORT)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
local stone_id = 1304
local pos = {x = 776, y = 831, z = 8}
local stone = getTileItemById(pos, stone_id)
	if stone.uid > 0 then
		doRemoveItem(stone.uid)
		doTransformItem(item.uid, 1946)
		addEvent(function() doCreateItem(stone_id, 1, pos) end, 5*1000)
		addEvent(onBack, doTransformItem(item.uid, 1945), 5*1000, item)
		doCreatureSay(cid, "You have removed the first stone. You have 5 seconds to pass!", TALKTYPE_ORANGE_1)
		return true
	else
	return doPlayerSendCancel(cid,"The stone is already removed.")
	end
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local stone_id = 1304
local pos = {x = 1000, y = 1000, z = 7}
local stone = getTileItemById(pos, stone_id)
	if stone.uid > 0 then
		doRemoveItem(stone.uid)
		doTransformItem(item.uid, 1946)
		addEvent(function() doCreateItem(stone_id, 1, pos) doTransformItem(item.uid, 1945) end, 5*1000)
		doCreatureSay(cid, "You have removed the first stone. You have 5 seconds to pass!", TALKTYPE_ORANGE_1)
		return true
	else
	return doPlayerSendCancel(cid,"The stone is already removed.")
	end
end

Z magic effect
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local stone_id = 1304
local pos = {x = 776, y = 831, z = 8}
local stone = getTileItemById(pos, stone_id)
local leverPos = { x = xxxx, y = yyyy, z = z }
	if stone.uid > 0 then
		doRemoveItem(stone.uid)
		doTransformItem(item.uid, 1946)
		addEvent(function() doCreateItem(stone_id, 1, pos) doTransformItem(item.uid, 1945) doSendMagicEffect(leverPos, CONST_ME_TELEPORT) end, 5*1000)
		doCreatureSay(cid, "You have removed the first stone. You have 5 seconds to pass!", TALKTYPE_ORANGE_1)
		return true
	else
	return doPlayerSendCancel(cid,"The stone is already removed.")
	end
end
 
Last edited:
Code:
function onBack(item)
	doTransformItem(item.uid, 1945)
	doSendMagicEffect(pos, CONST_ME_TELEPORT)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
local stone_id = 1304
local pos = {x = 776, y = 831, z = 8}
local stone = getTileItemById(pos, stone_id)
	if stone.uid > 0 then
		doRemoveItem(stone.uid)
		doTransformItem(item.uid, 1946)
		addEvent(function() doCreateItem(stone_id, 1, pos) end, 5*1000)
		addEvent(callBack, doTransformItem(item.uid, 1945), 5*1000, item)
		doCreatureSay(cid, "You have removed the first stone. You have 5 seconds to pass!", TALKTYPE_ORANGE_1)
		return true
	else
	return doPlayerSendCancel(cid,"The stone is already removed.")
	end
end
 
dżwignia nie wraca do położenia 1945, po pierwszym przerzuceniu zmienia sie na 1946 i tak zostaje caly czas przy następnych uzyciach
 
Ma działac
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local stone_id = 1304
local pos = {x = 776, y = 831, z = 8}
local leverPos = {x = xxxx, y = yyyy, z = z} -- pozycja dzwigni
local stone = getTileItemById(pos, stone_id)
	if stone.uid > 0 then
		doRemoveItem(stone.uid)
		doTransformItem(item.uid, 1946)
		addEvent(onBack, 5*1000, item, stone_id, pos, leverPos)
		doCreatureSay(cid, "You have removed the first stone. You have 5 seconds to pass!", TALKTYPE_ORANGE_1)
		return true
	else
	return doPlayerSendCancel(cid,"The stone is already removed.")
	end
end

function onBack(item, stone_id, pos, leverPos)
	doCreateItem(stone_id, 1, pos)
	doTransformItem(item.uid, 1945)
	doSendMagicEffect(pos, CONST_ME_TELEPORT)
	doSendMagicEffect(leverPos, CONST_ME_TELEPORT)
end
 
Back
Top