• 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 Support rep++

Snakie

New Member
Joined
Apr 15, 2010
Messages
263
Reaction score
4
Hey guys i got this tp stoone, it teleports a player to a tempel as soon as he lost pz i wannt to set time on it like 10 seconds, when a player lost hes pz he clicks on the tp stoone and when 10 secs gone by and he didnt gain pz he gets tped to the temple.
Can somebody add this function and post the new rescripted script here? :)
Here comes the script hope someone can help me!



function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getThingPos(cid)
if getTileInfo(pos).protection then
doPlayerSendCancel(cid, 'You cannot use this inside a protection zone.')
elseif getCreatureCondition(cid, CONDITION_INFIGHT) then
doPlayerSendCancel(cid, 'You can\'t teleport immediately after fight.')
else
doTeleportThing(cid, getPlayerMasterPos(cid))
doSendMagicEffect(pos, 66)
doSendAnimatedText(pos, 'Teleport!', 16)
return true
end
return doSendMagicEffect(pos, CONST_ME_POFF)
end
 
Lua:
local event = {}

function countdown(cid, n)
	if isPlayer(cid) and not getCreatureCondition(cid, CONDITION_INFIGHT) then
		local pos = getThingPos(cid)
		if not getTileInfo(pos).protection then
			if n == 0 then
				doTeleportThing(cid, getPlayerMasterPos(cid))
				doSendMagicEffect(pos, 66)
				doSendAnimatedText(pos, 'Teleport!', 16)
			else
				doSendAnimatedText(pos, n, COLOR_RED)
				event[cid] = addEvent(countdown, 1000, cid, n - 1)
				return
			end
		end
	end
	event[cid] = nil
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local pos = getThingPos(cid)
	if getTileInfo(pos).protection then
		doPlayerSendCancel(cid, 'You cannot use this inside a protection zone.')
	elseif getCreatureCondition(cid, CONDITION_INFIGHT) then
		doPlayerSendCancel(cid, 'You can\'t teleport immediately after fight.')
	elseif event[cid] then
		doPlayerSendCancel(cid, 'You have already initiated the teleport process.')
	else
		countdown(cid, 10)
		return true
	end
	return doSendMagicEffect(pos, CONST_ME_POFF)
end
 
Back
Top