Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void main(void)
- {
- var lights = GetByType("interior_light");
- foreach (lights as light)
- {
- var enabled = false;
- // Save the original settings so we can reset to them later
- var color = light.getColor();
- var radius = light.getRadius();
- if (!enabled) // Starting from the Off state, we switch on Red Alert
- {
- // Set them all to red
- light.setColor(255, 0, 0);
- // Brighten and dim repeatedly
- while (true)
- {
- light.setRadius(4);
- sleep(1);
- light.setRadius(1);
- sleep(1);
- }
- // Save On state
- enabled = true;
- }
- else // If it was already on, set it back to defaults
- {
- light.setColor(color);
- light.setRadius(radius);
- enabled = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement