Raised This Month: $51 Target: $400
 12% 

Solved Invalid cellvector handle


Post New Thread Reply   
 
Thread Tools Display Modes
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 07-23-2018 , 08:04   Re: Invalid cellvector handle
Reply With Quote #11

Yes it's 182, which you can figure by the formatting of the error he had.

But whatever the error says, the nature of it is still the same, you can't get from an empty array.
__________________
stuff
maqi is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-23-2018 , 08:19   Re: Invalid cellvector handle
Reply With Quote #12

I'm glad the error message is changed in 1.8.3, the 1.8.2 one isn't helpful unless you read the code yourself to know what those 3 values actually represent.
__________________
klippy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-23-2018 , 08:35   Re: Invalid cellvector handle
Reply With Quote #13

Quote:
Originally Posted by maqi View Post
ArraySize()
I meant to check if one entry is empty not the entire array..
__________________
edon1337 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-23-2018 , 08:38   Re: Invalid cellvector handle
Reply With Quote #14

Quote:
Originally Posted by edon1337 View Post
I meant to check if one entry is empty not the entire array..
What do you mean by "one entry is empty"? You are getting the error because the array is empty and you are trying to access an element from it.
__________________
klippy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-23-2018 , 08:58   Re: Invalid cellvector handle
Reply With Quote #15

Quote:
Originally Posted by KliPPy View Post
What do you mean by "one entry is empty"? You are getting the error because the array is empty and you are trying to access an element from it.
The entire array isn't empty, there might be just some entries in the array that are causing this error.
__________________
edon1337 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-23-2018 , 09:11   Re: Invalid cellvector handle
Reply With Quote #16

Quote:
Originally Posted by edon1337 View Post
The entire array isn't empty, there might be just some entries in the array that are causing this error.
There's no such thing. The error states "1:0:0" which means you tried to access the array with handle 1, element 0, but the array had 0 elements.
__________________
klippy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-23-2018 , 09:14   Re: Invalid cellvector handle
Reply With Quote #17

I did some debugs
PHP Code:
RetrieveOrigins( )
{
    
log_to_file"Array.txt""#1 Size: %d"ArraySizeg_aOrigins ) );

    new 
Float:fOrigin];
    
    for( new 
i=1<= MAX_ORIGINSi++ )
    {
        if( 
SsGetOriginfOrigin ) )
        {
            
SaveOriginfOrigin );
        }
    }
}

SaveOriginFloat:fOrigin] )
{
    
log_to_file"Array.txt""#2 Size: %d"ArraySizeg_aOrigins ) );

    new 
eDataOriginDimensions ];

    
eDataORIGIN ][ ] = _:fOrigin];
    
eDataORIGIN ][ ] = _:fOrigin];
    
eDataORIGIN ][ ] = _:fOrigin];
    
    
ArrayPushArrayg_aOriginseData );
}

GetRandomOriginFloat:fOrigin] )
{
    new 
eDataOriginDimensions ];
    
    new 
iRandomEntry random_num0ArraySizeg_aOrigins ) );
    
    
log_to_file"Array.txt""#3 Size: %d | Entry: %d"ArraySizeg_aOrigins ), iRandomEntry );
    
    
ArrayGetArrayg_aOriginsiRandomEntryeData );

    
fOrigin] = eDataORIGIN ][ ];
    
fOrigin] = eDataORIGIN ][ ];
    
fOrigin] = eDataORIGIN ][ ];
    
    
ArrayDeleteItemg_aOriginsiRandomEntry );

