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

Item usage - battle/pvp restriction

Swiff

Member
Joined
Apr 6, 2009
Messages
366
Reaction score
12
Location
Sweden
Hello!

I have an item that I don't want players to use if they are in any kind of battle. For obvious reasons:

LUA:
function onUse(cid, item, frompos, item2, topos)
player1pos = getPlayerPosition(cid)
player1 = getThingfromPos(player1pos)
if player1.itemid > 0 then
temple = {x=223, y=223, z=7}
doSendMagicEffect(topos,12)
doTeleportThing(player1.uid,temple)
doSendMagicEffect(temple,12)
doPlayerSendTextMessage(player1.uid,22,"Temple!")
end
end

I guess you might see why. I don't know howto implent it into the script though, if anyone could help me out, It'd be appriciated! =)

(Using TFS 0.3.6pl1)
 
LUA:
function onUse(cid, item, frompos, item2, topos)
     temple = {x=223, y=223, z=7}

     if (getCreatureCondition(cid, CONDITION_INFIGHT) == false) then
          doSendMagicEffect(topos, 12)
          doTeleportThing(cid, temple)
          doSendMagicEffect(temple, 12)
          doPlayerSendTextMessage(cid, 22, "Temple!")
     else
          doPlayerSendTextMessage(cid, 22, "You may not use this item while in combat!")
     end

     return true
end
 
Last edited by a moderator:
Hm, this works if the player has white skull only? you are not PzLocked when you fight monsters in a quest for example.

I don't want this to work in any kind of battle. Thanks anyhow:)
 
Back
Top