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

Player is in combat Lua function[TFS 1.0]

Ovnyx

Member
Joined
Jul 25, 2017
Messages
163
Solutions
2
Reaction score
7
Hi guys im actually using TFS 1.0 and wanted to know what lua function should i use to know if the player is in combat or not?

i tried with this ones but i cand get it:

Code:
if isPlayerPzLocked(cid) then

Code:
getCreatureCondition(cid, condition[, subId])

im using this in my script so it can be executed with a action, only if the player is not in combat.

hope, someone could help me, and thanks in advice...
 
something just like this:

Lua:
if getCreatureCondition(cid, CONDITION_INFIGHT) then
 
hi thanks for answering, i already tried with that but i dont know why it doesnt work :/ always throws error
 
if player:getCondition(CONDITION_INFIGHT) then
 
hmm thanks for your answer, but it throws error too :/ says like attempt to index global 'player' (a nil value) with the 2 diferrent lua functions
what this error means?
 
you need a player object
local player = Player(cid)
 
yea already did that take a look:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
  
    if player:getCondition(CONDITION_INFIGHT) then
        player:sendCancelMessage("You are in combat.")
    else
      
        doCreatureSay(cid, '$$$', TALKTYPE_MONSTER_SAY)
      
    end
end
it is not throwing error now, i was declaring local player only in the if lol, but now trying like this it only enter to the else, even if i have or no pz
 
yea already did that take a look:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
 
    if player:getCondition(CONDITION_INFIGHT) then
        player:sendCancelMessage("You are in combat.")
    else
  
        doCreatureSay(cid, '$$$', TALKTYPE_MONSTER_SAY)
  
    end
end
it is not throwing error now, i was declaring local player only in the if lol, but now trying like this it only enter to the else, even if i have or no pz
Lua:
 if player:getCondition(CONDITION_INFIGHT) == true then

At least on older tfs you need to do this.
Won't hurt to try. ;p
 
hey it finally works with
Code:
if getCreatureCondition(cid, CONDITION_INFIGHT) then

the thing was it was working but i had a very long pzlocked time, the question is, how can i see the combat swords if im in a protected zone? it is not showing them when present in a protected zone like temple

thanks a lot!!
 
Back
Top