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

Solved Problem Scripts Level gates

darksta

New Member
Joined
Feb 10, 2010
Messages
39
Reaction score
0
My problem is that this has the required level will not open the door
Ot server Version 8.60
I hope helps

Code:
local puertas = { 1223, 1225, 1241, 1243, 1255, 1257, 3551, 3542, 5105, 5114, 5288, 5290, 6202, 6204, 6259, 6261, 7040, 7049, 6898, 6907, 7040, 7049 }

local level = 100 -- Nivel Necesario Para Usar Las Puertas

function onUse(cid, item, frompos, item2, topos)
  playerpos = getPlayerPosition(cid)
   
  doorpos = {x=frompos.x,  y=frompos.y,  z=frompos.z}

  if getPlayerLevel(cid) <= level then
    doPlayerSendTextMessage(cid,23,"Sorry, you are under of lvl "..level..".")
    return 1
  end

  if isInArray(puertas, item.itemid) == 1 then

    doTransformItem(item.uid, item.itemid+1)

    if playerpos.y == doorpos.y+1 and playerpos.x == doorpos.x then
        doMoveCreature(cid, 0)
    elseif playerpos.x == doorpos.x-1 and playerpos.y == doorpos.y then
        doMoveCreature(cid, 1)
    elseif playerpos.y == doorpos.y-1 and playerpos.x == doorpos.x then
        doMoveCreature(cid, 2)
    elseif playerpos.y == doorpos.y and playerpos.x == doorpos.x+1 then
        doMoveCreature(cid, 3)
    elseif playerpos.x == doorpos.x+1 and playerpos.y == doorpos.y-1 then
        doMoveCreature(cid, 4)
    elseif playerpos.x == doorpos.x-1 and playerpos.y == doorpos.y-1 then
        doMoveCreature(cid, 5)
    elseif playerpos.x == doorpos.x+1 and playerpos.y == doorpos.y+1 then
        doMoveCreature(cid, 6)
    elseif playerpos.x == doorpos.x-1 and playerpos.y == doorpos.y+1 then
        doMoveCreature(cid, 7)
    end

  else
    return 0
  end

  return 1
end
 
don't use this
Code:
if getPlayerLevel(cid) <= level then
    doPlayerSendTextMessage(cid,23,"Sorry, you are under of lvl "..level..".")
use
Code:
if getPlayerLevel(cid) >= level then
blablablabla open door blabla
            else
                  
doPlayerSendCancel(cid, "you're not level 100 yet")
 
Code:
  if getPlayerLevel(cid) < level then
    doPlayerSendTextMessage(cid,23,"Sorry, you are under of lvl "..level..".")
    return 1
  end
 
Code:
  if getPlayerLevel(cid) < level then
    doPlayerSendTextMessage(cid,23,"Sorry, you are under of lvl "..level..".")
    return true
  end

It does not work: s


don't use this
Code:
if getPlayerLevel(cid) <= level then
    doPlayerSendTextMessage(cid,23,"Sorry, you are under of lvl "..level..".")
use
Code:
if getPlayerLevel(cid) >= level then
blablablabla open door blabla
            else
                
doPlayerSendCancel(cid, "you're not level 100 yet")

I want to know exactly how to put that in my scripts

is that not a lot of scripts: s
 
Code:
if isInArray(puertas, item.itemid) > 0 then

use both parts I posted.


Error in console


[08/09/2013 22:21:05] [Error - Action Interface]
[08/09/2013 22:21:05] data/actions/scripts/lvlsdoor100.lua:eek:nUse
[08/09/2013 22:21:05] Description:
[08/09/2013 22:21:05] data/actions/scripts/lvlsdoor100.lua:16: attempt to compare number with boolean
[08/09/2013 22:21:05] stack traceback:
[08/09/2013 22:21:05] data/actions/scripts/lvlsdoor100.lua:16: in function <data/actions/scripts/lvlsdoor100.lua:6>


Help me :C
 
Why don't you just use a gate of expertise with actionid as leveldoor, or is it supposed to do something else aswell?
Anyway, you can just teleport the player to the doorpos (toPosition), instead of moving the player in different directions.
And the function isInArray works with true or false.
Code:
if isInArray(puertas, item.itemid) == TRUE then
or
Code:
if isInArray(puertas, item.itemid) then
This both checks if it's true.
 
Why don't you just use a gate of expertise with actionid as leveldoor, or is it supposed to do something else aswell?
Anyway, you can just teleport the player to the doorpos (toPosition), instead of moving the player in different directions.
And the function isInArray works with true or false.
Code:
if isInArray(puertas, item.itemid) == TRUE then
or
Code:
if isInArray(puertas, item.itemid) then
This both checks if it's true.


thanks men, I served pretty your help
and solved the problem
Thank you!
 
Back
Top