Raised This Month: $ Target: $400
 0% 

Total Entries in MySql


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
demon81
Member
Join Date: Sep 2010
Location: Portugal
Old 08-08-2014 , 04:15   Total Entries in MySql
Reply With Quote #1

Code:
public Show_Rank(id) // register cmd to this function
{
    for(new i; i < MaxPlayers; i++)
    {
        if(is_user_connected(i))
           Save_MySql(i) // Save all stats to get the correct rank
    }
        
    new Data[1]
    Data[0] = id
    
    new szTemp[512]
    format(szTemp,charsmax(szTemp),"SELECT COUNT(*) FROM `tutorial` WHERE `exp` >= %d", Exp[id])
    // Select the count where the exp is matching or higher (Incase of equal exp)
    SQL_ThreadQuery(g_SqlTuple,"Sql_Rank",szTemp,Data,1)
        
    return PLUGIN_CONTINUE
}

public Sql_Rank(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    if(FailState == TQUERY_CONNECT_FAILED)
            log_amx("Load - Could not connect to SQL database.  [%d] %s", Errcode, Error)
    else if(FailState == TQUERY_QUERY_FAILED)
            log_amx("Load Query failed. [%d] %s", Errcode, Error)
  
    new count = 0
    count = SQL_ReadResult(Query,0)
    if(count == 0)
    count = 1
    
    new id
    id = Data[0]

    client_print(id, print_chat, "You are at rank %i with %i exp", count, Exp[id]);
    
    return PLUGIN_HANDLED
}


how do i get the total entries to make it show like this:

"You are at rank %i from %i with %i exp" being the second "%i" the total entries/players.

Thanks in advance!
demon81 is offline
 



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 13:01.


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