AD
pedido

Apenas X vocation id pode atacar X monstro

Por AdilsonHacker, 18 de jun. de 2015 em Scripts

resolvido
script
48
5.9k
zipter98Z
25 de junho de 2015 às 20:40
Melhor resposta

Ué, você configurou corretamente o nome do monstro no código (letras maiúsculas e minúsculas fazem diferença)?

local config = {
    name = "xxx",    --nome do monstro
    vocId = xxx,     --vocation id
}
function onTarget(cid, target)
    if isMonster(cid) and isPlayer(target) then
        if getPlayerVocation(target) ~= config.vocId then
            return false
        end
    elseif isPlayer(cid) and isMonster(target) then
        if getCreatureName(target) == config.name and getPlayerVocation(cid) ~= config.vocId then
            return doPlayerSendCancel(cid, "você não pode atacar esta criatura.") and false
        end
    end
    return true
end
function onStatsChange(cid, attacker, type, combat, value)
    if isMonster(attacker) and isPlayer(cid) then
        if getPlayerVocation(cid) ~= config.vocId then
            return false
        end
    elseif isPlayer(attacker) and isMonster(cid) and type == STATSCHANGE_HEALTHLOSS then
        if getCreatureName(cid) == config.name and getPlayerVocation(attacker) ~= config.vocId then
            return doPlayerSendCancel(attacker, "você não pode atacar esta criatura.") and false
        end
    end
    return true
end

Editado Junho 26 por zipter98

AdilsonHackerA
25 de junho de 2015 às 23:45

Perfeito.

Grato.

BrunoB
29 de junho de 2015 às 16:36

Tópico movido para a seção de dúvidas e pedidos resolvidos.