View Single Post
  #2  
Old 11-24-2011, 08:10 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Ohk4y View Post
Hello! I'm trying to make a mining system and I ran into an issue. I want it to put all the rocks back to normal (from being destroyed - to how they were before the player 'hurt' them) if there are no players around the rocks.

This is what I have so far for that part of the script. keep in mind I am just testing the X and Y of the player so I can go from there.

PHP Code:
function onTimeOut() {
  for (
pl allplayers) {
    if (
pl.1.5 in |this.xthis.2|) {
      
onTrueX();
    }else 
onFalse();
    if (
pl.1.5 in |this.ythis.2|) {
      
onTrueY();
    }else 
onFalse();    
  }
 
setTimer(.05);
}

function 
onTrueX() this.chat "true X";
function 
onTrueY() this.chat "true Y";
function 
onFalse() {
  
this.chat "  ";

NOTE: This is within a class, serverside.
0.05 second timeouts do not work serverside.
You should also really be breaking that loop once an intersect is detected, and only calling onFalse(); if no players are detected after the loop has finished.
Reply With Quote