maximumDoorLevel = 5000
function onUse(cid, item, frompos, item2, topos)
local cfg = {
level = 5000
}
if getPlayerLevel(cid) <= cfg.level then
pos = getPlayerPosition(cid)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,"stay in the front.")
return true
end
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerPopupFYI(cid, "You dont have level " .. cfg.level .. " to enter.")
end
return true
end
<action actionid="35000" event="script" value="level_door.lua"/>
yeah but how if i want lvl 10k?
If you want to make a gate of experience for such level, you need a custom actionID. I mean, no more "1100" or that, because the maximum action ID that can be set is 65535, so the higher level would be 5535 = 5k~ not 10k
You can try by putting a movement action in a floor tile that checks the player level and if the level is lower to 10k, then he will be teleported back, if not, he can pass through there. Just an idea.
local config = {
level = 20000
}
function onUse(cid, item, frompos, item2, topos)
if getPlayerLevel(cid) > config.level then
pos = getPlayerPosition(cid)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,"Stand in front of the door.")
return true
end
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,'You do not have enought level!')
end
return true
end
is it for 1 door
bec i have almost 20-30 doors xD
for different lvls
+i didnt get it much
level = 20000
<action actionid="2232" script="10kdoor.lua" />
local config = {
level = 10000 --How much level they need
}
function onUse(cid, item, frompos, item2, topos)
if getPlayerLevel(cid) > config.level then
pos = getPlayerPosition(cid)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,"Stand in front of the door.")
return true
end
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,'You do not have enought level!')
end
return true
end