/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <engine>
#define PLUGIN "Advanced Resetscore"
#define VERSION "1.0"
#define AUTHOR "Silent"
#define USE_CC 1
#if defined USE_CC
#include <colorchat>
#endif
#define ADMIN_NEED ADMIN_KICK
new cvar_enable;
new cvar_showall, cvar_showalladmin;
new cvar_log, cvar_logadmin;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
cvar_enable = register_cvar("ars_enable", "1");
cvar_showall = register_cvar("ars_showall", "0");
cvar_showalladmin = register_cvar("ars_showall_admin", "1");
cvar_log = register_cvar("ars_log", "0");
cvar_logadmin = register_cvar("ars_log_admin", "1");
register_clcmd("say /rs", "resetscore_player");
register_clcmd("say /resetscore", "resetscore_player");
register_clcmd("say !rs", "resetscore_player");
register_clcmd("say !resetscore", "resetscore_player");
register_clcmd("resetscore", "resetscore_player");
register_clcmd("amx_resetscore", "resetscore_admin");
register_clcmd("say amx_resetscore", "resetscore_admin");
}
public resetscore_player(id)
{
if(!get_pcvar_num(cvar_enable))
return PLUGIN_CONTINUE;
if(!is_user_connected(id))
return PLUGIN_HANDLED;
set_user_frags(id, 0);
cs_set_user_deaths(id, 0);
set_user_frags(id, 0);
cs_set_user_deaths(id, 0);
new name[32]; get_user_name(id, name, 31);
if(get_pcvar_num(cvar_showall))
{
#if defined USE_CC
ColorChat(0, GREEN, "[ Ne[^1X^4]oR ] ^3%s ^4 nullázta a statisztikáját.", name);
#else
client_print(0, print_chat, "%s nullazta a statisztikajat.", name);
#endif
}
else
{
#if defined USE_CC
ColorChat(id, GREEN, "[ Ne[^1X^4]oR ]^4 Sikeresen nulláztád a statisztikádát.");
#else
client_print(id, print_chat, "[ Ne[^1X^4]oR ]^4 Sikeresen nulláztád a statisztikádát.");
#endif
}
if(get_pcvar_num(cvar_log))
{
log_amx("%s nullazta a statisztikajat", name);
}
return PLUGIN_HANDLED;
}
public resetscore_admin(id)
{
if(!get_pcvar_num(cvar_enable))
return PLUGIN_CONTINUE;
if(!is_user_connected(id))
return PLUGIN_HANDLED;
if(!(get_user_flags(id) & ADMIN_NEED))
return PLUGIN_HANDLED;
new menu = menu_create("\rValaszd ki a jatekost:", "menu_handler");
new players[32], pnum, tempid;
new szName[32], szTempid[10];
get_players(players, pnum);
for( new i; i<pnum; i++ )
{
tempid = players[i];
get_user_name(tempid, szName, charsmax(szName));
num_to_str(tempid, szTempid, charsmax(szTempid));
menu_additem(menu, szName, szTempid, 0);
}
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public menu_handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], szName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
new tempid = str_to_num(data);
if(is_user_connected(tempid))
{
set_user_frags(tempid, 0);
cs_set_user_deaths(tempid, 0);
set_user_frags(tempid, 0);
cs_set_user_deaths(tempid, 0);
new name[32], tempname[32]; get_user_name(id, name, 31); get_user_name(tempid, tempname, 31);
if(get_pcvar_num(cvar_showalladmin))
{
#if defined USE_CC
ColorChat(0, GREEN, "[ Ne[X]oR ]^x03 %s^x04 nullazta ^x03%s^x04 statisztikajat.", name, tempname);
#else
client_print(0, print_chat, "[ Ne[X]oR ] %s nullazta %s statisztikajat.", name, tempname);
#endif
}
else
{
#if defined USE_CC
ColorChat(id, BLUE, "[ Ne[X]oR ]^x04 Sikeresen nullaztad ^x03%s^x04 statisztikajat.", tempname);
ColorChat(tempid, BLUE, "AdvancedRS]^x03 %s^x04 nullazta a statisztikadat.", name);
#else
client_print(id, print_chat, "[AdvancedRS] Sikeresen nullaztad %s statisztikajat.", tempname);
client_print(tempid, print_chat, "[AdvancedRS] %s nullazta a statisztikadat.", name);
#endif
}
if(get_pcvar_num(cvar_logadmin))
{
log_amx("%s admin nullazta %s jatekos statisztikajat.", name, tempname);
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
stock print_color(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!t", "^3")
replace_all(msg, 190, "á", "á")
replace_all(msg, 190, "é", "Ă©")
replace_all(msg, 190, "í", "Ă")
replace_all(msg, 190, "ó", "Ăł")
replace_all(msg, 190, "ö", "ö")
replace_all(msg, 190, "ő", "Ĺ‘")
replace_all(msg, 190, "ú", "Ăş")
replace_all(msg, 190, "ü", "ĂĽ")
replace_all(msg, 190, "ű", "ű")
replace_all(msg, 190, "Á", "Ă")
replace_all(msg, 190, "É", "É")
replace_all(msg, 190, "Í", "ĂŤ")
replace_all(msg, 190, "Ó", "Ă“")
replace_all(msg, 190, "Ö", "Ă–")
replace_all(msg, 190, "Ő", "Ĺ")
replace_all(msg, 190, "Ú", "Ăš")
replace_all(msg, 190, "Ü", "Ăś")
replace_all(msg, 190, "Ű", "Ĺ°")
replace_all(msg, 190, "©", "©")
replace_all(msg, 190, "®", "®")
replace_all(msg, 190, "§", "§")
replace_all(msg, 190, "°", "°")
replace_all(msg, 190, "Ł", "Ĺ")
replace_all(msg, 190, "»", "»")
replace_all(msg, 190, "«", "«")
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i])
write_string(msg)
message_end()
}
}
}
return PLUGIN_HANDLED
}