View Single Post
  #8  
Old 06-13-2006, 12:07 AM
_Z3phyr_ _Z3phyr_ is offline
Banned
Join Date: Sep 2003
Location: Louisiane
Posts: 390
_Z3phyr_ is an unknown quantity at this point
entao, quoi?

So what would be the equivalent of hasweapon() in GS2? Has it been fixed yet?

PHP Code:
function onCreated() {
  if (
hasweapon(Weapon_name_here)) {
    
// algo comentario por aqui
  
}

Btw, from what I've been doing so far, I've only noticed that player.weapons is only readable on server-side.

Here's what I tried to do in GS2 to substitute for it:

PHP Code:
function onCreated() {
  
this.weaponname Weaponnamehere;
  
this.weaponlist player.weapons;
}
//#CLIENTSIDE
function onPlayertouchsme() {
  if (
this.weaponname in this.weaponlist) {
    
message("true");
    
removeweapon(this.weaponname);
  } else { 
message("false"); addweapon(this.weaponname); }

but this doesn't work for whatever reason... so how else can I translate hasweapon() into GS2?

Btw — addweapon and removeweapon don't work on either clientside or serverside with me for some reason. Am I using it wrong? I've noticed that weapons shouldn't have quotes around them unless they include a symbol or space, so I didn't put any quotes around the actual weaponame.




EDIT -- I got an answer from a friend early:

hasweapon() can be translated to if (findweapon(weaponnamehere) != null) { ... }

Last edited by _Z3phyr_; 06-13-2006 at 03:28 AM..
Reply With Quote