PDA

View Full Version : Player-Block Warper


Gambet
07-12-2007, 11:42 PM
//Player-Block Warper
//Automatically warps a player around another player to prevent blocking.
//By: Gambet

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

function onTimeOut()
{
for (a: players)
{
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.x - player.x) ^ 2) + ((a.y - 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.y = a.y - 2;
}
}
break;
case "1":
if (!(onwall(a.x-0.5,a.y+2)))
{
if (keydown(1))
{
player.x = a.x - 2;
}
}
break;
case "2":
if (!(onwall(a.x+1.5,a.y+3)))
{
if (keydown(2))
{
player.y = a.y + 2;
}
}
break;
case "3":
if (!(onwall(a.x+3.5,a.y+2)))
{
if (keydown(3))
{
player.x = a.x + 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, 05:27 AM
Awsome :D

Frankie
07-08-2008, 05:41 AM
this is really neat
good job

kodster200
07-08-2008, 06:09 PM
VERY useful no more do i get pms about door blockers :D