• Warden is dead sound.
    6 replies, posted
I have a warden is dead sound for my Jailbreak server and need a script to make a sound for warden dead. I currently have one but it repeats all the time. I need one that will trigger it only on death. Could I have some help please? Thanks!
What have you tried, show us your code? The best way, as you said, would be to hook into PlayerDeath, which is a SERVER hook. [lua]util.AddNetworkString( "WardenHasDied" ) hook.Add( "PlayerDeath", "PlayerDeath:WardenDeathSound", function( Player ) // However you have warden set, detect it here if ( Player.IsWarden ) then net.Start( "WardenHasDied" ); net.Broadcast( ); end end )[/lua] then, client-side [lua]WARDEN_DEATH_SOUND = Sound( "blah.wav" ) net.Receive( "WardenHasDied", function( Player, bytes ) surface.PlaySound( WARDEN_DEATH_SOUND ) end )[/lua]
The receive arguments are the other way around.
It doesn't matter though, it's not using them anyway.
[QUOTE=Acecool;42120142]It doesn't matter though, it's not using them anyway.[/QUOTE] And what if he actually wanted to use those arguments after copying the code? Does the player argument even exist on client in net.Receive?
[QUOTE=Acecool;42117280]What have you tried, show us your code? The best way, as you said, would be to hook into PlayerDeath, which is a SERVER hook. [lua]util.AddNetworkString( "WardenHasDied" ) hook.Add( "PlayerDeath", "PlayerDeath:WardenDeathSound", function( Player ) // However you have warden set, detect it here if ( Player.IsWarden ) then net.Start( "WardenHasDied" ); net.Broadcast( ); end end )[/lua] then, client-side [lua]WARDEN_DEATH_SOUND = Sound( "blah.wav" ) net.Receive( "WardenHasDied", function( Player, bytes ) surface.PlaySound( WARDEN_DEATH_SOUND ) end )[/lua][/QUOTE] why are you creating a global variable when it's extremely unneeded. surface.PlaySound(Sound( "blah.wav" ));
It's a rough example that was typed up as a response while waiting to see what they have done. So, there's an issue here and there, forgive me for not using the old net system on a daily basis. I rewrote it to remove the 64kb restriction and automatically map net messages to functions so I'm sorry I mixed up the order, a 50% chance! Did you see how someone took the ttt end round system music player I provided and completely screwed it up editing stuff they shouldn't have? That's why I put that variable up top as an EDIT this only. Some people are new and don't know what to do, by using a variable it helps them see how pieces fit together.
Sorry, you need to Log In to post a reply to this thread.