Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   mouse clicky player (https://forums.graalonline.com/forums/showthread.php?t=79861)

[email protected] 05-28-2008 08:24 PM

mouse clicky player
 
HTML Code:

function onMouseDown(temp.click) {
  if (!player.guild.starts("Events Team")) return false;
  if (click != "left") return false;
 
  temp.playera = players[testplayer(mousex, mousey)];
  if (playera.account != null)
    player.chat = "selected" SPC playera.account;
}

pretty cool and simple code, thought i'd share !!! :D:D
just click a player with an "events team" tag, and it'll find out who they are! good for event thingys ^^ ^^

Programmer 05-28-2008 09:14 PM

Quote:

Originally Posted by [email protected] (Post 1393047)
HTML Code:

function onMouseDown(temp.click) {
  if (!player.guild.starts("Events Team")) return false;
  if (click != "left") return false;
 
  temp.playera = players[testplayer(mousex, mousey)];
  if (playera.account != null)
    player.chat = "selected" SPC playera.account;
}

pretty cool and simple code, thought i'd share !!! :D:D
just click a player with an "events team" tag, and it'll find out who they are! good for event thingys ^^ ^^

Simplicity. I like it.

Dan 05-28-2008 11:54 PM

rep ++

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 (
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.

cbk1994 05-29-2008 01:11 AM

I've usually done things such as say

:get

and click a player.

[email protected] 05-29-2008 11:20 PM

Quote:

Originally Posted by Twinny (Post 1393100)
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

strange, mine works fine

tyvm

_Z3phyr_ 08-02-2008 05:56 PM

testplayer returns the playerindex # of a player (if there is one) at the given (x,y)

Crow 08-07-2008 09:03 PM

Clientside it only returns other players when the level is a pk zone. Somewhat annoying :\

Mark Sir Link 08-19-2008 05:09 AM

Quote:

Originally Posted by Crow (Post 1412252)
Clientside it only returns other players when the level is a pk zone. Somewhat annoying :\

It also only returns the player index if they're unpaused.

Twinny 08-19-2008 09:01 AM

Quote:

Originally Posted by Mark Sir Link (Post 1415741)
It also only returns the player index if they're unpaused.

Kinda sucky but it is only meant for hit detection in the end. You will have to make your own using a loop of players array :)


All times are GMT +2. The time now is 03:10 AM.

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