Help with gamemode. AGAIN.

Does anyone know if there is a way to make a timer?

For example: “If you get a kill you get a boost then I goes away in 30 seconds?”

For those types of timers it is probably simpler to use a timer.Simple( delay, function( ) … end );

But you can use a timer.Create( “name of timer”, delay, times_to_be_called_zero_for_unlimited, function( ) … end );

Example:


hook.Add( "PlayerDeath", function( _p, _inflictor, _attacker )
	if ( IsValid( _attacker ) && _attacker:IsPlayer( ) ) then
		_attacker:GiveSpecialAttribute( "blah" ); -- Or however you do it ... I'd recommend adding the timer inside the attribute function otherwise you'll repeat code each time you make it...
		timer.Simple( 30, function( )
			if ( IsValid( _attacker ) && _attacker:HasSpecialAttribute( "blah" ) ) then
				_attacker:RemoveSpecialAttribute( "blah " );
			end
		end );
	end
end );