I need help with top10

Started by Free Style
21/04/2008 08:01
Page 1 of 1
Free Style 21/04/2008 08:01

Hello to all

Well, my problem is that when the users who have his name between these symbols <> the name disappears and I do not find solution.

Here I leave my plugin them

[blockquote]//=================================================================================================
// Top10
//=================================================================================================

getTopTenPlace(id) {

new currentMap[32];
get_mapname(currentMap, 32);

new topTenVault[64];
format(topTenVault, 64, "pk_%s", currentMap);

new kzTime;
kzTime = get_systime() - timer_time[id-1];

new vault = nvault_open(topTenVault);
new vaultKey[8];
new vaultReturn[128];
new arg1[32], arg2[8];

new ret;

if(vault != INVALID_HANDLE) {

for(new i = 1; i <= 10; i++) {

format(vaultKey, 8, "%d", i);

nvault_get(vault, vaultKey, vaultReturn, 128);

if(parse(vaultReturn, arg1, 32, arg2, 8) != 0) {

if(kzTime < str_to_num(arg2)) {

ret = i;
break;

} else {

ret = 0;

}

} else {

ret = i;
break;

}

}

}

nvault_close(vault);

return ret;
}

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

isPlayerInTopTen(id) {

new userName[32];
get_user_name(id, userName, 32);

new currentMap[32];
get_mapname(currentMap, 32);

new topTenVault[64];
format(topTenVault, 64, "pk_%s", currentMap);

new vault = nvault_open(topTenVault);
new vaultKey[8];
new vaultReturn[128];
new arg1[32], arg2[8];

new ret;

if(vault != INVALID_HANDLE) {

for(new i = 1; i <= 10; i++) {

format(vaultKey, 8, "%d", i);

nvault_get(vault, vaultKey, vaultReturn, 128);

if(parse(vaultReturn, arg1, 32, arg2, 8) != 0 && equal(userName, arg1)) {

ret = i;
break;

} else {

ret = 0;

}

}

}

nvault_close(vault);

return ret;
}

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

showTime(id, newPlace) {

new userName[32];
get_user_name(id, userName, 32);

new kzTime;
kzTime = get_systime() - timer_time[id-1];

new minutes, seconds

if((kzTime / 60.0) >= 1) {

minutes = floatround(kzTime / 60.0,floatround_floor);
kzTime -= (floatround(kzTime/ 60.0,floatround_floor) * 60);
seconds = kzTime;

} else {

minutes = 0;
seconds = kzTime;

}

set_hudmessage(255, 255, 255, -1.0, -1.0);

if(newPlace == 1) {

show_hudmessage(0, "%s termino el mapa en %d min %d segs y establecio un nuevo record", userName, minutes, seconds);

} else if(newPlace == 0) {

show_hudmessage(0, "%s termino el mapa en %d min %d segs", userName, minutes, seconds);

} else {

show_hudmessage(0, "%s termino el mapa en %d min %d segs y establecio un nuevo tiempo Top10", userName, minutes, seconds);

}

}

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