PHP Code:
L 07/23/2018 15:06:41#1 Size: 0
L 07/23/2018 15:06:41#2 Size: 0
L 07/23/2018 15:06:41#2 Size: 1
L 07/23/2018 15:06:41#2 Size: 2
L 07/23/2018 15:06:41#2 Size: 3
L 07/23/2018 15:06:41#2 Size: 4
L 07/23/2018 15:06:41#2 Size: 5
L 07/23/2018 15:06:41#2 Size: 6
L 07/23/2018 15:06:41#2 Size: 7
L 07/23/2018 15:06:41#2 Size: 8
L 07/23/2018 15:06:41#2 Size: 9
L 07/23/2018 15:06:41#2 Size: 10
L 07/23/2018 15:06:41#2 Size: 11
L 07/23/2018 15:06:41#2 Size: 12
L 07/23/2018 15:06:41#2 Size: 13
L 07/23/2018 15:06:41#2 Size: 14
L 07/23/2018 15:06:41#2 Size: 15
L 07/23/2018 15:06:41#2 Size: 16
L 07/23/2018 15:06:41#2 Size: 17
L 07/23/2018 15:06:41#2 Size: 18
L 07/23/2018 15:06:41#2 Size: 19
L 07/23/2018 15:06:41#2 Size: 20
L 07/23/2018 15:06:41#2 Size: 21
L 07/23/2018 15:06:41#2 Size: 22
L 07/23/2018 15:06:41#2 Size: 23
L 07/23/2018 15:06:41#2 Size: 24
L 07/23/2018 15:06:41#2 Size: 25
L 07/23/2018 15:06:41#2 Size: 26
L 07/23/2018 15:06:41#2 Size: 27
L 07/23/2018 15:06:41#2 Size: 28
L 07/23/2018 15:06:41#2 Size: 29
L 07/23/2018 15:06:41#2 Size: 30
L 07/23/2018 15:06:41#2 Size: 31
L 07/23/2018 15:06:41#2 Size: 32
L 07/23/2018 15:06:41#2 Size: 33
L 07/23/2018 15:06:41#2 Size: 34
L 07/23/2018 15:06:41#2 Size: 35
L 07/23/2018 15:06:41#2 Size: 36
L 07/23/2018 15:06:41#2 Size: 37
L 07/23/2018 15:06:41#2 Size: 38
L 07/23/2018 15:06:41#2 Size: 39
L 07/23/2018 15:06:41#2 Size: 40
L 07/23/2018 15:07:05#1 Size: 0
L 07/23/2018 15:07:05#3 Size: 0 | Entry: 0 
Apparently the array size gets reset for some reason
__________________
edon1337 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-23-2018 , 09:19   Re: Invalid cellvector handle
Reply With Quote #18

Do you have ArrayClear or ArrayDeleteItem in any other place? You should create a minimal compilable and runnable example that produces the issue so everyone can test it out. With you just giving pieces of your code we can only keep guessing.
__________________
klippy is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 07-23-2018 , 09:46   Re: Invalid cellvector handle
Reply With Quote #19

It won't clear the array on it's own for no reason

Quote:
Originally Posted by KliPPy View Post
You should create a minimal compilable and runnable example that produces the issue so everyone can test it out.
__________________
stuff
maqi is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-23-2018 , 10:06   Re: Invalid cellvector handle
Reply With Quote #20

Quote:
Originally Posted by maqi View Post
It won't clear the array on it's own for no reason
Well, I'm not clearing it either?

Quote:
Originally Posted by KliPPy View Post
Do you have ArrayClear or ArrayDeleteItem in any other place? You should create a minimal compilable and runnable example that produces the issue so everyone can test it out. With you just giving pieces of your code we can only keep guessing.
You already have the code

Quote:
Originally Posted by edon1337 View Post
Am I missing something here?

PHP Code:
enum _:OriginDimensions
{
    
Float:ORIGIN]
}

new Array:
g_aOrigins;

public 
plugin_init( )
{
    
SsInit1000.0 );
    
SsScan( );
    
SsDump( );
    
    
RetrieveOrigins( );
}

public 
plugin_precache( )
{
    
g_aOrigins ArrayCreateOriginDimensions );
}

public 
RoundStarted( )
{
    
ArrayClearg_aOrigins );
    
RetrieveOrigins( );
    
    
GetRandomOriginfOrigin );
    
    
// code
}

RetrieveOrigins( )
{
    new 
Float:fOrigin];
    
    for( new 
i=1<= MAX_ORIGINSi++ )
    {
        if( 
SsGetOriginfOrigin ) )
        {
            
SaveOriginfOrigin );
        }
    }
}

SaveOriginFloat:fOrigin] )
{
    new 
eDataOriginDimensions ];

    
eDataORIGIN ][ ] = _:fOrigin];
    
eDataORIGIN ][ ] = _:fOrigin];
    
eDataORIGIN ][ ] = _:fOrigin];
    
    
ArrayPushArrayg_aOriginseData );
}

GetRandomOriginFloat:fOrigin] )
{
    new 
eDataOriginDimensions ];

    new 
iRandomEntry random_num0ArraySizeg_aOrigins ) );
    
    
ArrayGetArrayg_aOriginsiRandomEntryeData );

    
fOrigin] = eDataORIGIN ][ ];
    
fOrigin] = eDataORIGIN ][ ];
    
fOrigin] = eDataORIGIN ][ ];
    
    
ArrayDeleteItemg_aOriginsiRandomEntry );

https://forums.alliedmods.net/showthread.php?t=132500
__________________
edon1337 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 06:08.


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