Create a file called tp_back.lua in data/movements/scripts and add this:
Lua Code:
function onStepIn(cid, item, position, fromPosition)
if item.actionid == 12000 then
if getPlayerStorageValue(cid, 65535) == nil then
doTeleportThing(cid, fromPosition)
doCreatureSay(cid, "You cannot enter here.", TALKTYPE_ORANGE_1)
end
return TRUE
end
return TRUE
end
Add this to data/movements/movements.xml
Lua Code:
<movevent type="StepIn" actionid="12000" event="script" value="tp_back.lua"/>
Explain: If player try to enter in a teleport (with actionid 12000) and if he does not have a storage (65535) then he can't enter. Other script
Create a file called level_tp.lua in data/creaturescripts/scripts and add this:
Lua Code:
local levelLimit = 100
local fromPosition = { x = 100, y = 100, z = 7 }
local toPosition = { x = 150, y = 150, z = 7 }
local newPosition = { x = 50, y = 50, z = 7 }
function onAdvance(cid, skill, oldlevel, newlevel)
if(skill == SKILL__LEVEL) then
if(getPlayerLevel(cid) >= levelLimit and isInArea(getCreaturePosition(cid), fromPosition, toPosition)) then
doTeleportThing(cid, newPosition)
end
end
return TRUE
end
Add this to data/creaturescripts/creaturescripts.xml
Lua Code:
<event type="advance" name="LevelTP" event="script" value="level_tp.lua"/>
Now add this in data/creaturescript/scripts/login.lua
(Under function onLogin(cid))
Lua Code:
registerCreatureEvent(cid, "LevelTP")
Explain: If player reaches the level limit(100) and is in an area (noobArea) then he will be teleported to other position
Lua Code:
local fromPosition = { x = 100, y = 100, z = 7 } --from position of the area
local toPosition = { x = 150, y = 150, z = 7 } --to position of the area
local newPosition = { x = 50, y = 50, z = 7 } --position where the player will be teleported
Example: