Is there some way I could hide death messages? I see it alot on servers… I’m sorry if this is a dumb message… But it’s really bugging me, because I don’t want people to know who killed them.
Yes, since the old gmod wiki is dead right now, i dont know to code to block only death messages so all i can suggest is that you rewrite the HUDPaint, that will stop the entire hl2 hud from apearing. When the wiki gets back up i might write here again with correct code for that.
To prevent the messages from showing in client’s console place this in your init.lua, its the PlayerDeath function from base gamemode rewriten to print the deaths only into server console.
function GM:PlayerDeath( Victim, Inflictor, Attacker ) // We are copying this function from Base to make it not print into players consoles that a player died. -- Don't spawn for at least 2 seconds Victim.NextSpawnTime = CurTime() + 5 Victim.DeathTime = CurTime() if ( !IsValid( Inflictor ) && IsValid( Attacker ) ) then Inflictor = Attacker end -- Convert the inflictor to the weapon that they're holding if we can. -- This can be right or wrong with NPCs since combine can be holding a -- pistol but kill you by hitting you with their arm. if ( Inflictor && Inflictor == Attacker && (Inflictor:IsPlayer() || Inflictor:IsNPC()) ) then Inflictor = Inflictor:GetActiveWeapon() if ( !IsValid( Inflictor ) ) then Inflictor = Attacker end end if (Attacker == Victim) then umsg.Start( "PlayerKilledSelf" ) umsg.Entity( Victim ) umsg.End() print( Attacker:Nick() .. " suicided!" ) return end if ( Attacker:IsPlayer() ) then umsg.Start( "PlayerKilledByPlayer" ) umsg.Entity( Victim ) umsg.String( Inflictor:GetClass() ) umsg.Entity( Attacker ) umsg.End() print( Attacker:Nick() .. " killed " .. Victim:Nick() .. " using " .. Inflictor:GetClass() ) return end umsg.Start( "PlayerKilled" ) umsg.Entity( Victim ) umsg.String( Inflictor:GetClass() ) umsg.String( Attacker:GetClass() ) umsg.End() print( Victim:Nick() .. " was killed by " .. Attacker:GetClass() ) end
If you are doing a gamemode, add this into cl_init.lua:
function GM:DrawDeathNotice( x, y )
Tested it myself…
No offense to the first post, but this guys^ code is way better… and simpler lol.
Ehm…no offense but it does something completely else than my code…the deaths still print into console, mine blocks only that, maybe if you read it before just copy pasting code…