View Single Post
  #1  
Old 02-19-2011, 11:52 AM
Starfire2001 Starfire2001 is offline
Unholy Nation
Starfire2001's Avatar
Join Date: Dec 2010
Location: The streets.
Posts: 156
Starfire2001 will become famous soon enough
Problems with onwall

The following script is part of a weapon, that when fired pushes any player in front of the player who fired the weapon a certain distance depending on how far away they are. Everything is working fine except for detecting a wall and stopping the player from going through it when they are hit. In this script I made it so my chat would say "onwall" if its detecting that the player is onwall and "good" if they are not, but regardless of where I fire the weapon wall present or not my chat always shows as "onwall", which leads me to believe I had no idea how to use onwall, but I haven't been able to find anything to help me with it. So yeah, as always, any help/advice would be greatly appreciated.

PHP Code:
function onActionServerSide(this.face, this.firex, this.firey){
  for (
temp.pl: players){
    if (
player.communityname != pl.communityname){
      
// Attack came from the bottom
      
if (face == 0){
        if(
pl.y in | firey - 2, firey -.1 |) {
          if(
pl.x in | firex - 1, firex + 1 |) {
            
pl.hearts = 0;
          }
        }
        if(
pl.y in | firey - 3, firey - 2.1 |) {
          if(
pl.x in | firex - 1.5, firex + 1.5 |) {
            
temp.strength = 12;
            for (
strength = 12; strength > 0; strength --){
              
sleep (.05);
              
pl.y = pl.y - .5;
              if (
onwall(pl.x,pl.y-1.5)){
                
player.chat = "onwall";
              }
              else{
                
player.chat = "good";
              }
            }
          }
        }
      }
      if(
pl.y in | firey - 4, firey - 3.1 |) {
        if(
pl.x in | firex - 2, firex + 2 |) {
          
temp.strength = 8;
          for (
strength = 8; strength > 0; strength --){
            
sleep (.05);
            
pl.y = pl.y - .5;
            if (
onwall(pl.x,pl.y-1.5)){
              
player.chat = "onwall";
            }
            else{
              
player.chat = "good";
            }
          }
        }
      }
      if(
pl.y in | firey - 5, firey - 4.1 |) {
        if(
pl.x in | firex - 2.5, firex + 2.5 |) {
          
temp.strength = 4;
          for (
strength = 4; strength > 0; strength --){
            
sleep (.05);
            
pl.y = pl.y - .5;
            if (
onwall(pl.x,pl.y-1.5)){
              
player.chat = "onwall";
            }
            else{
              
player.chat = "good";
            }
          }
        }
      }
    }
  }
} 
Reply With Quote