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

Function

psychosisneamia

~Beginner~
Joined
Jun 7, 2012
Messages
162
Reaction score
7
I need help with an item.. I am trying to make an item that will send you to town when clicked.. that part is simple.. What i need it to do is not let you tp if you are in a PVP battle with another player but if you're battling a normal monster u can still use it..

The function i used was
Code:
 if (getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE) then

But then I get the else message
Code:
 doCreatureSay(cid, "You may not use your temple scroll while in a battle!", TALKTYPE_MONSTER)

Any idea what function i can use? Thanks so much!
 
Code:
 local scroll = 1949
local temple = {x=153, y=50, z=7}
local level = 1

function onUse(cid, item, frompos, item2, topos)
        if isPlayerPzLocked(cid==TRUE) then
        doTeleportThing(cid, temple, TRUE)
    else
       doCreatureSay(cid, "You may not use your temple scroll while in a battle!", TALKTYPE_MONSTER)
    end
return 1
end

Like this?
 
Code:
 local scroll = 1949
local temple = {x=153, y=50, z=7}
local level = 1

function onUse(cid, item, frompos, item2, topos)
if isPlayerPzLocked(cid) then
doTeleportThing(cid, temple, FALSE)
doCreatureSay(cid, "You cannot teleport while pz locked!", 19)
else
doTeleportThing(cid, temple, TRUE)
doCreatureSay(cid, "Teleported!", 19)
end
return true
end
 
Code:
doTeleportThing(cid, temple, FALSE)
This still teleports the player, with false you don't see the player being pushed if it gets teleported 1 square next to it.
 
I get my message that I am in a battle but I am not. Doesn't tp me at all.
Code:
local scroll = 1949
local temple = {x=153, y=50, z=7}
local level = 1

function onUse(cid, item, frompos, item2, topos)
if isPlayerPzLocked(cid) then
doTeleportThing(cid, temple, TRUE)
else
doCreatureSay(cid, "You may not use your temple scroll while in a battle!", TALKTYPE_MONSTER)
end
return 1
end
 
I get my message that I am in a battle but I am not. Doesn't tp me at all.
Code:
local scroll = 1949
local temple = {x=153, y=50, z=7}
local level = 1

function onUse(cid, item, frompos, item2, topos)
if isPlayerPzLocked(cid) then
doTeleportThing(cid, temple, TRUE)
else
doCreatureSay(cid, "You may not use your temple scroll while in a battle!", TALKTYPE_MONSTER)
end
return 1
end

because you wrote it wrong

Code:
local scroll = 1949
local temple = {x=153, y=50, z=7}
local level = 1

function onUse(cid, item, frompos, item2, topos)
if not isPlayerPzLocked(cid) then
doTeleportThing(cid, temple, TRUE)
else
doCreatureSay(cid, "You may not use your temple scroll while in a battle!", TALKTYPE_MONSTER)
end
return true
end
 
Ty so much <3 =D
Is there a way to restrict the item from being used in an entire town? Example if its a town thats PVP if ur out in the pvp section it cant be used?
 
You can use isInRange
Code:
if isInRange(getPlayerPosition(cid), {x = 100, y = 100, z = 5}, {x = 200, y = 200, z = 7}) then
     return doPlayerSendCancel(cid, "You can't use this here.")
end
 
Back
Top