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

TFS 0.X Spell that mute

zabuzo

Well-Known Member
Joined
Jun 10, 2016
Messages
238
Reaction score
54
Is it possible to make a spell that mute another player?
Really mute, so the other player can not even use exura gran, exura...

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, 21)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, true)

local condition = createConditionObject(CONDITION_MANASHIELD)
setConditionParam(condition, CONDITION_PARAM_TICKS, 200000)
setCombatCondition(combat, condition)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onCastSpell(cid, var)
    local requiredMana = (getPlayerLevel(cid) * spellcfg_exorimutethir_MPperLVLreq)
    if getPlayerMana(cid) >= requiredMana then
        doPlayerAddMana(cid, -requiredMana)
        doCombat(cid, combat, var)
        return true
    end
    return doPlayerSendCancel(cid, "You don't have mana. ["..tostring(requiredMana).."]")
end
 
Solution
Hi zabuzo,

I think the idea is genius.

For that we can use the function doMutePlayer(cid, time).

Do you need help to write the code or are you good with the information I gave you?

Best Wishes,
Okke
Hi zabuzo,

I think the idea is genius.

For that we can use the function doMutePlayer(cid, time).

Do you need help to write the code or are you good with the information I gave you?

Best Wishes,
Okke
 
Solution
Hi zabuzo,

I think the idea is genius.

For that we can use the function doMutePlayer(cid, time).

Do you need help to write the code or are you good with the information I gave you?

Best Wishes,
Okke

ty so much!
how can i doMutePlayer for the player in the area?
 
You can use this as base:

Did i make something wrong?

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, 21)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

local t = {}
function onTileCombat(cid, position)
    pid = getTopCreature(position).uid
    if pid > 0 then
        if pid ~= cid then
            table.insert(t, pid)
        end
    end
    return true
end

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)
setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTileCombat")

function onCastSpell(cid, var)
    local requiredMana = (getPlayerLevel(cid) * spellcfg_exorimutethir_MPperLVLreq)
    requiredMana = 0
    if getPlayerMana(cid) >= requiredMana then
        if doCombat(cid, combat, var) then
            for i = 1, #t do
                local pid = t[i]
                doCreatureSay(pid, "[2] Muted!", TALKTYPE_MONSTER, false)
                doMutePlayer(cid, 60)
                doPlayerAddCastMute(cid, 60)
                doCombat(cid, combat, var)
            end
            t = {}
        end
        doPlayerAddMana(cid, -requiredMana)
        return true
    end
    return doPlayerSendCancel(cid, "You don't have mana. ["..tostring(requiredMana).."]")
end

Everything looks working, target is saying [2] Muted!, but it is not muted at all
 
Back
Top