AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   TimerFinish Save [Solved] (https://forums.alliedmods.net/showthread.php?t=226484)

Baws 09-18-2013 17:56

TimerFinish Save [Solved]
 
I want that people when they finish the map and press the button, to like i want it to save by steamid cause saving by name is horrible. So any idea how to do it? or you need the code? :)

Black Rose 09-18-2013 19:10

TimerFinish Save [Help]
 
Sounds like switching get_user_name() to get_user_authid() should be enough. If it fails please link/share code.

Baws 09-18-2013 21:44

Re: TimerFinish Save [Help]
 
Not sure really because there is the 2.

PHP Code:

#include <amxmodx>
#include <geoip>
#include <kzarg>

#define TOP_VERSION "1.0"

new const KZ_TOP15_DIR[] = "addons/amxmodx/configs/kz/top15"

new g_saytext
new g_maxplayers
new g_item

new Float:Pro_Tiempos[24]
new 
Pro_AuthIDS[24][32]
new 
Pro_Names[24][32]
new 
Pro_Weapons[24][32]
new 
Pro_Date[24][32]
new 
Pro_Country[24][3]

new 
Float:Nub_Tiempos[24]
new 
Nub_AuthIDS[24][32]
new 
Nub_Names[24][32]
new 
Nub_Weapons[24][32]
new 
Nub_Date[24][32]
new 
Nub_Country[24][3]
new 
Nub_GoChecks[24]

//==================================================================================================

new const g_weaponsnames[][] =
{
    
""// NULL
    
"p228""shield""scout""hegrenade""xm1014""c4",
    
"mac10""aug""smokegrenade""elite""fiveseven",
    
"ump45""sg550""galil""famas""usp""glock18",
    
"awp""mp5navy""m249""m3""m4a1""tmp""g3sg1",
    
"flashbang""deagle""sg552""ak47""knife""p90"
};

//==================================================================================================

public plugin_init() 
{
    
register_plugin("kzarg"TOP_VERSION"kzarg");
    
    
kz_register_saycmd("top15""top15menu", -1"")
    
kz_register_saycmd("pro15""showpro15", -1"")
    
kz_register_saycmd("nub15""shownub15", -1"")
    
    
g_item kz_mainmenu_item_register("Top15""")
    
    
g_saytext get_user_msgid("SayText")
    
g_maxplayers get_maxplayers()
}

//==================================================================================================

public plugin_precache()
{
    if( !
dir_exists(KZ_TOP15_DIR) )
        
mkdir(KZ_TOP15_DIR);
        
}

public 
plugin_cfg()
{
    for (new 
15; ++i)
    {
        
Pro_Tiempos[i] = 999999999.00000;
        
Nub_Tiempos[i] = 999999999.00000;
    }
    
read_pro15()
    
read_nub15()
}

//==================================================================================================

public kz_finishclimb(idFloat:tiempocheckpointsgochecksweapon)
{
    if( 
gochecks == && (weapon == CSW_USP || weapon == CSW_KNIFE) )
    {
        
set_sql_pro15(idtiempoweapon)
    }
    else if( 
weapon == CSW_USP || weapon == CSW_KNIFE || weapon == CSW_SCOUT )
    {
        
set_sql_nub15(idtiempogochecksweapon)
    }
    else
    {
        
//Others Weapons Tops
    
}
}

