• Console Kill Notifications
    5 replies, posted
I'm working on an RP, and it's rather detrimental to the play that all players can see in console: [code] Player 1 killed Player 2 using weapon. [/code] How can I disable this? I've searched to no avail.
Which way do you want it? Only you want to disable it or you want everyone on the server to disable it. I know theremis a console command that filters out messages, but I can remember it and it only works locally. Although you can execute it on all players..
gameevent.Listen
[QUOTE=Exploderguy;46837671]Which way do you want it? Only you want to disable it or you want everyone on the server to disable it. I know theremis a console command that filters out messages, but I can remember it and it only works locally. Although you can execute it on all players..[/QUOTE] I'll try this if I can't find a more elegant way. [QUOTE=Author.;46837680]gameevent.Listen[/QUOTE] Can you elaborate? [URL="http://wiki.garrysmod.com/page/gameevent/Listen"]This looks along the lines of what I want[/URL], but I'm not totally sure how it differs from just a standard hook. Would this allow me to override the default death management, or just add to it?
From the base gamemode, in GM:PlayerDeath: [code]if ( attacker == ply ) then net.Start( "PlayerKilledSelf" ) net.WriteEntity( ply ) net.Broadcast() MsgAll( attacker:Nick() .. " suicided!\n" ) return end if ( attacker:IsPlayer() ) then net.Start( "PlayerKilledByPlayer" ) net.WriteEntity( ply ) net.WriteString( inflictor:GetClass() ) net.WriteEntity( attacker ) net.Broadcast() MsgAll( attacker:Nick() .. " killed " .. ply:Nick() .. " using " .. inflictor:GetClass() .. "\n" ) return end net.Start( "PlayerKilled" ) net.WriteEntity( ply ) net.WriteString( inflictor:GetClass() ) net.WriteString( attacker:GetClass() ) net.Broadcast() MsgAll( ply:Nick() .. " was killed by " .. attacker:GetClass() .. "\n" )[/code] So really, just override PlayerDeath to remove the bits you don't want.
[QUOTE=Kogitsune;46837740]From the base gamemode, in GM:PlayerDeath: [code]-snip-[/code] So really, just override PlayerDeath to remove the bits you don't want.[/QUOTE] This worked, thanks.
Sorry, you need to Log In to post a reply to this thread.