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

Lua Help with script

MxSoft

Leave Tibia, Live Life.
Joined
Dec 22, 2009
Messages
1,804
Solutions
1
Reaction score
43
Location
Mexico
Code:
  local config = {
        exhaustionInSeconds = 420,
        storage = 36531
}
function onSay(cid, words, param)
local player = getPlayerByName(param)
if(isPlayer(player) == TRUE) then

if(exhaustion.check(cid, config.storage) == TRUE) then
                doPlayerSendCancel(cid, "You can teleport players only 1 time per " .. config.exhaustionInSeconds .. " seconds.")
                return TRUE
        end
 if (getPlayerLevel(cid) > 80) then
  if (getPlayerLevel(player) <= 80) then
   if(doPlayerAddSoul(cid, -100) == TRUE) then
    exhaustion.set(cid, config.storage, config.exhaustionInSeconds)
    doTeleportThing(player, getTownTemplePosition(getPlayerTown(player)))
   else
    doPlayerSendCancel(cid,"You dont have 100 soul points.")
   end
  else
   doPlayerSendCancel(cid,"This player have lvl higher than 80.")
  end
 else
  doPlayerSendCancel(cid,"Your level is too low.")
 end
else
 doPlayerSendCancel(cid,"This players doesn exist, or is offline.")
end
        if getTilePzInfo(toPosition) == true then
                  return doPlayerSendCancel(cid, "Sorry, not possible.")
                 end
return TRUE
end
Here i just need that when player is in pz zona cant be teleported.
But i dont find how to make it works
 
Code:
  local config = {
        exhaustionInSeconds = 420,
        storage = 36531
}
function onSay(cid, words, param)
local player = getPlayerByName(param)
if(isPlayer(player) == TRUE) then

if(exhaustion.check(cid, config.storage) == TRUE) then
                doPlayerSendCancel(cid, "You can teleport players only 1 time per " .. config.exhaustionInSeconds .. " seconds.")
                return TRUE
        end
if (getPlayerLevel(cid) > 80) then
  if (getPlayerLevel(player) <= 80) then
   if(doPlayerAddSoul(cid, -100) == TRUE) then
    exhaustion.set(cid, config.storage, config.exhaustionInSeconds)
    doTeleportThing(player, getTownTemplePosition(getPlayerTown(player)))
   else
    doPlayerSendCancel(cid,"You dont have 100 soul points.")
   end
  else
   doPlayerSendCancel(cid,"This player have lvl higher than 80.")
  end
else
  doPlayerSendCancel(cid,"Your level is too low.")
end
else
doPlayerSendCancel(cid,"This players doesn exist, or is offline.")
end
        if getTilePzInfo(toPosition) == true then
                  return doPlayerSendCancel(cid, "Sorry, not possible.")
                 end
return TRUE
end
Here i just need that when player is in pz zona cant be teleported.
But i dont find how to make it works

Try it:

Code:
local config =
{
pz = true, --
}
(..)

  if config.pz == true and getTilePzInfo(getCreaturePosition(cid)) == FALSE then
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"U must go to a Protection Zone!")
   return true
   end
 
Didnt worked
Try:

Code:
  local config = {
        exhaustionInSeconds = 420,
        pz = true,
        storage = 36531
}
function onSay(cid, words, param)
local player = getPlayerByName(param)
if(isPlayer(player) == TRUE) then

if(exhaustion.check(cid, config.storage) == TRUE) then
                doPlayerSendCancel(cid, "You can teleport players only 1 time per " .. config.exhaustionInSeconds .. " seconds.")
                return TRUE
        end
if config.pz == true and getTilePzInfo(getCreaturePosition(cid)) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"U must go to a Protection Zone!")
return true
end

if (getPlayerLevel(cid) > 80) then
  if (getPlayerLevel(player) <= 80) then
   if(doPlayerAddSoul(cid, -100) == TRUE) then
    exhaustion.set(cid, config.storage, config.exhaustionInSeconds)
    doTeleportThing(player, getTownTemplePosition(getPlayerTown(player)))
   else
    doPlayerSendCancel(cid,"You dont have 100 soul points.")
   end
  else
   doPlayerSendCancel(cid,"This player have lvl higher than 80.")
  end
else
  doPlayerSendCancel(cid,"Your level is too low.")
end
else
doPlayerSendCancel(cid,"This players doesn exist, or is offline.")
end
return TRUE
end
 
Last edited:
if getTilePzInfo(toPosition) == true then
return doPlayerSendCancel(cid, "Sorry, not possible.")
end

to

if getTilePzInfo(getCreaturePosition(cid)) == true then -- true or false
return doPlayerSendCancel(cid, "Sorry, not possible.")
end
 
Back
Top