Quote:
Originally Posted by Scouser
Okay i get that, but would there be a way to like set a timer for that?
like every 60 seconds it opens for 2 seconds etc etc.
Really i just want to explore possibilities and what i might need.
|
This is it basically, the script you're looking for is pretty basic and one you can learn from too.
PHP Code:
function onCreated() {
setimg("door.png"); // Sets Image as a Door
setTimer(60); // Begins Timer
}
function onTimeout() {
hide(); // Hides Door
sleep(2); // Pauses Script for 2 Seconds
show(); // Shows Door
setTimer(60); // Continues Timer
}
The above is unoptimized code and will continue running while there are no players in the level which should be avoided, usually through a small snippet like the following (in the same script).
PHP Code:
function onPlayerEnters() {
// Check if a player just entered and the level was empty before
if (players.size() == 1) setTimer(60);
}
function onTimeout() {
if (players.size() < 1) return; // Halts script because there are no players in the level.
// Other Code
setTimer(60);
}