View Single Post
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-01-2016 , 05:35   Re: Methodmaps on global variables
Reply With Quote #5

Code:
g_hMenuDataPack[iClient].Reset(false); // or true to clear data
Quote:
Originally Posted by ReFlexPoison View Post
I'm probably missing something pretty simple. I'm getting used to the new syntax and have been running into an issue with global variables, specifically with datapacks. I'm getting some errors.

PHP Code:
DataPack g_hMenuDataPack[MAXPLAYERS 1];
func1(int iClient)
{
    if(
g_hMenuDataPack[iClient] != null)
    {
        
delete g_hMenuDataPack[iClient];
        
g_hMenuDataPack[iClient] = null;
    }

    
g_hMenuDataPack[iClient] = new DataPack();
    
g_hMenuDataPack[iClient].WriteString(strPerk);
    
g_hMenuDataPack[iClient].WriteCell(iPrice);
    
g_hMenuDataPack[iClient].WriteCell(iDuration);
}

func2(int iClient)
{
    
g_hMenuDataPack[iClient].Reset(); // This is where I get the "invalid datapack handle" error.

__________________
Do not Private Message @me
Bacardi is offline