Ok so the main reason I was trying to use a public function was to make sure that the script could be done clientside. Here is what I am working with now. It works, once but not twice, and is very very slow. Any pointers here would be great
The Switch:
PHP Code:
//#CLIENTSIDE
function onCreated() {
this.switchid = "door_2";
this.image = "block.png";
}
function onPlayerenters() {
onTimeOut();
}
function onTimeOut() {
if (players.size() > 0)
setTimer(0.1);
else
setTimer(0);
for (temp.i : findareanpcs(this.x-2, this.y-2, 2, 2)) {
if (temp.i.isinclass("bomb"))
SwitchDB.door.(@this.switchid).trigger("DoorOpened", null);
sleep(3.2);
onTimeOut();
}
}
And the Door:
PHP Code:
//#CLIENTSIDE
function onCreated() {
this.doorid = "door_2";
this.image = "door.png";
SwitchDB.door.(@this.doorid) = this;
}
function onDoorOpened() {
hide();
sleep(3.15);
show();
}