Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Player-Block Warper (https://forums.graalonline.com/forums/showthread.php?t=75280)

Gambet 07-12-2007 10:42 PM

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. :)

kodster200 07-08-2008 04:27 AM

Awsome :D

Frankie 07-08-2008 04:41 AM

this is really neat
good job

kodster200 07-08-2008 05:09 PM

VERY useful no more do i get pms about door blockers :D


All times are GMT +2. The time now is 07:55 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.