public topten_update(id) {

new newPlace = getTopTenPlace(id);

new oldPlace = isPlayerInTopTen(id);

new userName[32];
get_user_name(id, userName, 32);

new currentMap[32];
get_mapname(currentMap, 32);

new kzTime;
kzTime = get_systime() - timer_time[id-1];

new vaultEntry[128];
format(vaultEntry, 128, "^"%s^" ^"%d^" ^"%d^"", userName, kzTime, checkpointnum[id-1]);

new topTenVault[64];
format(topTenVault, 64, "pk_%s", currentMap);

new vault = nvault_open(topTenVault);

if(oldPlace > 0) {

if(newPlace > 0 ) {

new key[8];

if(newPlace < oldPlace) {

format(key, 8, "%d", oldPlace);
nvault_remove(vault, key);

for(new i = oldPlace; i > 10; i++) {

new temp[128], tempKey[8]
format(tempKey,8,"%d",i+1)
nvault_get(vault,tempKey,temp,128)

if(!equal(temp,"")) {
format(tempKey,8,"%d",i)
nvault_pset(vault,tempKey,temp)
}

}

for(new i = 10; i > newPlace; i--) {

new temp[128], tempKey[8]
format(tempKey,8,"%d",i-1)
nvault_get(vault,tempKey,temp,128)

if(!equal(temp,"")) {
format(tempKey,8,"%d",i)
nvault_pset(vault,tempKey,temp)
}

}

format(key, 8, "%d", newPlace);
nvault_pset(vault, key, vaultEntry);

} else if(newPlace == oldPlace) {

format(key, 8, "%d", oldPlace);
nvault_remove(vault, key);
format(key, 8, "%d", newPlace);
nvault_pset(vault, key, vaultEntry);

}

showTime(id, newPlace);


}

} else {

if(newPlace > 0) {

for(new i = 10; i > newPlace; i--) {

new temp[128], tempKey[8]
format(tempKey,8,"%d",i-1)
nvault_get(vault,tempKey,temp,128)

if(!equal(temp,"")) {
format(tempKey,8,"%d",i)
nvault_pset(vault,tempKey,temp)
}

}

new key[8];

format(key, 8, "%d", newPlace);
nvault_pset(vault, key, vaultEntry);

showTime(id, newPlace);

}

}

nvault_close(vault);

}


