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 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
  #2  
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
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:31 AM.


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