Finish an subject
hi all, i want to know how to finish this menu from this topic
http://forums.alliedmods.net/showthread.php?t=175675
only i need is DB_GetAllXP(id, start_page)
PHP Code:
public DB_GetAllXP( id ) { // If we're not saving XP, why do this? if ( !get_pcvar_num( CVAR_wc3_save_xp ) || !id ) { return; } // Get the XP switch( g_DBType ) { case DB_MYSQLX: MYSQLX_GetAllXP( id ); case DB_SQLITE: SQLITE_GetAllXP( id ); }
return; }
MYSQLX_GetAllXP( id ) { // Make sure our connection is working if ( !MYSQLX_Connection_Available() ) { return; } new iUniqueID = DB_GetUniqueID( id );
// Then we have a problem and cannot retreive the user's XP if ( iUniqueID <= 0 ) { client_print( id, print_chat, "%s Unable to retreive your XP from the database, please attempt to changerace later", g_MODclient );
WC3_Log( true, "[ERROR] Unable to retreive user's Unique ID" );
return; }
new szQuery[256]; format(szQuery, 255, "SELECT `race_id`, `race_xp` FROM `wc3_player_race` WHERE ( `player_id` = '%d' );", iUniqueID ); new Handle:query = SQL_PrepareQuery( g_DBConn, szQuery );
if ( !SQL_Execute( query ) ) { client_print( id, print_chat, "%s Error, unable to retrieve XP, please contact a server administrator", g_MODclient );
MYSQLX_Error( query, szQuery, 6 );
return; }
// Set last saved XP to 0 for ( new i = 0; i < MAX_RACES; i++ ) { g_iDBPlayerXPInfoStore[id][i] = 0; }
// Get the XP! new iXP, iRace;
// Loop through all of the records to find the XP data while ( SQL_MoreResults( query ) ) { iRace = SQL_ReadResult( query, 0 ); iXP = SQL_ReadResult( query, 1 ); // Save the user's XP in an array if ( iRace > 0 && iRace < MAX_RACES + 1 ) { g_iDBPlayerXPInfoStore[id][iRace-1] = iXP; }
SQL_NextRow( query ); }
// Free the handle SQL_FreeHandle( query );
// Call the function that will display the "select a race" menu WC3_ChangeRaceShowMenu( id, g_iDBPlayerXPInfoStore[id] );
return; }
SQLITE_GetAllXP( id ) { // Make sure our connection is working if ( !SQLITE_Connection_Available() ) { return; }
new iUniqueID = DB_GetUniqueID( id );
// Then we have a problem and cannot retreive the user's XP if ( iUniqueID <= 0 ) { client_print( id, print_chat, "%s Unable to retreive your XP from the database, please attempt to changerace later", g_MODclient );
WC3_Log( true, "[ERROR] Unable to retreive user's Unique ID" );
return; }
new szQuery[256]; format(szQuery, 255, "SELECT `race_id`, `race_xp` FROM `wc3_player_race` WHERE ( `player_id` = '%d' );", iUniqueID ); new Handle:query = SQL_PrepareQuery( g_DBConn, szQuery );
if ( !SQL_Execute( query ) ) { SQLITE_Error( query, szQuery, 8 );
return; }
// Set last saved XP to 0 for ( new i = 0; i < MAX_RACES; i++ ) { g_iDBPlayerXPInfoStore[id][i] = 0; }
new iXP, iRace;
// Loop through all of the records to find the XP data while ( SQL_MoreResults( query ) ) { iRace = SQL_ReadResult( query, 0 ); iXP = SQL_ReadResult( query, 1 ); // Save the user's XP in an array if ( iRace > 0 && iRace < MAX_RACES + 1 ) { g_iDBPlayerXPInfoStore[id][iRace-1] = iXP; }
SQL_NextRow( query ); }
// Free the handle SQL_FreeHandle( query );
// Call the function that will display the "select a race" menu WC3_ChangeRaceShowMenu( id, g_iDBPlayerXPInfoStore[id] );
return; }
thanks
|