Npc Death

hacuna

Well-Known Member
Joined
Sep 24, 2010
Messages
19
Reaction score
0
Is it possible to create a npc "Death", when a player pays an amount and speaks a name, npc kills the chosen player?
 

LazyBear

So lazy
Joined
Nov 27, 2018
Messages
48
Reaction score
35
If you'd add something like that, I'd never play your server.
 

Xikini

I whore myself out for likes
Joined
Nov 17, 2010
Messages
3,928
Reaction score
2,048
Yes, it's possible.
Lua:
if msgcontains(msg, "kill") and talkState[talkUser] == 0 then
    selfSay("Please tell me the name of the person you want to kill.", cid)
    talkState[talkUser] = 1

elseif talkState[talkUser] == 1 then
    for _, pid in ipairs(getPlayersOnline()) do
        if msg:lower() == getCreatureName(pid):lower() then
            doCreatureAddHealth(pid, -(getCreatureHealth(pid)))
            selfSay("Player " .. msg:lower() .. " has been killed.", cid)
            talkState[talkUser] = 2
            break
        end
    end
    if talkState[talkUser] == 1 then
        selfSay("Player " .. msg:lower() .. " cannot be found.", cid)
    end
    talkState[talkUser] = 0

end
 
Top