if anyone uses non-sql version of this plugin, and got a lot of cheaters/badtime in tops, but he is lazy to delete all them seperately, here is the code to delete ALL RECORDS BY NICK (containing characters, min. 3) or to delete bugged time (like 00:01.xx; 00:02.xx), cuz this plugin has that problem
here is the code...use: kz_delete_rec Nick/Steamid/1TIME_DELETE1 (this last one will delete all records under 3 in every file in /configs/top15/...thats it i think this addon:
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Delete ProKreedz REC"
#define VERSION "1.0"
#define AUTHOR "alliedmods"
new mapname[100]
new bool: poseduje
new bool: time_delete
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd( "kz_delete_rec", "uradjeno" )
}
public uradjeno(id)
{
if( !is_user_admin( id ) )
{
client_print( id, print_console, "You must be an admin to reset someone's record." )
return PLUGIN_HANDLED
}
poseduje = false;
new dir = open_dir("/addons/amxmodx/configs/kz/top15/", mapname, sizeof(mapname)-1)
new file, fname[100]
new readdata[128]
new ptime[20],psteamid[40],pname[32],pdate[20]
new szarg1[32]
read_argv(1,szarg1,31)
remove_quotes(szarg1);
if( !( containi(szarg1, "STEAM") != -1 || strlen( szarg1 ) > 3 ) )
{
client_print( id, print_console, "Moras STEAM:ID ili Nick duzi od 3 slova !" )
return PLUGIN_HANDLED;
}
if(equal(szarg1,"1TIME_DELETE1"))
{
time_delete = true
}
if (dir)
{
while (next_file(dir, mapname, sizeof(mapname)-1))
{
formatex( fname, 99, "/addons/amxmodx/configs/kz/top15/%s", mapname )
file = fopen( fname, "rt" );
if(file)
{
new TempFile[128]; get_configsdir(TempFile, charsmax(TempFile))
new const FileName[] = "tempfile.ini"
format(TempFile, charsmax(TempFile), "/addons/amxmodx/configs/kz/top15/%s", FileName)
new InputFilePointer = fopen(TempFile, "wt")
if(InputFilePointer)
{
//client_print( id, print_console, "MapName^t^t^t^t^t^t^t^t- NICK^t^t^t^t- SteamID^n" ) //ponavlja se na svako brisanje rekorda, nije nesto potrebno
while(!feof(file))
{
fgets(file, readdata, charsmax(readdata))
parse(readdata, ptime, charsmax(ptime), psteamid, charsmax(psteamid), pname, charsmax(pname), pdate, charsmax(pdate))
if((containi(pname, szarg1) != -1 || containi( psteamid, szarg1 ) != -1) && !time_delete )
{
poseduje = true;
client_print( id, print_console, "%s - %s - %s - %s", mapname, pname, ptime, psteamid )
continue;
}
else if( ( containi( ptime, "2." ) != -1 || containi( ptime, "1." ) != -1 || containi( ptime, "0." ) != -1 ) && time_delete && ( strlen( ptime ) == 4 ) )
{
poseduje = true;
time_delete = false
client_print( id, print_console, "TIME_DEL: %s - %s - %s - %s", mapname, pname, ptime, psteamid )
continue;
}
else
fputs(InputFilePointer, readdata)
}
}
fclose(InputFilePointer)
fclose(file)
delete_file(fname)
rename_file(TempFile, fname, 1)
}
}
}
close_dir(dir)
if( !poseduje )
client_print( id, print_console, "[KZ] There was ZERO targets to delete." )
return PLUGIN_CONTINUE;
}
something like this will happen in admin's console (+time, its updated now):