• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Teleport with count down

kimokimo

Kimo
Joined
Jan 25, 2011
Messages
821
Solutions
6
Reaction score
156
GitHub
karimadnan
Hello

how i can add a count down on this script?

PHP:
local createpos = {x=x,y=y,z=z}
local topos = {x=x,y=y,z=z}
local msg = "................!"
local timetoclose = 120          -- in second
 
local function remove()
                local tp = getTileItemById(createpos,1387).uid
                if tp > 0 then
                        doRemoveItem(tp)
                        doBroadcastMessage(msg)
                end
        end
function onSay(cid, words, param)
        doCreateTeleport(1387, topos, createpos)
        doBroadcastMessage(".......................!")
        addEvent(remove,timetoclose*1000)
        return true
end
i think it will be something like this but how i merge with the script above?

PHP:
		for x = 1, cfg.time do
		local n = cfg.time - x
			addEvent(doSendAnimatedText, x * 1000, toPosition, n > 0 and tostring(n), TEXTCOLOR_WHITE)
		end
 
I have no idea if this will work.. ;p it uses global storage to count the time and it should be 15mins now, well try it and see what hapends xD if its working at all i will be able to make it work full else idk. :)

Code:
local createpos = {x=x,y=y,z=z} 
local topos = {x=x,y=y,z=z} 
local msg = "................!" 
local timetoclose = 1000          -- in second 
local countdown = setGlobalStorageValue(17001, getGlobalStorageValue(17001)+1)
  
local function remove() 
                local tp = getTileItemById(createpos,1387).uid 
                if tp > 0 then 
                        doRemoveItem(tp) 
                        doBroadcastMessage(msg) 
						
                end 
        end 
function onSay(cid, words, param) 
        doCreateTeleport(1387, topos, createpos) 
		
        doBroadcastMessage("" .. 16-getGlobalStorageValue(17001) .. " min left") 
        addEvent(remove,timetoclose*60*60) 
        addEvent(countdown, 1000*60) 
        return true 
end
 
LUA:
local c = {
	createpos = {x=861, y=93, z=8},
	topos = {x=865, y=93, z=8},
	msg = "bla bla tp nicht mehr da!",
	timetoclose = 120
}

function onSay(cid, words, param)
	doCreateTeleport(1387, c.topos, c.createpos)
	doBroadcastMessage("Blabla bla tp ist da!")
	addEvent(removeTP, 5000, c.timetoclose)
	return true
end

function removeTP(sek)
	if(sek > 0) then
		doBroadcastMessage("Blabla bla in " .. sek .. " sek nicht da.")
		addEvent(removeTP, 6000, sek - 6)
	elseif(sek == 0) then
		local tp = getTileItemById(c.createpos, 1387).uid
		if tp > 0 then
			doRemoveItem(tp)
			doBroadcastMessage(c.msg)
		end
	end
end
 
och ;)
what version of TFS do you have?

LUA:
-- ver. 2.1, 2011-11-30
-- author tfs, otland.net/members/andypsylon :)
local c = {
	createpos = {x=860, y=93, z=8}, -- /goto 861, 93, 8
	topos = {x=865, y=93, z=8},
	msg = "bla bla tp nicht mehr da!",
	timetoclose = 5
}

local function removeTP(sek)
	if(sek > 0) then
		local spectators = getSpectators(c.createpos, 7, 7)
		for _, pid in ipairs(spectators) do
			doPlayerSendTextMessage(pid, MESSAGE_EXPERIENCE_OTHERS, "Blabla bla in " .. sek .. " sek nicht da.", sek, COLOR_WHITE, c.createpos)
		end
		return addEvent(removeTP, 1000, sek - 1)
	elseif(sek == 0) then
		local tp = getTileItemById(c.createpos, 1387).uid
		if tp > 0 then
			doRemoveItem(tp)
			doBroadcastMessage(c.msg)
		end
	end
end

function onSay(cid, words, param)
	doCreateTeleport(1387, c.topos, c.createpos)
	doBroadcastMessage("Blabla bla tp ist da!")
	addEvent(removeTP, 1000, c.timetoclose)
	return true
end
 
Last edited:
Back
Top