public 
set_sql_pro15(idFloat:tiempoweapon
{
    new 
authid[32], name[32], nombrearma[32], ip[32], pais[3], horario[32];
    
get_user_name(idname31);
    
get_user_authid(idauthid31);
    
get_time(" %m/%d/%Y "horario31);
    
get_user_ip(idip31);
    
geoip_code2(ippais);
    
formatex(nombrearma31g_weaponsnames[weapon])
    new 
bool:Is_in_pro15
    Is_in_pro15 
false
    
    
for(new 015i++)
    {
        if( 
equali(Pro_Names[i], name) )
        {
            
Is_in_pro15 true
        
}
    }
    
    for (new 
015i++)
    {
        new 
Float:mejorar tiempo Pro_Tiempos[i];
        new 
Float:mejoro Pro_Tiempos[i] - tiempo;
        new 
Float:protiempo Pro_Tiempos[i]
        
        if( 
tiempo Pro_Tiempos[i])
        {
            new 
pos i
            
            
while( !equal(Pro_Names[pos], name) && pos 15 )
            {
                
pos++;
            }
            
            for (new 
posij--)
            {
                
formatex(Pro_AuthIDS[j], 31Pro_AuthIDS[j-1]);
                
formatex(Pro_Names[j], 31Pro_Names[j-1]);
                
formatex(Pro_Weapons[j], 31Pro_Weapons[j-1])
                
formatex(Pro_Date[j], 31Pro_Date[j-1])
                
formatex(Pro_Country[j], 3Pro_Country[j-1])
                
Pro_Tiempos[j] = Pro_Tiempos[j-1];
            }
            
            
formatex(Pro_AuthIDS[i], 31authid);
            
formatex(Pro_Names[i], 31name);
            
formatex(Pro_Weapons[i], 31nombrearma)
            
formatex(Pro_Date[i], 31horario)
            
formatex(Pro_Country[i], 3pais)
            
Pro_Tiempos[i] = tiempo
            
            
//No olvidarse !! Aca poner para que lo Grabe :D
            
save_pro15()
            
            if( 
Is_in_pro15 )
            {

                if( 
tiempo protiempo )
                {
                    new 
minutosFloat:segundos;
                    
minutos floatround(mejorofloatround_floor)/60;
                    
segundos mejoro - (60*minutos);
                    
kz_reymon_print(0"^x03%s^x04 improved his time %02d:%s%.4f"nameminutossegundos 10 "0" ""segundos);
                    
                    if( (
1) == 1)
                    {
                        
client_cmd(0"spk woop");
                        
kz_reymon_print(0"Congratulations^x03 %s^x04 is the new Leet in Pro15"name);
                    }
                    else
                    {
                        
kz_reymon_print(0"^x03%s^x04 new rank in Pro15 is [%i]"name, (i+1));
                    }
                }    
            }
            else
            {
                if( (
1) == 1)
                {
                    
client_cmd(0"spk woop");
                    
kz_reymon_print(0"Congratulations^x03 %s^x04 is the new Leet in Pro15"name);
                }
                else
                {
                    
kz_reymon_print(0"^x03%s^x04 new rank in Pro15 is [%i]"name, (i+1));
                }
            }
            
            return;
        }
        
        if( 
equali(Pro_Names[i], name) )
        {
            if( 
tiempo protiempo )
            {
                new 
minutosFloat:segundos;
                
minutos floatround(mejorarfloatround_floor)/60
                
segundos mejorar - (60*minutos);
                
kz_reymon_print(0"^x03%s^x04 fail his better time by %02d:%s%.5f"nameminutossegundos 10 "0" ""segundos);
                return;
            }
        }
    }
}

public 
save_pro15()
{
    new 
mapname[33], profile[128]
    
get_mapname(mapname32)
    
formatex(profile127"%s/pro_%s.cfg"KZ_TOP15_DIRmapname)
    
    if( 
file_exists(profile) )
    {
        
delete_file(profile)
    }
   
    new 
Data[256];
    new 
fopen(profile"at")
    
    for(new 
015i++)
    {
        
formatex(Data255"^"%.5f^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"^n"Pro_Tiempos[i], Pro_AuthIDS[i], Pro_Names[i], Pro_Weapons[i], Pro_Date[i], Pro_Country[i])
        
fputs(fData)
    }
    
fclose(f);
}

public 
read_pro15()
{
    new 
mapname[33], profile[128], prodata[256]
    
get_mapname(mapname32)
    
formatex(profile127"%s/pro_%s.cfg"KZ_TOP15_DIRmapname)
    
    new 
fopen(profile"rt" )
    new 
0
    
while( !feof(f) && 16)
    {
        
fgets(fprodata255)
        new 
totime[25]
        
parse(prodatatotime24Pro_AuthIDS[i], 31Pro_Names[i], 31Pro_Weapons[i], 31Pro_Date[i], 31Pro_Country[i], 3)
        
Pro_Tiempos[i] = str_to_float(totime)
        
i++;
    }
    
fclose(f)
}

//==================================================================================================

public set_sql_nub15(idFloat:tiempogochecksweapon
{
    new 
authid[32], name[32], nombrearma[32], ip[32], pais[3], horario[32];
    
get_user_name(idname31);
    
get_user_authid(idauthid31);
    
get_time(" %m/%d/%Y "horario31);
    
get_user_ip(idip31);
    
geoip_code2(ippais);
    
formatex(nombrearma31g_weaponsnames[weapon])
    new 
bool:Is_in_pro15
    Is_in_pro15 
false
    
    
for(new 015i++)
    {
        if( 
equali(Nub_Names[i], name) )
        {
            
Is_in_pro15 true
        
}
    }
    
    for (new 
015i++)
    {
        new 
Float:mejorar tiempo Nub_Tiempos[i];
        new 
Float:mejoro Nub_Tiempos[i] - tiempo;
        new 
Float:protiempo Nub_Tiempos[i]
        
        if( 
tiempo Nub_Tiempos[i])
        {
            new 
pos i
            
            
while( !equal(Nub_Names[pos], name) && pos 15 )
            {
                
pos++;
            }
            
            for (new 
posij--)
            {
                
formatex(Nub_AuthIDS[j], 31Nub_AuthIDS[j-1]);
                
formatex(Nub_Names[j], 31Nub_Names[j-1]);
                
formatex(Nub_Weapons[j], 31Nub_Weapons[j-1])
                
formatex(Nub_Date[j], 31Nub_Date[j-1])
                
formatex(Nub_Country[j], 3Nub_Country[j-1])
                
Nub_Tiempos[j] = Nub_Tiempos[j-1]
                
Nub_GoChecks[j] = Nub_GoChecks[j-1]
            }
            
            
formatex(Nub_AuthIDS[i], 31authid);
            
formatex(Nub_Names[i], 31name);
            
formatex(Nub_Weapons[i], 31nombrearma)
            
formatex(Nub_Date[i], 31horario)
            
formatex(Nub_Country[i], 3pais)
            
Nub_Tiempos[i] = tiempo
            Nub_GoChecks
[i] = gochecks
            
            
//No olvidarse !! Aca poner para que lo Grabe :D
            
save_nub15()
            
            if( 
Is_in_pro15 )
            {

                if( 
tiempo protiempo )
                {
                    new 
minutosFloat:segundos;
                    
minutos floatround(mejorofloatround_floor)/60;
                    
segundos mejoro - (60*minutos);
                    
kz_reymon_print(0"^x03%s^x04 improved his time %02d:%s%.4f"nameminutossegundos 10 "0" ""segundos);
                    
                    if( (
1) == 1)
                    {
                        
client_cmd(0"spk woop");
                        
kz_reymon_print(0"Congratulations^x03 %s^x04 is the new Leet in Nub15"name);
                    }
                    else
                    {
                        
kz_reymon_print(0"^x03%s^x04 new rank in Nub15 is [%i]"name, (i+1));
                    }
                }    
            }
            else
            {
                if( (
1) == 1)
                {
                    
client_cmd(0"spk woop");
                    
kz_reymon_print(0"Congratulations^x03 %s^x04 is the new Leet in Nub15"name);
                }
                else
                {
                    
kz_reymon_print(0"^x03%s^x04 new rank in Nub15 is [%i]"name, (i+1));
                }
            }
            
            return;
        }
        
        if( 
equali(Nub_Names[i], name) )
        {
            if( 
tiempo protiempo )
            {
                new 
minutosFloat:segundos;
                
minutos floatround(mejorarfloatround_floor)/60
                
segundos mejorar - (60*minutos);
                
kz_reymon_print(0"^x03%s^x04 fail his better time by %02d:%s%.5f"nameminutossegundos 10 "0" ""segundos);
                return;
            }
        }
    }
}

public 
save_nub15()
{
    new 
mapname[33], profile[128]
    
get_mapname(mapname32)
    
formatex(profile127"%s/nub_%s.cfg"KZ_TOP15_DIRmapname)
    
    if( 
file_exists(profile) )
    {
        
delete_file(profile)
    }
   
    new 
Data[256];
    new 
fopen(profile"at")
    
    for(new 
015i++)
    {
        
formatex(Data255"^"%.5f^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%i^"^n"Nub_Tiempos[i], Nub_AuthIDS[i], Nub_Names[i], Nub_Weapons[i], Nub_Date[i], Nub_Country[i], Nub_GoChecks[i])
        
fputs(fData)
    }
    
fclose(f);
}

public 
read_nub15()
{
    new 
mapname[33], profile[128], prodata[256]
    
get_mapname(mapname32)
    
formatex(profile127"%s/nub_%s.cfg"KZ_TOP15_DIRmapname)
    
    new 
fopen(profile"rt" )
    new 
0
    
while( !feof(f) && 16)
    {
        
fgets(fprodata255)
        new 
totime[25], checks[5]
        
parse(prodatatotime24Nub_AuthIDS[i], 31Nub_Names[i], 31Nub_Weapons[i], 31Nub_Date[i], 31Nub_Country[i], 3checks4)
        
Nub_Tiempos[i] = str_to_float(totime)
        
Nub_GoChecks[i] = str_to_num(checks)
        
i++;
    }
    
fclose(f)
}


//==================================================================================================

public kz_itemmainmenu(iditempage)
{
    if( 
item == g_item )
        
top15menu(id)
}

public 
top15menu(id)
{
    new 
menu menu_create("\r[AG] \yTop15 \w""top15funccions");
    
menu_additem(menu"\wPro15""1"0);
    
menu_additem(menu"\wNub15""2"0);
    
    
menu_display(idmenu0);
    
    return 
PLUGIN_HANDLED;
}

public 
top15funccions(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64]
    new 
iaccesscallback;
    
    
menu_item_getinfo(menuitemiaccessdata,5iName63callback);
    
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            
showpro15(id);
        }
        case 
2:
        {
            
shownub15(id);
        }
    }
    
    return 
