Raised This Month: $ Target: $400
 0% 

Using dynamic arrays for all players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-08-2009 , 16:03   Re: Using dynamic arrays for all players
Reply With Quote #1

PHP Code:
new Array:g_aBinds33 ];
new 
g_iTotalBinds33 ];

public 
plugin_init( )
{
    new 
iMaxPlayers get_maxplayers( );
    
    for( new 
1<= iMaxPlayersi++ )
    {
        
g_aBinds] = ArrayCreate64 ); // 64 = max bind length
    
}
}

public 
load_binds(id)
{
    
id -= TASK_ID_BINDS;
    
    new 
szData[256], szKey[64];
    
    
formatex(szKey63"%sSETTINGS"g_szAuthID[id]);
    
    
// Load bind settings
    
if( nvault_get(g_BindVaultszKeyszData255) )
    {
        new 
szSettings[2][2];
        
parse(szDataszSettings[0], 1szSettings[1], 1);
        
        
g_iSettings[0][id] = str_to_num(szSettings[0]);
        
g_iSettings[1][id] = str_to_num(szSettings[1]);
    }
    
    
get_pcvar_num(p_BindMulti) ?
    
formatex(szKey63"%s%s"g_szAuthID[id], g_szBindMode) : formatex(szKey63"%sBINDS"g_szAuthID[id]);
        
    
ArrayClearg_aBindsid ] );
    
g_iTotalBindsid ] = 0;
    
    
// Load specific bind configuration
    
if( nvault_get(g_BindVaultszKeyszData255) )
    {
        new 
szLeft[16];
        
        while( 
contain(szData"#") != -&& temp g_MaxBinds )
        {
            
strtok(szDataszLeft15szData255'#'1);
            
            
ArrayPushStringg_aBindsid ], szLeft );
            
g_iTotalBindsid ]++;
        }
    }
    
    
// Check if autobind is on
    
if( g_iSettings[0][id] )
        
set_binds(id);

PHP Code:
// looping through binds
new szBind64 ];
for( new 
0g_iTotalBindsid ]; i++ )
{
    
ArrayGetStringg_aBindsid ], iszBind63 );
    
    
// szBind = bind with index of i

No need for g_MaxBinds
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 17:38.


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