Kill Words

I’m looking for someone to make a script that triggers the concommand “Kill” when a defined word is said in chat. If it’s possible, could the player also explode on death?

I’d really appreciate any help with this, Thanks in advance. :shobon:

Something like this?

[lua]local killwords = {
“kill”,
“lolwut”
}

local function explode(ply)
local explode = ents.Create(“env_explosion”)
explode:SetPos(ply:GetPos())
explode:Spawn()
explode:SetKeyValue(“iMagnitude”, “220”)
explode:Fire(“Explode”, 0, 0)
explode:EmitSound(“weapon_AWP.Single”, 400, 400)
ply:Kill()
end

hook.Add(“PlayerSay”, “Killwords”, function(ply, text)
for _, w in ipairs(killwords) do
if text:lower():find(w) then
explode(ply)
break
end
end
end)[/lua]

Goes in lua/autorun/server/ (untested)

Tested, works great. Thanks MakeR, you’re a life saver :buddy:

Well thats pretty ironic as this kills virtual people ::v:

Haha, I guess you’re right.

I just noticed something while using this script too, the env_explosion damages other players/props. Is there any way to stop this?

Anyone?

I don’t think theres a way to fix that unless you make it shoot them instead of exploding.

Set the iMagnitude to “0”.