Raised This Month: $ Target: $400
 0% 

Problem with Varchars


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 10-16-2010 , 09:58   Re: Problem with Varchars
Reply With Quote #4

No you make 1 query in plugin init and retrieve 15 rows at once:
PHP Code:
public load_toplist()
{
    new 
szTemp[512]
    
format(szTemp,charsmax(szTemp),"SELECT * FROM `deathrun` ORDER BY `deathrun`.`points` DESC LIMIT 15")
    
SQL_ThreadQuery(g_SqlTuple,"Toplist2",szTemp)
    return 
PLUGIN_CONTINUE
}

public 
Toplist2(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    if(
FailState)
    {
        
log_amx("SQL Error: %s (%d)"ErrorErrcode)
        return 
PLUGIN_HANDLED
    
}

    new 
count[32], count1[32], count2count3count4count5
    
while(SQL_MoreResults(Query))
    {
        
SQL_ReadResult(Query,0count31)
        
SQL_ReadResult(Query,1count131)
        
count2 SQL_ReadResult(Query,2)
        
count3 SQL_ReadResult(Query,3)
        
count4 SQL_ReadResult(Query,4)
        
count5 SQL_ReadResult(Query,5)

        
print_color(010"^x04-=[Pingstars]=- ^x01 %s - %s - %i - %i - %i - %i "countcount1count2count3count4count5)
        
SQL_NextRow(Query)
    }

    return 
PLUGIN_HANDLED

You can test this with clcmd.
__________________
Impossible is Nothing

Last edited by Sylwester; 10-16-2010 at 10:09.
Sylwester 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 10:17.


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