| Twinny |
05-29-2008 12:57 AM |
I think testplayer is the function that only returns an account if the player is able to be hit by default weapons i.e. won't work in no-pk zones or when the player is paused. I do something like this
PHP Code:
//#CLIENTSIDE
function onMouseDown(mode)
{
if (player.guild.starts("Events")) return;
if (mode != "left") return;
temp.pl = grabPlayer();
if (!pl.account)
player.chat = "No players found!";
else
player.chat = format("Grabbed %s!",pl.account);
}
function grabPlayer()
{
for (p : players)
{
if (mousex in |p.x +0.3, p.x + 2.5|)
{
if (mousey in |p.y, p.y+2.6|)
return p;
}
}
return false;
}
Can't test it (at work) but it should be right...or close. You could expand that by adding all players within the area into an array and returning that. If the array has more than one person, you could create a quick gui popup control to display the users then click the one you wish to grab.
|