Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   player.account error? (https://forums.graalonline.com/forums/showthread.php?t=134266181)

Gunderak 04-06-2012 07:31 AM

player.account error?
 
I am currently making a targeting system and of course I don't want it so you can target yourself. But it seems it doesn't recognize when you are targeting yourself..
Here is the part that is problematic.
PHP Code:

function onMouseDown(bu){
  if(
leftmousebutton){
    for(
temp.players){
      if(
temp.!= player.account){
        if(
mousex in p.xp.| && mousey in p.yp.3|){
          
this.target temp.p;
          
onTimeout();
        }
      }
    }
  }


Does anyone here know why if(temp.p != player.account){ isn't working?

ffcmike 04-06-2012 07:36 AM

Quote:

Originally Posted by Gunderak (Post 1691221)
I am currently making a targeting system and of course I don't want it so you can target yourself. But it seems it doesn't recognize when you are targeting yourself..
Here is the part that is problematic.
PHP Code:

function onMouseDown(bu){
  if(
leftmousebutton){
    for(
temp.players){
      if(
temp.!= player.account){
        if(
mousex in p.xp.| && mousey in p.yp.3|){
          
this.target temp.p;
          
onTimeout();
        }
      }
    }
  }


Does anyone here know why if(temp.p != player.account){ isn't working?

The 'players' array consists of player objects, not account strings, you need to check "temp.p != player".
You should also have a "return;" after establishing the target so it does not continue checking and possibly invoke multiple timeouts.


All times are GMT +2. The time now is 12:13 PM.

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