PLUGIN_HANDLED;
}

public 
showpro15(id)
{        
    new 
buffer[2048], name[32]

    new 
len formatex(buffer2047"<body bgcolor=#3A3C3E><table width=100%% cellpadding=2 cellspacing=0 border=0>")
    
len += formatex(buffer[len], 2047-len"<tr  align=center bgcolor=#1F5A86><th width=5%%> # <th width=30%% align=left> Player <th  width=25%%> Time <th width=20%%> Weapon ")
        
    for (new 
015i++) 
    {    
        
name Pro_Names[i]
        
        if( 
Pro_Tiempos[i] > 9999999.0 
        {
            
len += formatex(buffer[len], 2047-len"<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s", ((i%2)==0) ? "" " bgcolor=#5A5C5F", (i+1), """""")
        }
        else
        {
            new 
minutosFloat:segundos
            minutos 
floatround(Pro_Tiempos[i], floatround_floor)/60
            segundos 
Pro_Tiempos[i] - (60*minutos)
            
            while (
containi(name"<") != -1)
                
replace(name63"<""&lt;")
            while (
containi(name">") != -1)
                
replace(name63">""&gt;")
            
len += formatex(buffer[len], 2047-len"<tr align=center%s><td> %d <td align=left> %s <td> %02d:%s%.5f <td> %s", ((i%2)==0) ? "" " bgcolor=#5A5C5F", (i+1), Pro_Names[i], minutossegundos 10 "0" ""segundosPro_Weapons[i])
        }
    }
    
    
len += formatex(buffer[len], 2047-len"</table></body>")
        
    
show_motd(idbuffer"Pro15 Surfers")

    return 
PLUGIN_HANDLED
}

public 
shownub15(id)
{
    new 
buffer[2048], name[32]

    new 
len formatex(buffer2047"<body bgcolor=#3A3C3E><table width=100%% cellpadding=2 cellspacing=0 border=0>")
    
len += formatex(buffer[len], 2047-len"<tr  align=center bgcolor=#1F5A86><th width=5%%> # <th width=30%% align=left> Player <th  width=25%%> Time <th width=20%%> GoChecks <th width=20%%> Weapon ")
        
    for (new 
015i++) 
    {        
        if( 
Nub_Tiempos[i] > 9999999.0 
        {
            
len += formatex(buffer[len], 2047-len"<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" " bgcolor=#5A5C5F", (i+1), """""""")
        }
        else 
        {
            
name Nub_Names[i]
            new 
minutosFloat:segundos
            minutos 
floatround(Nub_Tiempos[i], floatround_floor)/60
            segundos 
Nub_Tiempos[i] - (60*minutos)
            
            while (
containi(name"<") != -1)
                
replace(name63"<""&lt;")
            while (
containi(name">") != -1)
                
replace(name63">""&gt;")
            
len += formatex(buffer[len], 2047-len"<tr align=center%s><td> %d <td align=left> %s <td> %02d:%s%.5f <td> %d <td> %s", ((i%2)==0) ? "" " bgcolor=#5A5C5F", (i+1), Nub_Names[i], minutossegundos 10 "0" ""segundosNub_GoChecks[i], Nub_Weapons[i])
        }
    }
    
    
len += formatex(buffer[len], 2047-len"</table></body>")
        
    
show_motd(idbuffer"Nub15 Surfers")

    return 
PLUGIN_HANDLED
}

//==================================================================================================

stock kz_reymon_print(id, const msg[], {Float,Sql,Result,_}:...)
{
    new 
message[160], final[192];
    final[
0] = 0x04;
    
vformat(message159msg3);
    
formatex(final[1], 188"[AG] %s"message);
    
    if(
id)
    {
        
kz_print_config(id, final);
    } 
    else 
    {
        for( new 
1<= g_maxplayersi++)
            if( 
is_user_connected(i) )
                
kz_print_config(i, final)
    }
}

stock kz_print_config(id, const msg[])
{
    
message_begin(MSG_ONE_UNRELIABLEg_saytext_id);
    
write_byte(id);
    
write_string(msg);
    
message_end();
}

stock kz_register_saycmd(const saycommand[], const function[], flags, const info[])
{
    new 
temp[64];
    
formatex(temp63"say /%s"saycommand);
    
register_clcmd(temp, function, flagsinfo);
    
formatex(temp63"say .%s"saycommand);
    
register_clcmd(temp, function, flagsinfo);
    
formatex(temp63"say_team /%s"saycommand);
    
register_clcmd(temp, function, flagsinfo);
    
formatex(temp63".%s"saycommand);
    
register_clcmd(temp, function, flagsinfo);
    
formatex(temp63"/%s"saycommand);
    
register_clcmd(temp, function, flagsinfo);



Black Rose 09-19-2013 17:44

Re: TimerFinish Save [Help]
 
Sorry. Can't edit plugins written in spanish because I don't understand the variable names.

Cigojlo 09-19-2013 19:39

Re: TimerFinish Save [Help]
 
use pro kreedz and uqljstats and uotamaticly will be saved if they beat map with timer

Baws 09-19-2013 23:09

Re: TimerFinish Save [Help]
 
Quote:

Originally Posted by Cigojlo (Post 2037659)
use pro kreedz and uqljstats and uotamaticly will be saved if they beat map with timer

I can'tor i don't want. kzarg got custom starts like i can put starts if the map don't have a start button.




@ Black Rose, here man i went to google and translated you the words :] should be good i think? Please i need this :D!

Code:

tiempos, nombrearma, pais, horario, mejorar, mejoro, protiempo, segundos,
  |      |            |      |      |      |        |        |
times, weaponname, country, time, enhance, improve, protime, seconds,

thanks bro

Cigojlo 09-20-2013 11:00

Re: TimerFinish Save [Help]
 
use timer plugin is awesome i,m also using

Black Rose 09-20-2013 12:26

Re: TimerFinish Save [Help]
 
I think this will work. Don't know kz, so you'll have to try it yourself.
Code:
#include <amxmodx> #include <geoip> #include <kzarg> #include <fakemeta> #define HATMODEL "models/hat/crown.mdl" #define TOP_VERSION "1.0" new const KZ_TOP15_DIR[] = "addons/amxmodx/configs/kz/top15" new g_saytext new g_maxplayers new g_item new g_hat new g_hatowner new g_InfoTarget new Float:Pro_times[24] new Pro_AuthIDS[24][32] new Pro_Names[24][32] new Pro_Weapons[24][32] new Pro_Date[24][32] new Pro_Country[24][3] new Float:Nub_times[24] new Nub_AuthIDS[24][32] new Nub_Names[24][32] new Nub_Weapons[24][32] new Nub_Date[24][32] new Nub_Country[24][3] new Nub_GoChecks[24] //================================================================================================== new const g_weaponsnames[][] = {     "", // NULL     "p228", "shield", "scout", "hegrenade", "xm1014", "c4",     "mac10", "aug", "smokegrenade", "elite", "fiveseven",     "ump45", "sg550", "galil", "famas", "usp", "glock18",     "awp", "mp5navy", "m249", "m3", "m4a1", "tmp", "g3sg1",     "flashbang", "deagle", "sg552", "ak47", "knife", "p90" }; //================================================================================================== public plugin_init() {     register_plugin("kzarg", TOP_VERSION, "kzarg");         kz_register_saycmd("top15", "top15menu", -1, "")     kz_register_saycmd("pro15", "showpro15", -1, "")     kz_register_saycmd("nub15", "shownub15", -1, "")         g_item = kz_mainmenu_item_register("Top15", "")         g_saytext = get_user_msgid("SayText")     g_maxplayers = get_maxplayers()         g_InfoTarget = engfunc(EngFunc_AllocString, "info_target") } //================================================================================================== public plugin_precache() {     if( !dir_exists(KZ_TOP15_DIR) )     mkdir(KZ_TOP15_DIR);     precache_model(HATMODEL); } public plugin_cfg() {     for (new i = 0 ; i < 15; ++i)     {         Pro_times[i] = 999999999.00000;         Nub_times[i] = 999999999.00000;     }     read_pro15()     read_nub15() } public client_disconnect(id) {     if ( id == g_hatowner )         RemoveHat(); } //================================================================================================== public kz_finishclimb(id, Float:time2, checkpoints, gochecks, weapon) {     if( gochecks == 0 && (weapon == CSW_USP || weapon == CSW_KNIFE) )     {         set_sql_pro15(id, time2, weapon)     }     else if( weapon == CSW_USP || weapon == CSW_KNIFE || weapon == CSW_SCOUT )     {         set_sql_nub15(id, time2, gochecks, weapon)     }     else     {         //Others Weapons Tops     } } public set_sql_pro15(id, Float:time2, weapon) {     new authid[32], name[32], weaponname[32], ip[32], country[3], strtime[32];     get_user_name(id, name, 31);     get_user_authid(id, authid, 31);     get_time(" %m/%d/%Y ", strtime, 31);     get_user_ip(id, ip, 31);     geoip_code2(ip, country);     formatex(weaponname, 31, g_weaponsnames[weapon])     new bool:Is_in_pro15     Is_in_pro15 = false         for(new i = 0; i < 15; i++)     {         if( equali(Pro_AuthIDS[i], authid) )         {             Is_in_pro15 = true         }     }         for (new i = 0; i < 15; i++)     {         new Float:enhance = time2 - Pro_times[i];         new Float:improve = Pro_times[i] - time2;         new Float:protime2 = Pro_times[i]                 if( time2 < Pro_times[i])         {             new pos = i                         while( !equal(Pro_AuthIDS[pos], authid) && pos < 15 )             {                 pos++;             }                         for (new j = pos; j > i; j--)             {                 formatex(Pro_AuthIDS[j], 31, Pro_AuthIDS[j-1]);                 formatex(Pro_Names[j], 31, Pro_Names[j-1]);                 formatex(Pro_Weapons[j], 31, Pro_Weapons[j-1])                 formatex(Pro_Date[j], 31, Pro_Date[j-1])                 formatex(Pro_Country[j], 3, Pro_Country[j-1])                 Pro_times[j] = Pro_times[j-1];             }                         formatex(Pro_AuthIDS[i], 31, authid);             formatex(Pro_Names[i], 31, name);             formatex(Pro_Weapons[i], 31, weaponname)             formatex(Pro_Date[i], 31, strtime)             formatex(Pro_Country[i], 3, country)             Pro_times[i] = time2                         //No olvidarse !! Aca poner para que lo Grabe :D             save_pro15()                         if( Is_in_pro15 )             {                 if( time2 < protime2 )                 {                     new minutes, Float:seconds;                     minutes = floatround(improve, floatround_floor)/60;                     seconds = improve - (60*minutes);                     kz_reymon_print(0, "^x03%s^x04 improved his time %02d:%s%.4f", name, minutes, seconds < 10 ? "0" : "", seconds);                                         if( (i + 1) == 1)                     {                         client_cmd(0, "spk woop");                         kz_reymon_print(0, "Congratulations^x03 %s^x04 is the new Leet in Pro15", name);                         RemoveHat();                         AddHat(id);                     }                     else                     {                         kz_reymon_print(0, "^x03%s^x04 new rank in Pro15 is [%i]", name, (i+1));                     }                 }             }             else             {                 if( (i + 1) == 1)                 {                     client_cmd(0, "spk woop");                     kz_reymon_print(0, "Congratulations^x03 %s^x04 is the new Leet in Pro15", name);                     RemoveHat();                     AddHat(id);                 }                 else                 {                     kz_reymon_print(0, "^x03%s^x04 new rank in Pro15 is [%i]", name, (i+1));                 }             }                         return;         }                 if( equali(Pro_AuthIDS[i], authid) )         {             if( time2 > protime2 )             {                 new minutes, Float:seconds;                 minutes = floatround(enhance, floatround_floor)/60;                 seconds = enhance - (60*minutes);                 kz_reymon_print(0, "^x03%s^x04 fail his better time by %02d:%s%.5f", name, minutes, seconds < 10 ? "0" : "", seconds);                 return;             }         }     } } public save_pro15() {     new mapname[33], profile[128]     get_mapname(mapname, 32)     formatex(profile, 127, "%s/pro_%s.cfg", KZ_TOP15_DIR, mapname)         if( file_exists(profile) )     {         delete_file(profile)     }     new Data[256];     new f = fopen(profile, "at")         for(new i = 0; i < 15; i++)     {         formatex(Data, 255, "^"%.5f^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"^n", Pro_times[i], Pro_AuthIDS[i], Pro_Names[i], Pro_Weapons[i], Pro_Date[i], Pro_Country[i])         fputs(f, Data)     }     fclose(f); } public read_pro15() {     new mapname[33], profile[128], prodata[256]     get_mapname(mapname, 32)     formatex(profile, 127, "%s/pro_%s.cfg", KZ_TOP15_DIR, mapname)         new f = fopen(profile, "rt" )     new i = 0     while( !feof(f) && i < 16)     {         fgets(f, prodata, 255)         new totime[25]         parse(prodata, totime, 24, Pro_AuthIDS[i], 31, Pro_Names[i], 31, Pro_Weapons[i], 31, Pro_Date[i], 31, Pro_Country[i], 3)         Pro_times[i] = str_to_float(totime)         i++;     }     fclose(f) } //================================================================================================== public set_sql_nub15(id, Float:time2, gochecks, weapon) {     new authid[32], name[32], weaponname[32], ip[32], country[3], strtime[32];     get_user_name(id, name, 31);     get_user_authid(id, authid, 31);     get_time(" %m/%d/%Y ", strtime, 31);     get_user_ip(id, ip, 31);     geoip_code2(ip, country);     formatex(weaponname, 31, g_weaponsnames[weapon])     new bool:Is_in_pro15     Is_in_pro15 = false         for(new i = 0; i < 15; i++)     {         if( equali(Nub_AuthIDS[i], authid) )         {             Is_in_pro15 = true         }     }         for (new i = 0; i < 15; i++)     {         new Float:enhance = time2 - Nub_times[i];         new Float:improve = Nub_times[i] - time2;         new Float:protime2 = Nub_times[i]                 if( time2 < Nub_times[i])         {             new pos = i                         while( !equal(Nub_AuthIDS[pos], authid) && pos < 15 )             {                 pos++;             }                         for (new j = pos; j > i; j--)             {                 formatex(Nub_AuthIDS[j], 31, Nub_AuthIDS[j-1]);                 formatex(Nub_Names[j], 31, Nub_Names[j-1]);                 formatex(Nub_Weapons[j], 31, Nub_Weapons[j-1])                 formatex(Nub_Date[j], 31, Nub_Date[j-1])                 formatex(Nub_Country[j], 3, Nub_Country[j-1])                 Nub_times[j] = Nub_times[j-1]                 Nub_GoChecks[j] = Nub_GoChecks[j-1]             }                         formatex(Nub_AuthIDS[i], 31, authid);             formatex(Nub_Names[i], 31, name);             formatex(Nub_Weapons[i], 31, weaponname)             formatex(Nub_Date[i], 31, strtime)             formatex(Nub_Country[i], 3, country)             Nub_times[i] = time2             Nub_GoChecks[i] = gochecks                         //No olvidarse !! Aca poner para que lo Grabe :D             save_nub15()                         if( Is_in_pro15 )             {                 if( time2 < protime2 )                 {                     new minutes, Float:seconds;                     minutes = floatround(improve, floatround_floor)/60;                     seconds = improve - (60*minutes);                     kz_reymon_print(0, "^x03%s^x04 improved his time %02d:%s%.4f", name, minutes, seconds < 10 ? "0" : "", seconds);                                         if( (i + 1) == 1)                     {                         client_cmd(0, "spk woop");                         kz_reymon_print(0, "Congratulations^x03 %s^x04 is the new Leet in Nub15", name);                     }                     else                     {                         kz_reymon_print(0, "^x03%s^x04 new rank in Nub15 is [%i]", name, (i+1));                     }                 }             }             else             {                 if( (i + 1) == 1)                 {                     client_cmd(0, "spk woop");                     kz_reymon_print(0, "Congratulations^x03 %s^x04 is the new Leet in Nub15", name);                 }                 else                 {                     kz_reymon_print(0, "^x03%s^x04 new rank in Nub15 is [%i]", name, (i+1));                 }             }                         return;         }                 if( equali(Nub_AuthIDS[i], authid) )         {             if( time2 > protime2 )             {                 new minutes, Float:seconds;                 minutes = floatround(enhance, floatround_floor)/60;                 seconds = enhance - (60*minutes);                 kz_reymon_print(0, "^x03%s^x04 fail his better time by %02d:%s%.5f", name, minutes, seconds < 10 ? "0" : "", seconds);                 return;             }         }     } } public save_nub15() {     new mapname[33], profile[128]     get_mapname(mapname, 32)     formatex(profile, 127, "%s/nub_%s.cfg", KZ_TOP15_DIR, mapname)         if( file_exists(profile) )     {         delete_file(profile)     }     new Data[256];     new f = fopen(profile, "at")         for(new i = 0; i < 15; i++)     {         formatex(Data, 255, "^"%.5f^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%i^"^n", Nub_times[i], Nub_AuthIDS[i], Nub_Names[i], Nub_Weapons[i], Nub_Date[i], Nub_Country[i], Nub_GoChecks[i])         fputs(f, Data)     }     fclose(f); } public read_nub15() {     new mapname[33], profile[128], prodata[256]     get_mapname(mapname, 32)     formatex(profile, 127, "%s/nub_%s.cfg", KZ_TOP15_DIR, mapname)         new f = fopen(profile, "rt" )     new i = 0     while( !feof(f) && i < 16)     {         fgets(f, prodata, 255)         new totime[25], checks[5]         parse(prodata, totime, 24, Nub_AuthIDS[i], 31, Nub_Names[i], 31, Nub_Weapons[i], 31, Nub_Date[i], 31, Nub_Country[i], 3, checks, 4)         Nub_times[i] = str_to_float(totime)         Nub_GoChecks[i] = str_to_num(checks)         i++;     }     fclose(f) } //================================================================================================== public kz_itemmainmenu(id, item, page) {     if( item == g_item )     top15menu(id) } public top15menu(id) {     new menu = menu_create("\r[AG] \yTop15 \w", "top15funccions");     menu_additem(menu, "\wPro15", "1", 0);     menu_additem(menu, "\wNub15", "2", 0);         menu_display(id, menu, 0);         return PLUGIN_HANDLED; } public top15funccions(id, menu, item) {     if(item == MENU_EXIT)     {         return PLUGIN_HANDLED;     }         new data[6], iName[64]     new iaccess, callback;         menu_item_getinfo(menu, item, iaccess, data,5, iName, 63, callback);         new key = str_to_num(data);         switch(key)     {     case 1:         {             showpro15(id);         }     case 2:         {             shownub15(id);         }     }         return PLUGIN_HANDLED; } public showpro15(id) {     new buffer[2048], name[32]     new len = formatex(buffer, 2047, "<body bgcolor=#3A3C3E><table width=100%% cellpadding=2 cellspacing=0 border=0>")     len += formatex(buffer[len], 2047-len, "<tr  align=center bgcolor=#1F5A86><th width=5%%> # <th width=30%% align=left> Player <th  width=25%%> Time <th width=20%%> Weapon ")         for (new i = 0; i < 15; i++)     {         name = Pro_Names[i]                 if( Pro_times[i] > 9999999.0 )         {             len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#5A5C5F", (i+1), "", "", "")         }         else         {             new minutes, Float:seconds             minutes = floatround(Pro_times[i], floatround_floor)/60             seconds = Pro_times[i] - (60*minutes)                         while (containi(name, "<") != -1)             replace(name, 63, "<", "&lt;")             while (containi(name, ">") != -1)             replace(name, 63, ">", "&gt;")             len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %02d:%s%.5f <td> %s", ((i%2)==0) ? "" : " bgcolor=#5A5C5F", (i+1), Pro_Names[i], minutes, seconds < 10 ? "0" : "", seconds, Pro_Weapons[i])         }     }         len += formatex(buffer[len], 2047-len, "</table></body>")         show_motd(id, buffer, "Pro15 Surfers")     return PLUGIN_HANDLED } public shownub15(id) {     new buffer[2048], name[32]     new len = formatex(buffer, 2047, "<body bgcolor=#3A3C3E><table width=100%% cellpadding=2 cellspacing=0 border=0>")     len += formatex(buffer[len], 2047-len, "<tr  align=center bgcolor=#1F5A86><th width=5%%> # <th width=30%% align=left> Player <th  width=25%%> Time <th width=20%%> GoChecks <th width=20%%> Weapon ")         for (new i = 0; i < 15; i++)     {         if( Nub_times[i] > 9999999.0 )         {             len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %s <td> %s <td> %s", ((i%2)==0) ? "" : " bgcolor=#5A5C5F", (i+1), "", "", "", "")         }         else         {             name = Nub_Names[i]             new minutes, Float:seconds             minutes = floatround(Nub_times[i], floatround_floor)/60             seconds = Nub_times[i] - (60*minutes)                         while (containi(name, "<") != -1)             replace(name, 63, "<", "&lt;")             while (containi(name, ">") != -1)             replace(name, 63, ">", "&gt;")             len += formatex(buffer[len], 2047-len, "<tr align=center%s><td> %d <td align=left> %s <td> %02d:%s%.5f <td> %d <td> %s", ((i%2)==0) ? "" : " bgcolor=#5A5C5F", (i+1), Nub_Names[i], minutes, seconds < 10 ? "0" : "", seconds, Nub_GoChecks[i], Nub_Weapons[i])         }     }         len += formatex(buffer[len], 2047-len, "</table></body>")         show_motd(id, buffer, "Nub15 Surfers")     return PLUGIN_HANDLED } //================================================================================================== stock kz_reymon_print(id, const msg[], {Float,Sql,Result,_}:...) {     new message[160], final[192];     final[0] = 0x04;     vformat(message, 159, msg, 3);     formatex(final[1], 188, "[AG] %s", message);         if(id)     {         kz_print_config(id, final);     }     else     {         for( new i = 1; i <= g_maxplayers; i++)         if( is_user_connected(i) )         kz_print_config(i, final)     } } stock kz_print_config(id, const msg[]) {     message_begin(MSG_ONE_UNRELIABLE, g_saytext, _, id);     write_byte(id);     write_string(msg);     message_end(); } stock kz_register_saycmd(const saycommand[], const function[], flags, const info[]) {     new temp[64];     formatex(temp, 63, "say /%s", saycommand);     register_clcmd(temp, function, flags, info);     formatex(temp, 63, "say .%s", saycommand);     register_clcmd(temp, function, flags, info);     formatex(temp, 63, "say_team /%s", saycommand);     register_clcmd(temp, function, flags, info);     formatex(temp, 63, ".%s", saycommand);     register_clcmd(temp, function, flags, info);     formatex(temp, 63, "/%s", saycommand);     register_clcmd(temp, function, flags, info); } AddHat(id) {     g_hat = engfunc(EngFunc_CreateNamedEntity, g_InfoTarget);         if ( pev_valid(g_hat) ) {         engfunc(EngFunc_SetModel, g_hat, HATMODEL);         set_pev(g_hat, pev_movetype, MOVETYPE_FOLLOW);         set_pev(g_hat, pev_aiment, id);         set_pev(g_hat, pev_owner, id);         g_hatowner = id;     } } RemoveHat() {     set_pev(g_hat, pev_flags, FL_KILLME);     dllfunc(DLLFunc_Think, g_hat);     g_hatowner = 0; }

Baws 09-20-2013 16:54

Re: TimerFinish Save [Help]
 
Thanks man but theres one thing. It does save that i already ran but if i beat my last time, my other name comes above me.

Black Rose 09-20-2013 17:43

Re: TimerFinish Save [Help]
 
Sorry, updated line 124.


All times are GMT -4. The time now is 19:14.

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