Raised This Month: $ Target: $400
 0% 

(KREEDZ) How to check New record?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 04-19-2012 , 22:50   (KREEDZ) How to check New record?
Reply With Quote #1

I tried it but i can't


PHP Code:
public Set_QueryHandler(iFailStateHandle:hQueryszError[], iErrnumcData[], iSizeFloat:fQueueTime)
{
    
    new 
id cData[0]
    new 
style cData[1]
    if( 
iFailState != TQUERY_SUCCESS )
    {
        
log_amx("[KREEDZ] TOP15 SQL: SQL Error #%d - %s"iErrnumszError)
        
ColorChat(0RED"Warring the SQL Tops can not be saved, notify this to a server ADMIN!")
    }
    
    
server_print("[KREEDZ] Server geting info of SQL server")
    
    new 
createinto[1001]
    new 
x1[16], x2[4], x3[5], x4[5]
    
parse(cData[2], x115x23x34x44)

    new 
dia[64], steam[32], name[32], ip[15], country[3], checkpoints[32], gochecks[32]
    new 
Float:newtime str_to_float(x1)
    new 
iMiniSeciMsserver[64]
    
get_pcvar_string(kz_sql_nameserver63)
    
get_time("%Y%m%d%H%M%S"diasizeof dia 1
    
get_user_authid(idsteam31)
    
get_user_name(idnamesizeof name 1)
    
get_user_ip (idipsizeof ip 11)
    
geoip_code2_exipcountry)
    
    
replace_all(name31"\", "")
    replace_all(name, 31, "
`", "")
    replace_all(name, 31, "'", "")
    

    if( SQL_NumResults(hQuery) == 0 )
    {
        formatex(checkpoints, 31, ", '%d'", str_to_num(x3))
        formatex(gochecks, 31, ", '%d'", str_to_num(x4))
        formatex( createinto, sizeof createinto - 1, "INSERT INTO 
`%s` VALUES('%s', '%s','%s','%s','%f','%s','%s','%s'%s%s)", 
        style == PRO_TOP ? "kz_pro" : "kz_general", MapName, steam,country, name, newtime, dia, g_weaponsnames[str_to_num(x2)], 
        server, style == PRO_TOP ? "" : checkpoints, style == PRO_TOP ? "" : gochecks)
        SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto)
        GetNewRank(id, style)
    }
    else
    {
        
        new Float:oldtime, Float:thetime
        SQL_ReadResult(hQuery, 0, oldtime)
        
        
        if(newtime < oldtime)
        {
            thetime = oldtime - newtime
            iMin = floatround(thetime / 60.0, floatround_floor)
            iSec = floatround(thetime - iMin * 60.0,floatround_floor)
            iMs = floatround( ( thetime - ( iMin * 60.0 + iSec ) ) * 100.0, floatround_floor )
            set_hudmessage(0, 255, 0, -1.0, 0.26, 1, 6.0, 07.0)
            show_hudmessage(id, "You improved your time by %02i:%02i.%02i in %s", iMin, iSec, iMs, style == PRO_TOP ? "Professional Top" : "General Top")
    
            formatex(checkpoints, 31, ", checkpoints='%d'", str_to_num(x3))
            formatex(gochecks, 31, ", gocheck='%d'", str_to_num(x4))
            if(equal(steam, "VALVE_ID_LAN") || equal(steam, "STEAM_ID_LAN") || strlen(steam) > 18)
                formatex(createinto, sizeof createinto - 1, "UPDATE 
`%s` SET time='%f', weapon='%s', date='%s', 
                server='%s'%s%s WHERE name='%s' AND mapname='%s'", style == PRO_TOP ? "kz_pro" : "kz_general",newtime, 
                g_weaponsnames[str_to_num(x2)],  dia, server, style == PRO_TOP ? "" : gochecks, style == PRO_TOP ? "" : checkpoints, name, MapName)
            else
                formatex(createinto, sizeof createinto - 1, "UPDATE 
`%s` SET time='%f', weapon='%s', date='%s', 
                server='%s'%s%s WHERE authid='%s' AND mapname='%s'", style ==PRO_TOP ? "kz_pro" :"kz_general", newtime, 
                g_weaponsnames[str_to_num(x2)],  dia, server, style == PRO_TOP ? "" : gochecks, style == PRO_TOP ? "" : checkpoints, steam, MapName)
    
            SQL_ThreadQuery(g_SqlTuple, "QueryHandle", createinto )
            GetNewRank(id, style)
        }
        else
        {
            thetime = newtime - oldtime
            iMin = floatround(thetime / 60.0, floatround_floor)
            iSec = floatround(thetime - iMin * 60.0,floatround_floor)
            iMs = floatround( ( thetime - ( iMin * 60.0 + iSec ) ) * 100.0, floatround_floor )
            
            set_hudmessage(255, 0, 0, -1.0, 0.26, 1, 6.0, 07.0)
            show_hudmessage(id, "You failed your best time by %02i:%02i.%02i in %s", iMin, iSec, iMs, style == PRO_TOP ? "Professional Top" : "General Top")
        }
    }
    
    return PLUGIN_CONTINUE
    

PHP Code:
public GetNewRank_QueryHandler(iFailStateHandle:hQueryszError[], iErrnumcData[], iSizeFloat:fQueueTime)
{

    new 
id cData[0]
    if( 
iFailState != TQUERY_SUCCESS )
    {
        return 
log_amx("TOP15 SQL: SQL Error #%d - %s"iErrnumszError)
    }
    
    new 
steam[32], authid[32], namez[32], name[32], 0weapon get_user_weapon(id)
    
get_user_authid(idsteam31)
    
get_user_name(idnamez31)

    while( 
SQL_MoreResults(hQuery) )
    {
        
i++
        if(
equal(steam"VALVE_ID_LAN") || equal(steam"STEAM_ID_LAN") || strlen(steam) > 18)
        {
            
SQL_ReadResult(hQuery0name31)
            if( 
equal(namenamez) )
            {
                
                
ColorChat(0GREY"%s is now on place #%d in %s"namezicData[1] == PRO_TOP "Professional Top" "General Top");
                break;
                }
        }
        else
        {
            
            
SQL_ReadResult(hQuery0authid31)
            if( 
equal(authidsteam) )
            {
                
ColorChat(0GREY"%s is now on place #%d in %s"namezicData[1] == PRO_TOP "Professional Top" "General Top");
                break;
                }
        }
        
SQL_NextRow(hQuery)
    }
    
    return 
PLUGIN_CONTINUE    

If a new record is established skip ColorChat(0, GREY, "%s is now on place #%d in %s", namez, i, cData[1] == PRO_TOP ? "Professional Top" : "General Top");
and write this: ColorChat(0, GREY, "%s established a new record in %s", namez, cData[1] == PRO_TOP ? "Professional Top" : "General Top");

Last edited by bazhenov93; 04-19-2012 at 22:51.
bazhenov93 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 07:55.


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