All pastes #339545 Raw Edit

RUCCUS

public text v1 · immutable
·published 2007-02-04 04:16 UTC
rendered paste body
FUNCTION tankColCheck()
   sc_updateObject 2
   `Loop through every player in the game
   FOR i = 1 TO net.maxPlayers
      `If theyre shooting
      IF clients(i).shooting
         `Calculate a point infront of the player
         bx# = NEWXVALUE(tank.x#,tank.ya#,tank.range#)
         bz# = NEWZVALUE(tank.z#,tank.ya#,tank.range#)
         `cycle through all other players checking for intersection
         FOR x = 1 TO net.maxPlayers
            `if the current player isnt the player shooting
              IF NOT x = i
               `perform intersection check
                hit = sc_rayCast(x,clients(i).x#,0,clients(i).z#,bx#,0,bz#,i)
                `damage the hit tank
                IF hit THEN DEC clients(x).health, tank.damage
             ENDIF
         NEXT x
         `reset the tank's shooting variable
         clients(i).shooting = 0
      ENDIF
   NEXT i
ENDFUNCTION