View Single Post
  #7  
Old 04-06-2011, 08:52 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Deas_Voice View Post
tirggeraction sounds about right
To cover an 8x4 section of tiles. Hell no.

Best plan of action would be to...

1. Loop through the players on clientside and check if they're in the '8x4' section
2. Send the list of players in the section to the server-side
3. Double-check that they're in the square (perhaps with some leniency)
4. Triggerclient each person in the square, or even just change their animation and chat if that's all that's necessary.

It looks like this:

PHP Code:
function onActionServerSide() {
  if (
params[0] == "hitpeople") {
    
// Do the same check up here, or maybe even a radius check like cbk suggested.
    
for (temp.plplayers) {
      if (
temp.pl.x in |tx,tx+dw| && temp.pl.y in |ty,ty+dh|) {
        
temp.pl.chat "Ow!";
        
temp.pl.setani("hurt""");
      }
    }
  }
}

//#CLIENTSIDE
function hitPeople() {
  
// Determine the 8x4 Section
  // tx = topleft x
  // ty = topleft y
  // dw = width of section
  // dh = height of section
  // Find Players
  
for (temp.plplayers) {
    
// Check if Player is in Section
    
if (temp.pl.x in |tx,tx+dw| && temp.pl.y in |ty,ty+dh|) {
      
// Add Account to the List of those being Hit
      
temp.hitting.add(temp.pl.account);
    }
  }
  
// Check if Hitting Anyone
  
if (temp.hitting.size() > 0) {
    
// Trigger the server
    
triggerserver("gui"this.name"hitpeople"temp.hitting);
  }

__________________
Quote:

Last edited by fowlplay4; 04-06-2011 at 09:04 PM..
Reply With Quote