Ir para conteúdo

Featured Replies

Postado

Bom dia TK, queria saber se alguém pode me dar uma força? No meu servidor tem uma Spell chamada "Muted", eu quero que ela tenha porcentagem em acerta e falhar, entende?

se alguém poder me ajudar ficarei muito grato.

 

Script da Magia.

 

local condition = createConditionObject(CONDITION_MUTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)

local chance = 50

function silence(tar, text)
    if(isCreature(tar) == true) then
        doSendAnimatedText(getCreaturePosition(tar), text, 215)
        doAddCondition(tar, condition)
    end
    return true
end

function onCastSpell(cid, var)
if not isPlayer(cid) then return true end
    if exhaustion.check(cid, 13117) == TRUE then
        doPlayerSendCancel(cid, "Podera usar novamente dentro de 15 segundos.")
        doSendMagicEffect(getCreaturePosition(cid), 2)
        return false
    end
    local tar = getCreatureTarget(cid)
    if hasCondition(tar, CONDITION_MUTED) == true then
        return false
    else
        if isCreature(tar) == true then
            if math.random(1,50) <= chance then
                local text = "SILENCE"
                silence(tar, text)     
            else
                local text = "MISS"
                doSendAnimatedText(getCreaturePosition(tar), text, 215)
            end
            else
                if isCreature(cid) == true then
                    doPlayerSendCancel(cid, "Silence can be cast only on other creatures.")
                end
            return false
        end
    end
    exhaustion.set(cid, 13117, 15.0)
    return true
end

 

Editado por Mikethekingsz (veja o histórico de edições)

Resolvido por 139

Ir para solução
Postado
Spoiler

local condition = createConditionObject(CONDITION_MUTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)

local chance = 50

function silence(tar, text)
    if(isCreature(tar) == true) then
        doSendAnimatedText(getCreaturePosition(tar), text, 215)
        doAddCondition(tar, condition)
    end
    return true
end

function onCastSpell(cid, var)
if not isPlayer(cid) then return true end
if math.random(1,100) > chance then return true end
    if exhaustion.check(cid, 13117) == TRUE then
        doPlayerSendCancel(cid, "Podera usar novamente dentro de 15 segundos.")
        doSendMagicEffect(getCreaturePosition(cid), 2)
        return false
    end
    local tar = getCreatureTarget(cid)
    if hasCondition(tar, CONDITION_MUTED) == true then
        return false
    else
        if isCreature(tar) == true then
            if math.random(1,50) <= chance then
                local text = "SILENCE"
                silence(tar, text)     
            else
                local text = "MISS"
                doSendAnimatedText(getCreaturePosition(tar), text, 215)
            end
            else
                if isCreature(cid) == true then
                    doPlayerSendCancel(cid, "Silence can be cast only on other creatures.")
                end
            return false
        end
    end
    exhaustion.set(cid, 13117, 15.0)
    return true
end

 

Postado
  • Solução
local chance = 50

local condition = createConditionObject(CONDITION_MUTED)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)

function onCastSpell(cid, var)
    if not isPlayer(cid) then 
        return false 
    end
    if math.random(1,100) > chance then 
        doSendAnimatedText(getCreaturePosition(cid), "Miss!", 215)    
        return false 
    end
    if exhaustion.check(cid, 13117) == true then
        doPlayerSendCancel(cid, "Podera usar novamente dentro de 15 segundos.")
        doSendMagicEffect(getCreaturePosition(cid), 2)
        return false
    end
    local tar = variantToNumber(var)
    if hasCondition(tar, CONDITION_MUTED) == true then
        return false
    else
        if isPlayer(tar) == true then
            doAddCondition(tar, condition)
            doSendAnimatedText(getCreaturePosition(tar), "Silenced!", 215)
        else
            doPlayerSendCancel(cid, "Silence can be cast only on other players.")
            return false
        end
    end
    exhaustion.set(cid, 13117, 15.0)
    return true
end

 

Editado por 139 (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo