View Single Post
  #4  
Old 05-29-2008, 12:57 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
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 (
players)
  {
    if (
mousex in |p.+0.3p.2.5|)
    {
      if (
mousey in |p.yp.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.
Reply With Quote