QuestionSolvedTTT Death Notifier

Posts 17 of 7 · Page 1 of 1
TTT Death Notifier
Ive seen something like this before, havn't found anything with the search button.

I essentially just want something to notify me in chat when someone in the game dies. *I do not care if it shows who or what killed them.
This is what I have, if I am doing something wrong please lead me in the right direction.

Whats wrong: When I run it as a console command, it gives me "attempt to call a string value".

Code:
function DeathNotifier()
        for _, v in pairs(player.GetAll()) do
                if not ( v:Alive() ) then
                        chat.AddText(v:GetName() "has died.")
                end
        end
end
hook.Add( "PlayerDeath", "DeathNotifier", DeathNotifier )
concommand.Add("DeathNotifier", DeathNotifier)
You forgot to concatenate the name and the "has died" part.

Code:
chat.AddText(v:GetName() "has died.")
Code:
chat.AddText(v:GetName().." has died.")
I assume you're going to change the DeathNotifier function, because right now, it doesn't make sense with the hook.
I assume you're going to change the DeathNotifier function, because right now, it doesn't make sense with the hook.
I don't get what you mean? Sorry, noobie.
it loops through all the players and prints if they are dead

why

just print the player that was passed through the arguments
This is wrong.
PlayerDeath hook is not clientside.
hook player_death instead of PlayerDeath. it passes a table argument and you can do Player(data.userid) to get the player.
OP hasn't responded in a while so this will be closed.


//Solved
Posts 17 of 7 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?