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

Lvl cap area

FLE

Member
Joined
Oct 5, 2008
Messages
422
Reaction score
24
Location
Vancouver Canada
I havent seen this anywhere.... and i am curious how it works/ i need it for an area on my OT.

I need A script of some sort... that will tele a player back to his city if he is past "xx" lvl , for example... i have a noob area... players are abusing it and botting there... i need to cap that so players of lvl 50 will be auto kicked... something like "Island of destiny" how it kicks u at half way to lvl 10!

please help! THX!!


:)
 
Lua:
local config = {
    type = "teleport", -- teleport \ kick
    levelToKick = 10,
    Pos = { x = 100, y = 100, z = 7 }
}

function onAdvance(cid, skill, oldlevel, newlevel)
    if skill == 8 and newlevel >= config.levelToKick then
        if config.type == "teleport" then
            doTeleportThing(cid, config.Pos) 
        elseif config.type == "kick" then
            doTeleportThing(cid, config.Pos) 
            doRemoveCreature(cid)
        else
            return FALSE
        end
    end		
    return TRUE
end
 
Last edited:
creaturescripts/creaturescripts.xml

PHP:
    <event type="advance" name="TpAtUp" event="script" value="TpAtUp.lua" />

creaturescripts/scripts/TpAtUp.lua

Lua:
  local config = {
    type = "teleport", -- teleport \ kick
    levelToKick = 10,
    Pos = { x = 100, y = 100, z = 7 }
}

function onAdvance(cid, skill, oldlevel, newlevel)
    if skill == 8 and newlevel >= config.levelToKick then
        if config.type == "teleport" then
            doTeleportThing(cid, config.Pos)
        elseif config.type == "kick" then
            doTeleportThing(cid, config.Pos)
            doRemoveCreature(cid)
        else
            return FALSE
        end
    end        
    return TRUE
end

creaturescripts/scripts/login.lua

before return TRUE
add
Lua:
    registerCreatureEvent(cid, "TpAtUp")
 
Ok hey bro, it doesn't seem to work...
how do i set it for a specific area?
please explain that part :s

im a little confused, i apologize for my noobieness ;)
 
please explain that part if you get a chance :p

i know the script kicks people but if u know how the island of destiny works.... it only kicks you from a specific area...

your script kicks people to a certain position once they reach a certain level, but this place on my server is accesible from the main temple, and people can go back there.... so i need something that doesn't allow them to stay in there... does that make sense?
 
Just put this at the entrance of the area.

Code:
  local config = {
    Pos = { x = 100, y = 100, z = 7 }
}

function onStepIn(cid, item, position, fromPosition)
    if getPlayerLevel(cid) > 8 then
            doTeleportThing(cid, config.Pos)
            end
end
 
Just use the function from "isInArea(pos, fromPos, toPos)"

Here it is:

Lua:
  local config = {
    type = "teleport", -- teleport \ kick
    levelToKick = 10,
    Pos = { x = 100, y = 100, z = 7 },
	fromPos = { x = 104, y = 104, z = 7 },
	toPos = { x = 108, y = 104, z = 7 }
}

function onAdvance(cid, skill, oldlevel, newlevel)
    if skill == 8 and newlevel >= config.levelToKick and isInArea(getPlayerPosition(cid), config.fromPos, config.toPos) == TRUE then
        if config.type == "teleport" then
            doTeleportThing(cid, config.Pos)
        elseif config.type == "kick" then
            doTeleportThing(cid, config.Pos)
            doRemoveCreature(cid)
        else
            return FALSE
        end
    end        
    return TRUE
end

Edit the area! (toPos, fromPos) in the config.
 
Back
Top