Thanks to you guys I was able to create a script that gives the winning team of a DeathRun round 25 points (for PointShop)
I added another part to that script that slays all players who are alive to fix a small bug
The problem is, the message that says "The round has ended! All living players have been slain." repeats two (or more) times when it's printed to the chat, and I'm not sure why
I tried to add a timer to make sure it only calls itself once, but it still prints two+ times
Here's the code
if SERVER then
hook.Add( "OnRoundSet", "DR Money", function( round, winner )
if round == ROUND_ENDING then
for k, v in next, player.GetAll() do
if not v:Team() == winner then
continue
end
v:PS_GivePoints( 25 )
end
local name = team.GetName( winner )
PrintMessage( HUD_PRINTTALK, "All players on the " .. name .. " team were given 25 points for winning the round!" )
timer.Create( "TimerRoundEndSlay" , 1, 1, SlayAtRoundEnd )
end
end )
end
function SlayAtRoundEnd()
for k, v in pairs( player.GetAll() ) do
if ( v:Alive() ) then
v:Kill()
end
PrintMessage( HUD_PRINTTALK, "The round has ended! All living players have been slain." )
end
end