PHP Code:
// Custom Events System
//#CLIENTSIDE
// Set Default Flags
function onCreated()
{
this.pxy = {player.x, player.y};
this.screen = {screenwidth, screenheight};
this.onTimeout();
}
function onTimeout()
{
// function onPlayerMoved(newx, newy) { }
if (player.x != this.pxy[0] || player.y != this.pxy[1])
{
this.pxy = {player.x, player.y};
for (temp.var : weapons) temp.var.trigger("PlayerMoved", player.x, player.y);
}
// function onScreenResize(newwidth, newheight) { }
if (screenwidth != this.screen[0] || screenheight != this.screen[1])
{
this.screen = {screenwidth, screenheight};
for (temp.var : weapons) temp.var.trigger("ScreenResize", screenwidth, screenheight); // function onPlayerMoved(newx, newy) { }
}
setTimer(0.05);
}
Add it to every player. I could only think of two new events, but if others can think of more, you can easily add them.
Enjoy
P.S. Events only work in weapons.