Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   testplayer() clientside (https://forums.graalonline.com/forums/showthread.php?t=73306)

Chompy 04-05-2007 09:08 PM

testplayer() clientside
 
When did testplayer() not work on other players clientside?
I can only recieve the index 0 (myself) using the command..

I am totally sure it did work on other players before..

PHP Code:

//#CLIENTSIDE
function onMouseDown(button)
{
  if (
temp.button == "left") {
    
temp.j = testplayer(mousex, mousey);
    if (
temp.j > -1)
      
player.chat = "player found: " @ temp.j @ " at:" SPC players[temp.j].x SPC players[temp.j].y;
    else
      if (
temp.j == -1)
        
player.chat = "no target found";
  }
} 

This only works when I click myself..
And, testnpc() works fine on clientside, why's that..?

Rapidwolve 04-05-2007 11:53 PM

This may sound stupid but are there other players on the level?

Chompy 04-05-2007 11:58 PM

Quote:

Originally Posted by Rapidwolve (Post 1297253)
This may sound stupid but are there other players on the level?

Uhm, yes... >_< Was about 8 players in the level..

Twinny 04-06-2007 06:09 AM

Testplayer checks if they can be hit I believe. I found it didn't work if they were paused and possibly didn't work when they were in a non-pk level. Could try this

PHP Code:

function findmouseplayer()
{
  for (
pl: players) 
  {
    if (
pl.x in |mousex, mousex+2|)
    {
      if (
pl.y in |mousey, mousey+2|)
      {
        
temp.find.add(pl.account);
        
//break if you only want 1
      
}
    }
  }
  return 
temp.find;
} 


Chandler 04-06-2007 07:42 AM

Yeah. I had that problem on Era which was weird. Sometimes it didn't detect anyone, other times it did.
I just used this
PHP Code:

if (leftmousebutton)
  for (
temp.foundPlayer: players)
    if (
temp.foundPlayer.x in |mousex - 3, mousex + 3| && temp.foundPlayer.y in |mousey - 3, mousey + 3|)
    {
      
cTARGET.text = temp.foundPlayer.account;   
      break;
    } 


DrakilorP2P 04-06-2007 09:39 AM

Quote:

Originally Posted by Twinny (Post 1297346)
Testplayer checks if they can be hit I believe. I found it didn't work if they were paused and possibly didn't work when they were in a non-pk level. Could try this
-Snip-

I've been told that testplayer() doesn't work in No-PK zones, so I can confirm that.

Chompy 04-06-2007 03:17 PM

Hmm, that's why it doesn't work..
Well, I've been working on this name system, and then suddenly testPlayer() weren't working.. hmm

Well, I gotta use other methods to get it to working then :]

Thanks guys


All times are GMT +2. The time now is 01:49 AM.

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