This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

2d Array Crash


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zekStein
Member
Join Date: Feb 2011
Location: Romania :(
Old 05-20-2012 , 12:00   2d Array Crash
Reply With Quote #1

Hello there,

I have a problem with a 2d array, and i can't solve it.

PHP Code:
new szInfo][ 64 ]; // this is the line 282.
str_explodeszIdent'~'szInfo6charsmaxszInfo[ ] ) );
//szIdent = player~money~name~str~music~smoke. 
=>
PHP Code:
L 05/20/2012 18:54:21: [AMXXDisplaying debug trace (plugin "test.amxx")
L 05/20/2012 18:54:21: [AMXXRun time error 3stack error 
L 05
/20/2012 18:54:21: [AMXX]    [0test.sma::HandleText (line 282
PHP Code:
stock str_explode(const string[], delimiteroutput[][], output_sizeoutput_len)
    {
        new 
iposlen strlen(string);
        
        do
        {
            
pos += (copyc(output[i++], output_lenstring[pos], delimiter) + 1);
        }
        while(
pos len && output_size);
        
        return 
i;
    } 
// @Exolent. 
Note: If i try to hard-code str_explode( explode manually with strtok ) i have the same problem.

How can i fix it ?
Thanks.
__________________
DUMITRU

Last edited by zekStein; 05-20-2012 at 12:41.
zekStein is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-20-2012 , 12:32   Re: 2d Array Crash
Reply With Quote #2

Your error is:

PHP Code:
charsmaxszInfo[ ] ) 
You can't measure the character amount like that.

EDIT: Yeah my bad I'm wrong.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 05-20-2012 at 21:16.
hornet is offline
zekStein
Member
Join Date: Feb 2011
Location: Romania :(
Old 05-20-2012 , 12:39   Re: 2d Array Crash
Reply With Quote #3

Quote:
Originally Posted by hornet View Post
Your error is:

PHP Code:
charsmaxszInfo[ ] ) 
You can't measure the character amount like that.
Yes i can ... even if i put myself the number of characters i have the same error so isn't from there.
__________________
DUMITRU

Last edited by zekStein; 05-20-2012 at 12:39.
zekStein is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-20-2012 , 21:10   Re: 2d Array Crash
Reply With Quote #4

EDIT: Okay my apologies, it turns out that you can do that and it works.

However I wouldn't be so quick to jump out and say Exolent's stock doesn't work. I've just run a quick test and it works fine how you've shown it. Post your whole code.

PHP Code:
new szInfo][ 64 ];
new 
szIdent[] = "player~money~name~str~music~smoke";
    
str_explodeszIdent'~'szInfo6charsmaxszInfo[] ) );

//run a test:
for( new ++ )
        
client_printidprint_chat"%s"szInfo] ); 
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 05-20-2012 at 21:17.
hornet is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-20-2012 , 21:24   Re: 2d Array Crash
Reply With Quote #5

Stack error is when your plugin doesn't have enough memory to create variables.
Try making it static, or declaring a larger memory size for your plugin.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
zekStein
Member
Join Date: Feb 2011
Location: Romania :(
Old 05-21-2012 , 07:34   Re: 2d Array Crash
Reply With Quote #6

Quote:
Originally Posted by Exolent[jNr] View Post
Stack error is when your plugin doesn't have enough memory to create variables.
Try making it static, or declaring a larger memory size for your plugin.

That solved my problem, thank you so much !
__________________
DUMITRU
zekStein is offline
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 -4. The time now is 08:00.


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