View Single Post
Author Message
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 03-31-2016 , 23:39   Methodmaps on global variables
Reply With Quote #1

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.


Last edited by ReFlexPoison; 03-31-2016 at 23:55.
ReFlexPoison is offline