I´ve wrote a Script some weeks ago. It´s working but not perfectly. My Problems:
First: The Sound that is playing works at the first time the script is running. But Everytime after that, the Script gets triggered, the sound stop in the middle.
Second: The Script will be triggered although the script should only be triggered if the player is dead.
Here is the Script I´m talking about:
[lua]if (SERVER) then
util.AddNetworkString(“SuicideMusic”)
util.AddNetworkString(“SuicideMessage”)
local function SuicideBroadcast(tbl)
net.Start("SuicideMessage")
net.WriteTable(tbl)
net.Broadcast()
end
print( "Hook check" )
hook.Add("OnPlayerHitGround", "Suicide", function(ply, inWater, onFloater, speed)
if inWater and ply:Alive() then return end
if speed > 700 then
print( "Broadcast check" )
net.Start("SuicideMusic")
net.Send(ply)
end
end)
else
net.Receive(“SuicideMusic”, function(len)
local ply = LocalPlayer()
ply.Music = CreateSound(ply, "SuperSvenPeterBros.mp3")
ply.Music:Play()
end)
print( "Music check" )
end[/lua]
Why do I have these problems and how can I solve them ?
P.S.: An If Statement with something like “!=ply:Alive()” didn´t work.