Skip to content

Instantly share code, notes, and snippets.

@Kolesias123
Created October 14, 2014 05:31
Show Gist options
  • Save Kolesias123/8a5d1423b099f01abef6 to your computer and use it in GitHub Desktop.
Save Kolesias123/8a5d1423b099f01abef6 to your computer and use it in GitHub Desktop.
m_nLightsSound <- Entities.FindByName( null, "LightOnSound" );
/**
* Enciende una luz
* @param {string} i ID de la luz (01, 02, etc...)
*/
function TurnOnLight( i )
{
// Por cada luz, agregamos 1.5s de delay, así se encienden una por una
delay <- ( 1.5 * i );
// Reproducimos el sonido de encendido
DoEntFire( m_nLightsSound.GetName(), "StopSound", "0", (delay - 0.1), null, m_nLightsSound );
DoEntFire( m_nLightsSound.GetName(), "PlaySound", "0", delay, null, m_nLightsSound );
// Encendemos la luz
DoEntFire( "RoofLights" + i, "TurnOn", "0", delay, null, null );
DoEntFire( "RoofLightsSpots" + i, "LightOn", "0", delay, null, null );
}
/**
* Enciende todas las luces
*/
function TurnOnAllLights()
{
TurnOnLight( 1 );
TurnOnLight( 2 );
TurnOnLight( 3 );
TurnOnLight( 4 );
}
// Reproducimos sonido de botón
DoEntFire( "ButtonSound", "PlaySound", "0", 0, null, null );
// Encendemos las luces
TurnOnAllLights();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment