Advertisement
Guest User

silence.lua

a guest
Jun 4th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.26 KB | None | 0 0
  1. local tarmonster = true -- Can we cast this spell on monsters. Default is true
  2. local ptime = 8000 -- This is how long the spell will last on a Player. Default is 8 seconds = 8000
  3. local mtime = 10000 -- This is how long the spell will last on a Monster. Default is 10 seconds = 10000
  4.  
  5. local combat = Combat()
  6. combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
  7. combat:setParameter(COMBAT_PARAM_AGGRESSIVE, true)
  8.  
  9. local mute = Condition(CONDITION_MUTED)
  10.  
  11. function onCastSpell(creature, var)
  12. local tar = creature:getTarget()
  13.  
  14.     if tar:getCondition(CONDITION_MUTED) then
  15.         return creature:sendTextMessage(MESSAGE_STATUS_SMALL, "This creature is already muted")
  16.     end
  17.     if tar:isPlayer() then
  18.         tar:say("^SILENCED^",TALKTYPE_MONSTER_SAY)
  19.         mute:setParameter(CONDITION_PARAM_TICKS, ptime)
  20.         combat:setCondition(mute)
  21.         return combat:execute(creature, tar)
  22.     end
  23.     if tar:isMonster() and tarmonster then
  24.         tar:say("^SILENCED^",TALKTYPE_MONSTER_SAY)
  25.         mute:setParameter(CONDITION_PARAM_TICKS, mtime)
  26.         combat:setCondition(mute)
  27.         return combat:execute(creature, tar)
  28.     else
  29.         return creature:sendTextMessage(MESSAGE_STATUS_SMALL, "You can only use this spell on Players.")
  30.     end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement