Could not locate output file.
Code:
#include <amxmodx>
#include <httpdl>
#pragma semicolon 1
#define PLUGIN "KZ Records"
#define VERSION "1.6b"
#define AUTHOR "SchlumPF"
#define ADMIN_FLAG ADMIN_KICK
#define MAX 12
#define SAY 2
#define EXT 6
new g_CountryAdjective[MAX][] =
{
"World",
"German",
"French",
"Estonian",
"Russian",
"Slovakian",
"Norwegian",
"Swedish",
"Danish",
"Bulgarien",
"Romanian",
"Brazilian"
"Polish"
};
new g_SayCommands[MAX][SAY][] =
{
{ "/xj", "/wr" },
{ "/cg", "/de" },
{ "/fr", "" },
{ "/ee", "" },
{ "/ru", "" },
{ "/sk", "" },
{ "/no", "" },
{ "/se", "" },
{ "/dk", "" },
{ "/bg", "" },
{ "/ro", "" },
{ "/br", "" },
{ "/pl", "" }
};
new g_DownloadLink[MAX][] =
{
"http://xtreme-jumps.eu/demos.txt",
"http://climbers-germany.de/demos.txt",
"http://kzfr.net/demos.txt",
"http://kreedz.pri.ee/demos.txt",
"http://climbers.cpms.ru/records.txt",
"http://kzsk.sk/demos/demos.txt",
"http://kz-scandinavia.com/demos_no.txt",
"http://kz-scandinavia.com/demos_se.txt",
"http://kz-scandinavia.com/demos_dk.txt",
"http://bulgarian-kreedz.net/demos.txt",
"http://romanian-jumpers.com/demos.txt",
"http://bra-records.vndv.com/demos.txt",
"http://kzpl.kampno.pl/demos.txt"
};
new g_RecordsFileSuffix[MAX][] =
{
"xj",
"cg",
"fr",
"ee",
"ru",
"sk",
"no",
"se",
"dk",
"bg",
"ro",
"br"
"pl"
};
new g_Skip[][] =
{
"Xtreme-Jumps.eu ",
"Climbers-Germany Record Script v2.0",
"FOR KZFR BY REMYY",
"http://kreedz.pri.ee #KZ.ee",
"",
"",
"",
"",
"",
"",
"",
"Romanian-Jumpers.com & #KZRO @ Quakenet",
"Brazilian Records"
};
new g_flRecordsFile[MAX][256];
new g_iColors[3] = { 255, 0, 255 };
new Float:g_fShowtime = 5.0;
new Float:g_fCoords[2] = { 0.01, 0.2 };
public plugin_init( )
{
register_plugin( PLUGIN, VERSION, AUTHOR );
register_clcmd( "say", "hookSay" );
register_concmd( "kz_records_coords", "cmdChangeShowtime" );
register_concmd( "kz_records_coords", "cmdChangeCoords" );
register_concmd( "kz_records_color", "cmdChangeColor" );
}
public plugin_cfg( )
{
new temp[256];
get_localinfo( "amxx_datadir", temp, 255 );
format( temp, 255, "%s/kz_records", temp );
if( !dir_exists( temp ) )
{
mkdir( temp );
}
for( new i ; i < MAX ; i++ )
{
format( g_flRecordsFile[i], 255, "%s/demos_%s.txt", temp, g_RecordsFileSuffix[i] );
}
format( temp, 255, "%s/last_update.ini", temp );
if( !file_exists( temp ) )
{
fnUpdate( );
return PLUGIN_CONTINUE;
}
new year, month, day;
date( year, month, day );
new f = fopen( temp, "rt" );
fgets( f, temp, 255 );
fclose( f );
if( str_to_num( temp[0] ) > year || str_to_num( temp[5] ) > month || str_to_num( temp[8] ) > day )
{
fnUpdate( );
return PLUGIN_CONTINUE;
}
return PLUGIN_CONTINUE;
}
public hookSay( plr )
{
static msg[512], cmd[32], map[32];
read_args( cmd, 31 );
remove_quotes( cmd );
if( !cmd[0] || strlen( cmd ) != 3 )
{
return PLUGIN_CONTINUE;
}
for( new i ; i < MAX ; i++ )
{
for( new j ; j < SAY ; j++ )
{
if( !equali( cmd, g_SayCommands[i][j], 3 ) )
{
continue;
}
static author[EXT][32], kztime[8], extension[EXT][8], len, founds;
if( cmd[4] )
{
founds = get_record_data( i, cmd[4], author, kztime, extension );
len = format( msg, 511, "%s Record of %s:", g_CountryAdjective[i], cmd[4] );
}
else
{
get_mapname( map, 31 );
founds = get_record_data( i, map, author, kztime, extension );
len = format( msg, 511, "%s Record of %s:", g_CountryAdjective[i], map );
}
if( author[0][0] )
{
for( new x ; x < founds ; x++ )
{
if( !author[x][0] )
{
break;
}
if( extension[x][0] )
{
len += format( msg[len], 511 - len, "^n [%s] %s (%i:%02i) ", extension[x], author[x], ( kztime[x] / 60 ), ( kztime[x] % 60 ) );
}
else
{
len += format( msg[len], 511 - len, "^n %s (%i:%02i) ", author[x], ( kztime[x] / 60 ), ( kztime[x] % 60 ) );
}
}
}
else
{
len += format( msg[len], 511 - len, "^n N/A (**:**)" );
}
set_hudmessage( g_iColors[0], g_iColors[1], g_iColors[2], g_fCoords[0], g_fCoords[1], _, _, g_fShowtime, _, _, -1 );
show_hudmessage( plr, msg );
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
public get_record_data( i, map[], author[][32], kztime[8], extension[][8] )
{
static data[256], _map[64], _kztime[8], f;
new founds, len;
f = fopen( g_flRecordsFile[i], "rt" );
while( !feof( f ) )
{
fgets( f, data, 255 );
if( equali( data, g_Skip[i] ) )
{
continue;
}
if( !equali( data, map, strlen( map ) ) )
{
continue;
}
len += 1 + copyc( _map, 63, data[len], ' ' );
len += 1 + copyc( _kztime, 7, data[len], ' ' );
kztime[founds] = str_to_num( _kztime );
copy( author[founds], 32, data[len] );
replace( author[founds], 31, "^n", "" );
if( containi( _map, "[" ) && containi( _map, "]" ) )
{
for( new i ; i < strlen( _map ) ; i++ )
{
if( !equali( _map[i], "[", 1 ) )
{
continue;
}
len = i + 1;
copyc( extension[founds], 8, _map[len], ']' );
break;
}
}
founds++;
}
fclose( f );
return founds;
}
public fnUpdate( )
{
for( new i ; i < MAX ; i++ )
{
download( g_DownloadLink[i], g_flRecordsFile[i] );
}
new temp[256];
get_localinfo( "amxx_datadir", temp, 255 );
format( temp, 255, "%s/kz_records/last_update.ini", temp );
new year, month, day;
date( year, month, day );
if( file_exists( temp ) )
{
delete_file( temp );
}
new f = fopen( temp, "wt" );
format( temp, 255, "%04ix%02ix%02i", year, month, day );
fputs( f, temp );
fclose( f );
}
public cmdChangeShowTime( plr )
{
if( !( get_user_flags( plr ) & ADMIN_FLAG ) )
{
client_print( plr, print_console, "* You have no access to this command" );
return PLUGIN_HANDLED;
}
if( read_argc( ) != 2 )
{
client_print( plr, print_console, "Usage: kz_godmode_showtime <time>" );
return PLUGIN_HANDLED;
}
new showtime[32];
read_argv( 1, showtime, 31 );
g_fShowtime = floatclamp( str_to_float( showtime ), 0.0, 1000000.0 );
client_print( plr, print_console, "kz_godmode_showtime changed to ^"%f^"", g_fShowtime );
return PLUGIN_HANDLED;
}
public cmdChangeCoords( plr )
{
if( !( get_user_flags( plr ) & ADMIN_FLAG ) )
{
client_print( plr, print_console, "* You have no access to this command" );
return PLUGIN_HANDLED;
}
if( read_argc( ) != 3 )
{
client_print( plr, print_console, "Usage: kz_records_coords <x> <y>" );
return PLUGIN_HANDLED;
}
new x_str[6], y_str[6];
read_argv( 1, x_str, 5 );
read_argv( 2, y_str, 5 );
g_fCoords[0] = floatclamp( str_to_float( x_str ), -1.0, 1.0 );
g_fCoords[1] = floatclamp( str_to_float( y_str ), -1.0, 1.0 );
client_print( plr, print_console, "kz_records_coords changed to ^"%f %f^"", g_fCoords[0], g_fCoords[1] );
return PLUGIN_HANDLED;
}
public cmdChangeColor( plr )
{
if( !( get_user_flags( plr ) & ADMIN_FLAG ) )
{
client_print( plr, print_console, "* You have no access to this command" );
return PLUGIN_HANDLED;
}
if( read_argc( ) != 4 )
{
client_print( plr, print_console, "Usage: kz_records_color <red> <green> <blue>" );
return PLUGIN_HANDLED;
}
new r_str[4], g_str[4], b_str[4];
read_argv( 1, r_str, 3 );
read_argv( 2, g_str, 3 );
read_argv( 3, b_str, 3 );
g_iColors[0] = clamp( str_to_num( r_str ), 0, 255 );
g_iColors[1] = clamp( str_to_num( g_str ), 0, 255 );
g_iColors[2] = clamp( str_to_num( b_str ), 0, 255 );
client_print( plr, print_console, "kz_records_color changed to ^"%i %i %i^"", g_iColors[0], g_iColors[1], g_iColors[2] );
return PLUGIN_HANDLED;
}