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

auto teleport to temple

Kareem

New Member
Joined
Jun 23, 2008
Messages
9
Reaction score
0
Hi all,
i need a script, that auto teleports the player to temple, after staying 5 minutes at a spawn

for example, its a boss spawn, so players just keep staying at the spawn preventing it from Respawning...i just need a script so if they stayed more than 5 minutes there, they get teleported to temple

Thanks :)
 
If you know how to script, make a onstepin with a storage, then if they have that storage for more than 5minutes it teleports them to temple and removes the storage. I cant do it for you now because im busy but yeah thats how i would do it...
 
Movement on tiles:

LUA:
function onStepIn(cid, item, frompos, itemEx, topos)

local c = {
	storage = 1337
	}
	
if getPlayerStorageValue(cid, c.storage) == -1 then
	setPlayerStorageValue(cid, c.storage, 1)
else
	return false
	end
end

global event
LUA:
function onThink(interval, lastExecution, thinkInterval)

local c = {
	storage = 1337,
	pos = getPlayerMasterPos(cid)
	}
	
if getPlayerStorageValue(cid, c.storage) == 1 and isPlayerPzLocked(cid) == true then
	return false
else
	doTeleportThing(cid, pos)
		doPlayerSendTextMessage(cid, "You have been kicked from the boss spawn.")
			setPlayerStorageValue(cid, c.storage, 0)
		return true
	end
end
 
Movement on tiles:

LUA:
function onStepIn(cid, item, frompos, itemEx, topos)

local c = {
	storage = 1337
	}
	
if getPlayerStorageValue(cid, c.storage) == -1 then
	setPlayerStorageValue(cid, c.storage, 1)
else
	return false
	end
end

global event
LUA:
function onThink(interval, lastExecution, thinkInterval)

local c = {
	storage = 1337,
	pos = getPlayerMasterPos(cid)
	}
	
if getPlayerStorageValue(cid, c.storage) == 1 and isPlayerPzLocked(cid) == true then
	return false
else
	doTeleportThing(cid, pos)
		doPlayerSendTextMessage(cid, "You have been kicked from the boss spawn.")
			setPlayerStorageValue(cid, c.storage, 0)
		return true
	end
end

[02/10/2011 14:25:19] [Error - GlobalEvent Interface]
[02/10/2011 14:25:19] data/globalevents/scripts/kick.lua:onThink
[02/10/2011 14:25:19] Description:
[02/10/2011 14:25:19] (internalGetPlayerInfo) Player not found when requesting player info #7

[02/10/2011 14:25:19] [Error - GlobalEvent Interface]
[02/10/2011 14:25:19] data/globalevents/scripts/kick.lua:onThink
[02/10/2011 14:25:19] Description:
[02/10/2011 14:25:19] (luaGetCreatureStorage) Creature not found

[02/10/2011 14:25:19] [Error - GlobalEvent Interface]
[02/10/2011 14:25:19] data/globalevents/scripts/kick.lua:onThink
[02/10/2011 14:25:19] Description:
[02/10/2011 14:25:20] attempt to index a nil value
[02/10/2011 14:25:20] stack traceback:
[02/10/2011 14:25:20] [C]: in function 'doTeleportThing'
[02/10/2011 14:25:20] data/globalevents/scripts/kick.lua:11: in function <data/globalevents/scripts/kick.lua:1>
[02/10/2011 14:25:20] [Error - GlobalEvents::think] Couldn't execute event: bosskick
 
This should fix the globalevent.
LUA:
function onThink(interval, lastExecution, thinkInterval)
 
local c = {
	storage = 1337,
	pos = getPlayerMasterPos(cid)
	}
 
 
for _,cid in ipairs(getPlayersOnline()) do
	if getPlayerStorageValue(cid, c.storage) == 1 and isPlayerPzLocked(cid) == true then
	return false
elseif getPlayerStorageValue(cid, c.storage) == 1 and isPlayerPzLocked(cid) == false then
	doTeleportThing(cid, pos)
		doPlayerSendTextMessage(cid, "You have been kicked from the boss spawn.")
			setPlayerStorageValue(cid, c.storage, 0)
		return true
		end
	end
end
Although what distro do you use?
 
This should fix the globalevent.
LUA:
function onThink(interval, lastExecution, thinkInterval)
 
local c = {
	storage = 1337,
	pos = getPlayerMasterPos(cid)
	}
 
 
for _,cid in ipairs(getPlayersOnline()) do
	if getPlayerStorageValue(cid, c.storage) == 1 and isPlayerPzLocked(cid) == true then
	return false
elseif getPlayerStorageValue(cid, c.storage) == 1 and isPlayerPzLocked(cid) == false then
	doTeleportThing(cid, pos)
		doPlayerSendTextMessage(cid, "You have been kicked from the boss spawn.")
			setPlayerStorageValue(cid, c.storage, 0)
		return true
		end
	end
end
Although what distro do you use?

No need to loop(?
Just add the cid parameter at the onThink function, it already contains it.
 
This should fix the globalevent.
LUA:
function onThink(interval, lastExecution, thinkInterval)
 
local c = {
	storage = 1337,
	pos = getPlayerMasterPos(cid)
	}
 
 
for _,cid in ipairs(getPlayersOnline()) do
	if getPlayerStorageValue(cid, c.storage) == 1 and isPlayerPzLocked(cid) == true then
	return false
elseif getPlayerStorageValue(cid, c.storage) == 1 and isPlayerPzLocked(cid) == false then
	doTeleportThing(cid, pos)
		doPlayerSendTextMessage(cid, "You have been kicked from the boss spawn.")
			setPlayerStorageValue(cid, c.storage, 0)
		return true
		end
	end
end
Although what distro do you use?

[03/10/2011 18:16:56] [Error - GlobalEvent Interface]
[03/10/2011 18:16:56] data/globalevents/scripts/kick.lua:onThink
[03/10/2011 18:16:56] Description:
[03/10/2011 18:16:56] (internalGetPlayerInfo) Player not found when requesting player info #7
[03/10/2011 18:16:56] [Error - GlobalEvents::think] Couldn't execute event: bosskick

i use The Forgotten Server, version 0.3.6 (Crying Damson)
 
I think thismay work:
Code:
local mTime = 5
event1 = addEvent(doTeleportThing, mTime * 60 * 1000, cid, getPlayerMasterPos(cid))
function onStepIn(cid, item, fromPos, itemEx, toPos)
if isPlayer(cid) then
return event1
end
return true
end

function onStepOut(cid, item, fromPos, itemEx, toPos)
if isPlayer(cid) then
stopEvent(event1)
end
return true
end

And you add 2 lines on movements.xml, one onStepIn and another onStepOut, and you put action id on the tiles where you want to execute the script...

Only 1 problem with script, if player continues moving, it stops the script :/
 
Back
Top