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
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
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
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
[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>
where would I put this? Global events?
<event type="advance" name="Scriptname" event="script" value="Scriptname.lua"/>