public topten_show(id) {
new motd[2048]
new szvault[64], szmap[32]
get_mapname(szmap,32)
format(szvault,64,"pk_%s",szmap)

new vault = nvault_open(szvault)
if(vault != -1) {
add(motd,2048,"")
add(motd,2048,"

























#NombreTiempoCheckpoints
")
add(motd,2048,szkey)
add(motd,2048,"
")
add(motd,2048,arg1)
add(motd,2048,"
")
add(motd,2048,sztime)
add(motd,2048,"
")
add(motd,2048,arg3)
add(motd,2048,"
") add(motd,2048,"") new szkey[8] for(new i=1;i<=10;i++) { new szreturn[128] format(szkey,8,"%d",i) nvault_get(vault,szkey,szreturn,128) new arg1[32], arg2[8], arg3[8] if(parse(szreturn,arg1,32,arg2,8,arg3,8) != 0) { new sztime[32] new imin, kreedztime = str_to_num(arg2) if((kreedztime / 60.0) >= 1) { imin = floatround(kreedztime / 60.0,floatround_floor) kreedztime -= (floatround(kreedztime / 60.0,floatround_floor) * 60) } format(sztime,32,"%d minutos y %d segundos",imin,kreedztime) add(motd,2048,"") } } nvault_close(vault) add(motd,2048,"")
show_motd(id,motd,"Dream-Team Top10")
}
}[/blockquote]

Fatalis21/04/2008 11:03(edited 21/04/2008 11:06)

new userName[125];
get_user_name(id, userName, 31);
replace_all(userName, 124, "<", "<");
replace_all(userName, 124, ">", ">");

or

replace_all(userName, 31, "<", "(");
replace_all(userName, 31, ">", ")");

Free Style 21/04/2008 22:46

Many thank you very much fatalis
Now if inconvenience is not great, me ayudarias with pro15 that not that lacking him?

#include
#include
#include
#include
#include

#define TOP_MAX_TIME 86400
#define PRO_MAX_TIME 86400
#define ACCESS_CLIMBER -1

new top15_authid[15][33]; // the 15 authids of the top 15 climbers
new top15_names[15][33]; // the 15 names of the top 15 climbers
new top15_times[15]; // the 15 times of the top 15 climbers
new top15_cps[15][33];
new top15_gcs[15][33];

new pro15_authid[15][33]; // the 15 authids of the top 15 climbers
new pro15_names[15][33]; // the 15 names of the top 15 climbers
new pro15_times[15]; // the 15 times of the top 15 climbers

new bool:used_unwanted[33];
new bool:used_cp[33];
new bool:used_gc[33];

new bool:started[33];

public plugin_init() {
register_plugin( "KzTop15 & KzPro15", "1.5", "J. Djinn & Isobold" );

register_clcmd( "say /top15", "show_top15_climbers", ADMIN_ALL, " - displays the top 15 climbers" );
register_clcmd( "say /top10", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "say /top", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "say .top15", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "say .top10", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "say .top", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "say_team /top15", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "say_team /top10", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "say_team /top", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "say_team .top15", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "say_team .top10", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "say_team .top", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "/top15", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "/top10", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( "/top", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( ".top15", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( ".top10", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );
register_clcmd( ".top", "show_top15_climbers", ACCESS_CLIMBER, " - displays the top 15 climbers" );

register_clcmd( "say /pro15", "show_pro15_climbers", ADMIN_ALL, " - displays the pro 15 climbers" );
register_clcmd( "say /pro10", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "say /pro", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "say .pro15", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "say .pro10", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "say .pro", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "say_team /pro15", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "say_team /pro10", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "say_team /pro", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "say_team .pro15", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "say_team .pro10", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "say_team .pro", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "/pro15", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "/pro10", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( "/pro", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( ".pro15", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( ".pro10", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );
register_clcmd( ".pro", "show_pro15_climbers", ACCESS_CLIMBER, " - displays the pro 15 climbers" );

register_clcmd( "say /cp", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "say /check", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "say /checkpoint", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "say .cp", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "say .check", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "say .checkpoint", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "say_team /cp", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "say_team /check", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "say_team /checkpoint", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "say_team .cp", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "say_team .check", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "say_team .checkpoint", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "/cp", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "/check", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( "/checkpoint", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( ".cp", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( ".check", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );
register_clcmd( ".checkpoint", "checkpoint", ACCESS_CLIMBER, " - sets checkpoint" );

register_clcmd( "say /tele", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say /tp", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say /gocheck", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say /gc", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say .tele", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say .tp", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say .gocheck", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say .gc", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say_team /tele", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say_team /tp", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say_team /gocheck", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say_team /gc", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say_team .tele", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say_team .tp", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say_team .gocheck", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "say_team .gc", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "/tele", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "/tp", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "/gocheck", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( "/gc", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( ".tele", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( ".tp", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( ".gocheck", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );
register_clcmd( ".gc", "gocheck", ACCESS_CLIMBER, " - used checkpoint" );

register_clcmd( "say /boost", "used_unwanted_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this player in this climb" );
register_clcmd( "say /toggle_boost", "used_unwanted_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this player in this climb" );
register_clcmd( "say .boost", "used_unwanted_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this player in this climb" );
register_clcmd( "say .toggle_boost", "used_unwanted_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this player in this climb" );
register_clcmd( "say_team /boost", "used_unwanted_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this player in this climb" );
register_clcmd( "say_team /toggle_boost", "used_unwanted_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this player in this climb" );
register_clcmd( "say_team .boost", "used_unwanted_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this player in this climb" );
register_clcmd( "say_team .toggle_boost", "used_unwanted_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this player in this climb" );
register_clcmd( "/boost", "used_unwanted_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this player in this climb" );
register_clcmd( "/toggle_boost", "used_unwanted_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this player in this climb" );
register_clcmd( ".boost", "used_unwanted_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this player in this climb" );
register_clcmd( ".toggle_boost", "used_unwanted_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this player in this climb" );

register_clcmd( "+hook", "used_hook_cmd", ACCESS_CLIMBER, " - disable top/pro 15 for this admin in this climb" );

register_cvar( "amx_climbtimer_path", "addons/amxmodx/climbtimer" );
register_cvar( "kz_tops_enabled", "1" );
register_cvar( "kz_rank_by_authid", "1" );

read_top15();
read_pro15();
}

public read_top15() {
for( new i = 0 ; i < 15; ++i) {
top15_names = "";
top15_times = TOP_MAX_TIME;
top15_authid = "";
}

new pathname[128];
get_cvar_string("amx_climbtimer_path",pathname,127);

new mapname[64];
get_mapname(mapname,63);

new filename[128];
format(filename, 127, "%s/%s-top15.txt", pathname, mapname);

if( file_exists(filename) ) {
new number[192], line = 0, txtsize = 0;
for( new i = 0 ; i < 15; i++ ) {
if( (line=read_file(filename,line,top15_authid,32,txtsize))!=0 ) {
if( (line=read_file(filename,line,top15_names,32,txtsize))!=0 ) {
if( (line=read_file(filename,line,top15_cps,33,txtsize))!=0 ) {
if( (line=read_file(filename,line,top15_gcs,33,txtsize))!=0 ) {
if( (line=read_file(filename,line,number,191,txtsize))!=0 ) {
top15_times = str_to_num( number );
}
}
}
}
}
else
return PLUGIN_HANDLED;
}
}
return PLUGIN_HANDLED;
}

public read_pro15() {
for( new i = 0 ; i < 15; ++i) {
pro15_names = "";
pro15_times = PRO_MAX_TIME;
pro15_authid = "";
}

new pathname[128];
get_cvar_string("amx_climbtimer_path",pathname,127);

new mapname[64];
get_mapname(mapname,63);

new filename[128];
format(filename, 127, "%s/%s-pro15.txt", pathname, mapname);

if( file_exists(filename) ) {
new number[192], line = 0, txtsize = 0;
for( new i = 0 ; i < 15; i++ ) {
if( (line=read_file(filename,line,pro15_authid,32,txtsize))!=0 ) {
if( (line=read_file(filename,line,pro15_names,32,txtsize))!=0 ) {
if( (line=read_file(filename,line,number,191,txtsize))!=0 ) {
pro15_times = str_to_num( number );
}
}
}
else
return PLUGIN_HANDLED;
}
}
return PLUGIN_HANDLED;
}

public client_putinserver(id) {
started[id]=false;
used_unwanted[id]=false;
used_gc[id]=false;
used_cp[id]=false;
}

public client_disconnect(id) {
started[id]=false;
used_unwanted[id]=false;
used_gc[id]=false;
used_cp[id]=false;
}

public checkpoint(id) {
if(get_cvar_num("kz_enabled"))
{
new cp_continue = 1;
if(is_user_alive(id) && used_cp[id] == false)
{
if(IsPlayerPause(id) == 1)
{
cp_continue = 0;
}
if(get_cvar_num("kz_cp_price") && started[id] == true)
{
new money = cs_get_user_money(id);

if (!(get_cvar_num("kz_cp_price") <= money))
{
cp_continue = 0;
}
}
if(pev(id, pev_flags) & FL_ONGROUND) {
static entname[33];
pev(pev(id, pev_groundentity), pev_classname, entname, 32);
if(equal(entname, "func_door")) {
cp_continue = 0;
}
}
static vel[3];
pev(id, pev_velocity, vel);

if(vel[2] >= 0 && pev(id, pev_flags) & FL_ONGROUND && cp_continue == 1)
{
used_cp[id]=true;
}
}
}
}

public gocheck(id) {
if (used_cp[id] == true && used_gc[id] == false && used_unwanted[id] == false) {
used_gc[id]=true;
client_print(id, print_chat, "[KZ] Used checkpoint - Pro15 is disabled for you in this climb");
}
}

public used_unwanted_cmd(id) {
if ( used_unwanted[id] == false ) {
used_unwanted[id]=true;
client_print(id, print_chat, "[KZ] Pro15 and Top15 is disabled for you in this climb");
}
}

public used_hook_cmd(id) {
if (get_user_flags(id)&ADMIN_LEVEL_E) {
if ( used_unwanted[id] == false ) {
used_unwanted[id]=true;
client_print(id, print_chat, "[KZ] Pro15 and Top15 is disabled for you in this climb");
}
}
}

public client_PreThink(id) {
if (user_has_weapon(id, CSW_SCOUT) && used_unwanted[id] == false) {
used_unwanted_cmd(id);
}
}

public kz_StartClimb(id) {
used_gc[id]=false;
used_cp[id]=false;
if (user_has_weapon(id, CSW_SCOUT)) {
used_unwanted[id]=true;
client_print(id, print_chat, "[KZ] You must drop your scout and reset the timer to enable tops");
client_print(id, print_chat, "[KZ] Pro15 and Top15 is disabled for you");
} else {
used_unwanted[id]=false;
}
started[id]=true;
}

public save_top15() {
new pathname[128];
get_cvar_string("amx_climbtimer_path",pathname,127);

new mapname[64];
get_mapname(mapname,63);

new filename[128];
format(filename, 127, "%s/%s-top15.txt", pathname, mapname);

if( file_exists(filename) )
delete_file(filename);

for( new i = 0; i < 15; i++ ) {
if( top15_times == TOP_MAX_TIME )
return;

new topnumber[192];
num_to_str(top15_times,topnumber,191);

write_file(filename, top15_authid);
write_file(filename, top15_names);
write_file(filename, top15_cps);
write_file(filename, top15_gcs);
write_file(filename, topnumber);
}
return;
}

public save_pro15() {
new pathname[128];
get_cvar_string("amx_climbtimer_path",pathname,127);

new mapname[64];
get_mapname(mapname,63);

new filename[128];
format(filename, 127, "%s/%s-pro15.txt", pathname, mapname);

if( file_exists(filename) )
delete_file(filename);

for( new i = 0; i < 15; i++ ) {
if( pro15_times == PRO_MAX_TIME )
return;

new pronumber[192];
num_to_str(pro15_times,pronumber,191);

write_file(filename, pro15_authid);
write_file(filename, pro15_names);
write_file(filename, pronumber);
}
return;
}

public show_top15_climbers( id ) {
if( !get_cvar_num("kz_tops_enabled") )
return PLUGIN_HANDLED;

new buffer[2048];
new line[256];

new len = format( buffer, 2047, "" );

# Nick Climb time Checkpoints GoChecks" );

for(new i = 0; i < 15; ++i) {
if( top15_times == TOP_MAX_TIME )
format(line, 255, "
%d. %s %s %s %s", (i+1), "<---------->", "", "<0>", "<0>" );
else
format(line, 255, "
%d. %s (%d:%02d) %s %s", (i+1), top15_names, (top15_times/60) , (top15_times%60), top15_cps, top15_gcs );

len += format( buffer[len], 2047-len, line );
}

format(line, 255, "
len += format( buffer[len], 2047-len, "" );
len += format( buffer[len], 2047-len, line );

show_motd( id, buffer, "Top 15 Climbers" );
return PLUGIN_HANDLED;
}

public show_pro15_climbers( id ) {
if( !get_cvar_num("kz_tops_enabled") )
return PLUGIN_HANDLED;

new buffer[2048];
new line[256];

new len = format( buffer, 2047, "" );
# Nick Climb time" );

for(new i = 0; i < 15; ++i) {
if( pro15_times == PRO_MAX_TIME )
format(line, 255, "
%d. %s %s", (i+1), "<---------->", "" );
else
format(line, 255, "
%d. %s (%d:%02d)", (i+1), pro15_names, (pro15_times/60) , (pro15_times%60) );

len += format( buffer[len], 2047-len, line );
}

format(line, 255, "
len += format( buffer[len], 2047-len, "" );
len += format( buffer[len], 2047-len, line );

show_motd( id, buffer, "Pro 15 Climbers" );
return PLUGIN_HANDLED;
}

public kz_FinishClimb(id, time, cp_count, gc_count) {
if ( used_unwanted[id] == false ) {
new topfirst, profirst, name[32];
get_user_name( id, name, 31 );
topfirst = check_top15(id, time, cp_count, gc_count);
profirst = check_pro15(id, time, cp_count, gc_count);
if ( topfirst && profirst )
client_print(0, print_chat, "[KZ] %s estableshed new map record in top & pro 15!", name);
else if ( topfirst || profirst )
client_print(0, print_chat, "[KZ] %s estableshed new map record in %s15!", name, (topfirst) ? "top" : "pro");
used_unwanted[id]=true;
}
used_gc[id]=true;
used_cp[id]=true;
started[id]=false;
}

public check_top15(id, time, cp_count, gc_count) {
new name[32];
get_user_name( id, name, 31 );
new authid[32];
if (get_cvar_num("kz_rank_by_authid") == 1) {
get_user_authid( id, authid ,31 );
} else {
get_user_name( id, authid, 31 );
}
if( time < top15_times[14] ) {
for( new i = 0; i < 15; i++ ) {
//new number[192];
//number = str_to_num( top15_gcs );
if( time < top15_times || (time == top15_times && str_to_num( top15_gcs ) > gc_count) ) {
new pos = i;
while( !equal( top15_authid[pos], authid ) && pos < 14 )
pos++ ;
for( new j = pos; j > i; j-- ) {
format( top15_authid[j], 32, top15_authid[j-1] );
format( top15_names[j], 32, top15_names[j-1] );
format( top15_cps[j], 32, top15_cps[j-1] );
format( top15_gcs[j], 32, top15_gcs[j-1] );
top15_times[j] = top15_times[j-1];
}

format( top15_authid, 32, authid );
format( top15_names, 32, name );
new cpnumber[33], gcnumber[33];
num_to_str(cp_count, cpnumber, 32);
num_to_str(gc_count, gcnumber, 32);
format( top15_cps, 32, cpnumber );
format( top15_gcs, 32, gcnumber );
top15_times = time;

save_top15();
if ( i == 0 )
return 1;
return 0;
}
if( equal( top15_authid, authid ) )
return 0;
}
}
return 0;
}

public check_pro15(id, time, cp_count, gc_count) {
new name[32];
get_user_name( id, name, 31 );
new authid[32];
if (get_cvar_num("kz_rank_by_authid") == 1) {
get_user_authid( id, authid ,31 );
} else {
get_user_name( id, authid, 31 );
}
if( gc_count > 0 && cp_count > 0 ) {
client_print(id,print_chat,"[KZ] Sorry, but you used checkpoints. Your time will not be stored in Pro15.");
client_print(id,print_center,"[KZ] No Pro15 Entry. Checkpoint was used.");
return 0;
}
if( time < pro15_times[14] ) {
for( new i = 0; i < 15; i++ ) {
if( time < pro15_times ) {
new pos = i;
while( !equal( pro15_authid[pos], authid ) && pos < 14 )
pos++ ;
for( new j = pos; j > i; j-- ) {
format( pro15_authid[j], 32, pro15_authid[j-1] );
format( pro15_names[j], 32, pro15_names[j-1] );
pro15_times[j] = pro15_times[j-1];
}

format( pro15_authid, 32, authid );
format( pro15_names, 32, name );
pro15_times = time;

save_pro15();
if ( i == 0 )
return 1;
return 0;
}
if( equal( pro15_authid, authid ) )
return 0;
}
}
return 0;
}

thx

tolsty17/05/2008 00:57

sorry for making this lil bumb,
nico7elcapo, could you please upload that code somwhere in a text file, this code compiled like this, but it doesnt work, im to lazy to put all identations in the right place :D

SchlumPF17/05/2008 01:14

just use a autoindenter (for example in amxx studio)

tolsty19/05/2008 01:01(edited 19/05/2008 01:01)

did that already, but it doesnt work :(

Page 1 of 1

Please log in to post replies.