hello i want npc who shot player when he say bad word something like queen eloise in carlin she shot for max hp -1 and player have only 1 hp i have that script
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local fire = createConditionObject(CONDITION_FIRE)
addDamageCondition(fire, 4, 6000, -20)
addDamageCondition(fire, 4, 6000, -10)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink()
npcHandler:onThink()
talk = math.random(1,40)
if talk == 1 then
selfSay("LONG LIVE THE QUEEN!")
end
end
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return FALSE
end
if msgcontains(msg, 'job') then
selfSay("My duty is to protect this town from wild monsters.")
elseif msgcontains(msg, 'king') then
selfSay("I would protect the king with my own like if necessary!")
elseif msgcontains(msg, 'ass') or msgcontains(msg, 'craw') or msgcontains(msg, 'fuck') or msgcontains(msg, 'suck') or msgcontains(msg, 'dick') then
selfSay("Take this!")
doCreatureSay(cid, "Ouch!", TALKTYPE_ORANGE_1)
doTargetCombatCondition(0, cid, fire, CONST_ME_NONE)
elseif msgcontains(msg, 'heal') and getCreatureHealth(cid) < 65 then
selfSay("You're hurt, let me heal you.")
heal = 65 - getCreatureHealth(cid)
doCreatureAddHealth(cid, heal)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
elseif msgcontains(msg, 'heal') and getCreatureHealth(cid) >= 65 then
selfSay("You don't need to be healed.")
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())