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

Entering in door with X skills or magic level

Vrotz

Member
Joined
Apr 7, 2011
Messages
1,071
Reaction score
7
Location
Brazil
Hi guys,

I need a door or tile that the player can only entering if him have a X amount of SKILL or magic level.

How i do it?
 
Last edited:
it's easy
you can use "onUse" function
and make it check skill level
Code:
getPlayerSkillLevel(cid, skillid)
                Info
                    This function checks player skill level.
                        Skillid can be:
                            SKILL_FIST (0) = Fist Fighting
                            SKILL_CLUB (1) = Club Fighting
                            SKILL_SWORD (2) = Sword Fighting
                            SKILL_AXE (3) = Axe Fighting
                            SKILL_DISTANCE (4) = Distance Fighting
                            SKILL_SHIELD (5) = Shielding
                            SKILL_FISHING (6) = Fishing

if he has require things :D door will open
i'm kinda sleepy so i can't give full script
 
Thanks for helping bro! But i dont know how to do it, I don't know to mess with scripts. Therefore i need help xD

I can try.. Like that?

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerSkillLevel(cid, skillid)
????


kkkk, sorry.
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerSkillLevel(cid, 2) > 20 --sword id == 2
doTeleportThing(cid, fromPosition, TRUE)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements.")
end
return true
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerSkillLevel(cid, 2) > 20 --sword id == 2
doTeleportThing(cid, fromPosition, TRUE)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements.")
end
return true
end

How i do to the JUST vocation can entering in the door? So, to get skill of sword u need to be a knights..

EDIT: oh sorry bro!
 
[Error - LuaInterface::loadFile] data/actions/scripts/quests/door.lua:3: 'then' expected near 'doTeleportThing'
[Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/door.lua)
data/actions/scripts/quests/door.lua:3: 'then' expected near 'doTeleportThing'

What is it?
 
try this but not tested
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isSorcerer(cid) or isDruid(cid) then
        if getPlayerMagLevel(cid) >= 20 then
            doTeleportThing(cid, fromPosition, TRUE)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , you need magic level 20 to use this.")
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , only sorcerer or druid can use this.")
    end

    if isKnight(cid) then
        if getPlayerSkillLevel(cid, 1) >= 20 or getPlayerSkillLevel(cid, 2) >= 20 or getPlayerSkillLevel(cid, 3) >= 20 then
            doTeleportThing(cid, fromPosition, TRUE)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , you need club or sword or axe level 20 to use this.")
        end   
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , only knight can use this.")   
    end
   
    if isPaladin(cid) then
        if getPlayerSkillLevel(cid, 4) >= 20 then
            doTeleportThing(cid, fromPosition, TRUE)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , you need distance level 20 to use this.")
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , only paladin can use this.")
    end
return TRUE
end
 
that last script is 4 scripts in 1 script :P
1 for knight and based on all skill ids - "club - sword - axe"
1 for paladin and based on skill id - "distance"
1 for sorcerer and druid based on magicLevel


you need to cut this script in pieces
 
for Sorcerer and Druid
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isSorcerer(cid) or isDruid(cid) then
        if getPlayerMagLevel(cid) >= 20 then
            doTeleportThing(cid, fromPosition, TRUE)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , you need magic level 20 to use this.")
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , only sorcerer or druid can use this.")
    end
return TRUE
end

for Knight
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isKnight(cid) then
        if getPlayerSkillLevel(cid, 1) >= 20 or getPlayerSkillLevel(cid, 2) >= 20 or getPlayerSkillLevel(cid, 3) >= 20 then
            doTeleportThing(cid, fromPosition, TRUE)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , you need club or sword or axe level 20 to use this.")
        end   
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , only knight can use this.")   
    end
return TRUE
end

for Paladin
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPaladin(cid) then
        if getPlayerSkillLevel(cid, 4) >= 20 then
            doTeleportThing(cid, fromPosition, TRUE)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , you need distance level 20 to use this.")
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , only paladin can use this.")
    end
return TRUE
end

i say it again .. not tested
if those have errors ... i will fix tomorrow
 
for Sorcerer and Druid
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isSorcerer(cid) or isDruid(cid) then
        if getPlayerMagLevel(cid) >= 20 then
            doTeleportThing(cid, fromPosition, TRUE)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , you need magic level 20 to use this.")
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , only sorcerer or druid can use this.")
    end
return TRUE
end

for Knight
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isKnight(cid) then
        if getPlayerSkillLevel(cid, 1) >= 20 or getPlayerSkillLevel(cid, 2) >= 20 or getPlayerSkillLevel(cid, 3) >= 20 then
            doTeleportThing(cid, fromPosition, TRUE)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , you need club or sword or axe level 20 to use this.")
        end  
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , only knight can use this.")  
    end
return TRUE
end

for Paladin
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPaladin(cid) then
        if getPlayerSkillLevel(cid, 4) >= 20 then
            doTeleportThing(cid, fromPosition, TRUE)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , you need distance level 20 to use this.")
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , only paladin can use this.")
    end
return TRUE
end

i say it again .. not tested
if those have errors ... i will fix tomorrow

No have erros and working perfect! So, when u USE door I stay on top of.. I need move to sqm front! How i do it brah?
 
You can use a gate of expertise door, then so the doors goes open.
Code:
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, toPosition)

You can also do it like the vip doors, so the door won't be openened at all, but you only get teleported to the other side.
http://otland.net/threads/the-best-vip-system-ever-action-movevent-globalevent.71638/

Like that brah?
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isKnight(cid) then
if getPlayerSkillLevel(cid, 1) >= 20 or getPlayerSkillLevel(cid, 2) >= 20 or getPlayerSkillLevel(cid, 3) >= 20 then
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, toPosition)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , you need club or sword or axe level 20 to use this.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are not meeting the requirements , only knight can use this.")
end
return TRUE
end
 
Back
Top