View Single Post
  #1  
Old 07-12-2007, 10:42 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Player-Block Warper

PHP Code:
//Player-Block Warper
//Automatically warps a player around another player to prevent blocking.
//By: Gambet

//#CLIENTSIDE
function onCreated()
{
 
onTimeOut();
}

function 
onTimeOut()
{
 for (
aplayers)
  {
   if (
a.account != player.account)
    {
     if (
player.x in |a.x-2.5,a.x+2.5| && player.y in |a.y-2.5,a.y+2.5|)
      {
       
this.distance = ((((a.player.x) ^ 2) + ((a.player.y) ^ 2)) ^ 0.5);
       if (
this.distance in |1,3|)
        {
         switch(
player.dir)
          {
           case 
"0":
            if (!(
onwall(a.x+1.5,a.y)))
             {
              if (
keydown(0))
               {
                
player.a.2;
               }
             }
            break;
           case 
"1":
            if (!(
onwall(a.x-0.5,a.y+2)))
             {
              if (
keydown(1))
               {
                
player.a.2;
               }
             }
            break;
           case 
"2":
            if (!(
onwall(a.x+1.5,a.y+3)))
             {
              if (
keydown(2))
               {
                
player.a.2;
               }
             }
            break;
           case 
"3":
            if (!(
onwall(a.x+3.5,a.y+2)))
             {
              if (
keydown(3))
               {
                
player.a.2;
               }
             }
            break;
          }
        }
      }
    }
  }
 
setTimer(0.05);


I havn't tested it with a wide majority of players having the system, so I'm not sure if it would need adjusting or not. If it does, then you can adjust the values yourself, the core of the system is already done anyways, so some simple coordinate check-changes shouldn't be a problem.


NOTE: You can add level restrictions and level-coordinate restrictions and so forth yourself to fit your own sparring arenas or battle arenas that you may not want this to affect the players in.



Hope it helps.

Last edited by Gambet; 07-12-2007 at 10:59 PM..
Reply With Quote