LU
dúvida

Função Que Informa Se O Player Possui Um Target

Por LuckOake, 27 de ago. de 2012 em Scripts

7
756
LuckOakeL
27 de agosto de 2012 às 22:55

Existe alguma função que informe se o player possui ou não um target?

 

Tipo:

 

function onSay(cid, words)
if hasTarget(cid) then
doCreatureSay(cid, "Sou um peixe-ogro com afro loiro bebendo tequila", TALKTYPE_MONSTER)
end
return true
end

 

Procurei nas funções do meu server e não achei nada a respeito.

Editado Agosto 27 por LuckOake

VincV
27 de agosto de 2012 às 23:11

usa getCreatureTarget,alem de fase isso ele ja vai pega qual é o target.

LuckOakeL
27 de agosto de 2012 às 23:14

Não, já tentei e não funcionou com o getCreatureTarget.

notle2012N
27 de agosto de 2012 às 23:15

usa esse

if (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then

LuckOakeL
27 de agosto de 2012 às 23:17

@notle2012

 

Não posso usar esse, pois o player pode estar com Battle sem ter target.

SkymagnumS
27 de agosto de 2012 às 23:22

if getCreatureTarget(cid) ~= 0 then

 

Exemplo

 

function onSay(cid, words, param)
if getCreatureTarget(cid) ~= 0 then
doPlayerSendTextMessage(cid, 27, "Você está atacando o [ " .. getCreatureName(getCreatureTarget(cid)) .. " ] . ")
end
return doPlayerSendTextMessage(cid, 28, "Você não tem target")
end

Editado Agosto 27 por Skymagnum

EskyloE
27 de agosto de 2012 às 23:30

if getCreatureTarget(cid) > 0 then

 

tem target

else

nao tem

end