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

Get Teleported to a place on lvl 10! Rep!

zippy

Member
Joined
Feb 1, 2011
Messages
233
Reaction score
8
I need a script when the player reach level 10 he get tped to 1000 1000 7!

REp
 
PHP:
local c = {
	pos = {x=1000,y=1000,z=7},
	time = 5,
	level = 10
}
 
local function countTele(pid, delay)
	if delay == c.time then
		doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, "You have reached the level ".. c.level ..", you will be automatically teleported to a quest for your level.")
	end
	if delay > 0 then
		doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_ORANGE, "You will be transported to your quest for the level ".. c.level .." in ".. delay .." second".. (delay > 1 and "s." or ".")) 
		addEvent(countTele, 1000, pid, delay - 1)
	else
		doTeleportThing(pid, c.pos)
		doSendMagicEffect(c.pos, CONST_ME_TELEPORT)
		doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_ORANGE, "You do was teleported to the quest of level ".. c.level ..", defeat all creatures and rescue your rewards.")
	end
	return true
end
 
function onAdvance(cid, skill, oldlevel, newlevel)
if skill == SKILL__LEVEL then
	if newlevel == 10 then
		countTele(cid, c.time)
	end
end
	return true
end

:)
 
I tryed to make a script but i cant just get it work, could someone correct my problem and fix the script:

Code:
function onAdvance(cid, skill, oldLevel, newLevel)
    if skill == SKILL__LEVEL and newLevel == 10 then
        doTeleportThing(cid, { x = 1000, y = 1000, z = 7, true })
        setPlayerStorageValue(cid,9999, 1)
        return true
    end
 
  if getPlayerStorageValue(cid, 9999) >=1 then
  doTeleportThing(cid, { x = 1000, y = 1000, z = 7, false})
  return false
end
end
 
data/creaturescripts/scripts/script.lua

LUA:
local storage = 12345
function onAdvance(cid, skill, oldlevel, newlevel)
	if(skill == SKILL__LEVEL and newLevel >= 10) then
		if(getPlayerStorageValue(cid, storage) < 1) then
			doTeleportThing(cid, {x = 100, y = 100, z = 7}, false)
			setPlayerStorageValue(cid, storage, 1)
		end
	end
	return true
end

Or if you want it to happen more than once per character:

LUA:
function onAdvance(cid, skill, oldlevel, newlevel)
	if(skill == SKILL__LEVEL and newLevel >= 10) then
		doTeleportThing(cid, {x = 100, y = 100, z = 7}, false)
	end
	return true
end
Don't forget to register the event in login.lua and add the event in creaturescripts.xml. :thumbup:
 
Last edited:
I get this error, it doesnt matter which level the player is i get this error:

Code:
[22/03/2012 15:39:42] [Error - CreatureScript Interface] 
[22/03/2012 15:39:42] data/creaturescripts/scripts/lvl.lua:onAdvance
[22/03/2012 15:39:42] Description: 
[22/03/2012 15:39:42] data/creaturescripts/scripts/lvl.lua:2: attempt to compare number with nil
[22/03/2012 15:39:42] stack traceback:
[22/03/2012 15:39:42] 	data/creaturescripts/scripts/lvl.lua:2: in function <data/creaturescripts/scripts/lvl.lua:1>
 
Back
Top