How do I make rounds in fretta?

How do I make rounds in fretta?

GM.RoundBased = true

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


found round length


[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?
function ENT:OnTakeDamage(dmg)
if(!dmg:GetAttacker():IsPlayer())then return end
if(self:GetNumber() == dmg:GetAttacker():Team())then
dmg:GetAttacker():ChatPrint( “>[You can’t damage your own core!]” )
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))
self.Entity:SetColor(255 - d,d,d,d)
gameover = true
–KA BOOM :smiley:
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
umsg.Start("coredmg", RecipientFilter():AddAllPlayers() ) --updates hud for clients
	umsg.Short( self:GetNumber() )
	umsg.Short( self.Entity:Health() or 0 )


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.