# How do I make rounds in fretta?

How do I make rounds in fretta?

but what functions? or how to set how much time?

[editline]10:38AM[/editline]

found round length

[editline]10:41AM[/editline]

[lua]GM.RoundEndWithResult(1, team.GetName(1) … " wins!")[/lua] ?

Keep looking down the page he posted. It has all the variables you need.

And that function is manually telling the round to end with a particular result everyone sees.

I have this entity, and I want it to make the round end when it’s destroyed.
I have the onTakeDamage hook and can see when it gets to 0, but then how would I make the round end?
[lua]
function ENT:OnTakeDamage(dmg)
if(!dmg:GetAttacker():IsPlayer())then return end
if(self:GetNumber() == dmg:GetAttacker():Team())then
–self.Entity:EmitSound(“ambient\alarms\klaxon1.wav”,400,100)
dmg:GetAttacker():ChatPrint( “>[You can’t damage your own core!]” )
return
end
if(gameover)then return end
print(“ow D: fyi health left”,self.Entity:Health(),“and I was hurt this much:”,dmg:GetDamage())
if((self.Entity:Health() - dmg:GetDamage()) > 0) then – If taking damage won’t destroy (health=0) the core, do dat
self.Entity:SetHealth(self.Entity:Health() - dmg:GetDamage())
local d = (math.Clamp(self.Entity:Health(),0,255))
print(d)
self.Entity:SetColor(255 - d,d,d,d)
else
print(“entity/core/shared.lua/ontakedamage/25”)
gameover = true
–KA BOOM
local explode = ents.Create( “env_explosion” ) //creates the explosion
explode:SetPos( self.Entity:GetPos() )
explode:Spawn() //this actually spawns the explosion
explode:SetKeyValue( “iMagnitude”, “1” ) //the magnitude
explode:Fire( “Explode”, 0, 0 )
–explode:EmitSound( “sound\ambient\explosions\explode_2.wav”, 100, 100 )

``````           -- round over

--self.Entity:Remove() -- Remove our entity
end
umsg.Short( self:GetNumber() )
umsg.Short( self.Entity:Health() or 0 )
umsg.End()
``````

end
[/lua]

also, sounds don’t play. Do I need to precache them?
and I can’t get it to change colors, only alpha

That is how you end the round. (slightly modified)

Use the ENT:CallOnRemove() function to end the round.