PHP Code:
new Array:g_aBinds[ 33 ];
new g_iTotalBinds[ 33 ];
public plugin_init( )
{
new iMaxPlayers = get_maxplayers( );
for( new i = 1; i <= iMaxPlayers; i++ )
{
g_aBinds[ i ] = ArrayCreate( 64 ); // 64 = max bind length
}
}
public load_binds(id)
{
id -= TASK_ID_BINDS;
new szData[256], szKey[64];
formatex(szKey, 63, "%sSETTINGS", g_szAuthID[id]);
// Load bind settings
if( nvault_get(g_BindVault, szKey, szData, 255) )
{
new szSettings[2][2];
parse(szData, szSettings[0], 1, szSettings[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(szKey, 63, "%s%s", g_szAuthID[id], g_szBindMode) : formatex(szKey, 63, "%sBINDS", g_szAuthID[id]);
ArrayClear( g_aBinds[ id ] );
g_iTotalBinds[ id ] = 0;
// Load specific bind configuration
if( nvault_get(g_BindVault, szKey, szData, 255) )
{
new szLeft[16];
while( contain(szData, "#") != -1 && temp < g_MaxBinds )
{
strtok(szData, szLeft, 15, szData, 255, '#', 1);
ArrayPushString( g_aBinds[ id ], szLeft );
g_iTotalBinds[ id ]++;
}
}
// Check if autobind is on
if( g_iSettings[0][id] )
set_binds(id);
}
PHP Code:
// looping through binds
new szBind[ 64 ];
for( new i = 0; i < g_iTotalBinds[ id ]; i++ )
{
ArrayGetString( g_aBinds[ id ], i, szBind, 63 );
// szBind = bind with index of i
}
No need for g_MaxBinds
__________________