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
  #16  
Old 06-25-2011, 09:24 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by fowlplay4 View Post
There's also:

temp.hasWeapon = findweapon("weapon") in player.weapons;
PHP Code:
//#CLIENTSIDE
function onCreated(){
  echo(
player.weapons);

*F2*
*Nothing there*

__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #17  
Old 06-25-2011, 09:26 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
Quote:
Originally Posted by Jiroxys7 View Post
PHP Code:
//#CLIENTSIDE
function onCreated(){
  echo(
player.weapons);

*F2*
*Nothing there*

did you make sure you had the weapon? ;O

player.weapons is an array of what weapon you have (also visible in your attributes weapon tab)
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #18  
Old 06-25-2011, 09:29 PM
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 Jiroxys7 View Post
PHP Code:
//#CLIENTSIDE
function onCreated(){
  echo(
player.weapons);

*F2*
*Nothing there*

player.weapons is an array of objects rather than strings.

If you were to do:

PHP Code:
for(temp.player.weapons){
  echo(
temp.w.name);

You would see the names of each weapon object.

I wouldn't recommend using that method though, it would take up more script time unnecessarily.
Reply With Quote
  #19  
Old 06-25-2011, 09:46 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by ffcmike View Post
player.weapons is an array of objects rather than strings.

If you were to do:

PHP Code:
for(temp.player.weapons){
  echo(
temp.w.name);

You would see the names of each weapon object.

I wouldn't recommend using that method though, it would take up more script time unnecessarily.
Well I was going to use it to check if a player no longer has a skill (and therefore delete the weapon). Is there a better method you would suggest?

I was going to do something like loop:
PHP Code:
function onCheckSkills(){
  for(
i=0;i<weapon array.size();i++){
    if(!(
weapon array[iin client.skills){
      
removeWeapon(weapon array[i]);
    }
  }

(where "weapon array" is the variable holding the weapon array)
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #20  
Old 06-25-2011, 09:50 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by xAndrewx View Post
findweapon("weapon") returns boolean (true / false)
It returns the weapon object, not a boolean.
__________________
Reply With Quote
  #21  
Old 06-25-2011, 11:12 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by cbk1994 View Post
It returns the weapon object, not a boolean.
oh cool
__________________
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 09:17 PM.


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