Raised This Month: $32 Target: $400
 8% 

CellArray returning invalid handle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-26-2008 , 12:21   CellArray returning invalid handle
Reply With Quote #1

Okay, can anyone provide me some clues as to why this keeps happening?

Code:
Code:
#pragma semicolon 1 #include <amxmodx> #include <amxmisc> #define PLUGIN  "AMX Super Menu" #define AUTHOR  "Yami Kaitou" #define VERSION "0.7.2" enum {     alltalk = 1,     lock,     unlock,     extend,     maxvalue } new Array:valueArray; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     valueArray = ArrayCreate(1, maxvalue); } public plugin_cfg() {     build_arrays(); } build_arrays() {     new Array:temp = ArrayCreate();     for (new k = 5; k < 16; k+=5)         ArrayPushCell(temp, k);     for (new k = 30; k < 61; k+=15)         ArrayPushCell(temp, k);
    ArraySetCell(valueArray, extend, temp);
}


Error:
Quote:
L 05/26/2008 - 11:11:26: Invalid cellvector handle provided (8:4:0)
L 05/26/2008 - 11:11:26: [AMXX] Displaying debug trace (plugin "test.amxx")
L 05/26/2008 - 11:11:26: [AMXX] Run time error 10: native error (native "ArraySetCell")
L 05/26/2008 - 11:11:26: [AMXX] [0] test.sma::build_arrays (line 40)
L 05/26/2008 - 11:11:26: [AMXX] [1] test.sma::plugin_cfg (line 29)
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 05-26-2008 , 12:50   Re: CellArray returning invalid handle
Reply With Quote #2

Have you tried delaying the initialisation?
Lee is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-26-2008 , 12:53   Re: CellArray returning invalid handle
Reply With Quote #3

You have created an Array of one cell only.

Code:
valueArray = ArrayCreate(1, maxvalue);

should be :

Code:
valueArray = ArrayCreate(maxvalue-1);

Then, using, 'ArrayPushArray()'.

I hope I am not mistaken.


EDIT : What I mean is you want to deal with array, so you have to create array of Array.

Code:
    enum e_Data     {         alltalk,         lock,         unlock,         extend,     };         new g_iData[ e_Data ];         new Array:valueArray;     public plugin_init()     {         valueArray = ArrayCreate ( e_Data );     }     public plugin_cfg()     {         build_arrays();     }         build_arrays()     {         new Array:temp = ArrayCreate();         new k;                 for (k = 5; k < 16; k+=5)             ArrayPushCell(temp, k);                     for (k = 30; k < 61; k+=15)             ArrayPushCell(temp, k);         g_iData[ extend ] = k;         ArrayPuchArray ( valueArray, g_iData );     }
__________________

Last edited by Arkshine; 05-26-2008 at 13:10.
Arkshine is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-26-2008 , 23:30   Re: CellArray returning invalid handle
Reply With Quote #4

According to the include file, it says that I need a 1 cellsize if I am using ArraySetCell. I would like to get it working in my manner as it is less lines of code that I have to use to get it working.

In case you need it, here is the plugin that is causing the https://forums.alliedmods.net/showthread.php?p=584790


Also tried a 2 second delay and still produces the same error
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-27-2008 , 00:03   Re: CellArray returning invalid handle
Reply With Quote #5

Error fixed with help from sawce. Seems that I need to push "blank" entries into the array, even if I am reserving some. So, just adding a loop that pushed a 0 on every entry caused the error to not display anymore.


Thanks anyways guys
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-27-2008 , 04:42   Re: CellArray returning invalid handle
Reply With Quote #6

I see. I didn't know that we can do this way. Sorry.
__________________
Arkshine is offline
Reply


Thread Tools
Display Modes

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 -4. The time now is 22:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode