Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   obj.remove() (https://forums.graalonline.com/forums/showthread.php?t=70961)

Chompy 12-23-2006 09:30 PM

obj.remove()
 
Well, I have one problem: I have an array storing all the ammount of each weapon a player has, but removing an ammount is weirder then I thought,
example:

PHP Code:

function onCreated()
{
  
temp.arr = { 123123};
  
temp.arr.remove1);
  
  echo( 
temp.arr);


It removes the first 1 it finds ( 0), when I try to clear out the other 1 ( 3)
I've tried like temp.arr[ 3] = NULL; temp.arr[ 3].clear();

Anyone know the solution for this?

Andy0687 12-23-2006 10:25 PM

Quote:

Originally Posted by Chompy (Post 1256534)
Well, I have one problem: I have an array storing all the ammount of each weapon a player has, but removing an ammount is weirder then I thought,
example:

PHP Code:

function onCreated()
{
  
temp.arr = { 123123};
  
temp.arr.remove1);
  
  echo( 
temp.arr);


It removes the first 1 it finds ( 0), when I try to clear out the other 1 ( 3)
I've tried like temp.arr[ 3] = NULL; temp.arr[ 3].clear();

Anyone know the solution for this?

Use .delete();

temp.arr.delete(index); to remove by index instead of object.

Chompy 12-23-2006 10:56 PM

Quote:

Originally Posted by Andy0687 (Post 1256558)
Use .delete();

temp.arr.delete(index); to remove by index instead of object.

Hmm, didn't think of that :D Thanks


All times are GMT +2. The time now is 08:22 PM.

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