Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-06-2012, 07:31 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
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?
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #2  
Old 04-06-2012, 07:36 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Gunderak View Post
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:15 PM.


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