Thread: function...
View Single Post
  #8  
Old 05-19-2007, 05:55 PM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
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.
__________________
- Zidane / Zidaya
Reply With Quote