Untested. Everything is changed as requested.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#define PLUGIN "Advanced Reset Score"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"
new szCommands[][] = { // All available commands. If you wish to add or delete some, make sure the layout stays the same. the last command shouldn't have a "," at the end, as all the rest does.
"say /resetscore",
"say /rs",
"say /scorereset",
"say_team /resetscore",
"say_team /rs",
"say_team /scorereset"
}
new pMainPlugin
new pDelayTime
new pMinimalFrags
new pMinimalDeaths
new pAdvertiseMethod
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
for(new i; i < sizeof(szCommands); i++) {
register_clcmd(szCommands[i], "ResetScore")
}
pMainPlugin = register_cvar("rs_resetscore", "1") // Enables/disables the plugin. 0 = disabled.
pDelayTime = register_cvar("rs_delaytime", "10")
pMinimalFrags = register_cvar("rs_minfrags", "0")
pMinimalDeaths = register_cvar("rs_mindeaths", "0")
pAdvertiseMethod = register_cvar("rs_message", "1") // 1 = print text & play sound, 2 = print text only, 3 = play sound only.
}
public plugin_precache() {
precache_sound("events/task_complete.wav")
}
public ResetScore(id) {
if(!get_pcvar_num(pMainPlugin)) { // Plugin disabled
return PLUGIN_HANDLED
}
static iCoolDown[33], systime
if(iCoolDown[id] > (systime = get_systime())) {
client_print(id, print_chat, "[RS] You have to wait %i seconds to reset your score again.", iCoolDown[id] - systime)
}
new iFrags = get_user_frags(id)
new iDeaths = get_user_deaths(id)
if(iFrags >= get_pcvar_num(pMinimalFrags) && iDeaths >= get_pcvar_num(pMinimalDeaths)) {
cs_set_user_deaths(id, 0)
set_user_frags(id, 0)
iCoolDown[id] = systime + get_pcvar_num(pDelayTime)
DisplayMessage(id)
}
else {
client_print(id, print_chat, "[RS] You don't have minimum %i frags and %i deaths to reset the score", get_pcvar_num(pMinimalDeaths), get_pcvar_num(pMinimalFrags))
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public DisplayMessage(id) {
switch(pAdvertiseMethod) {
case 1: {
client_print(id, print_chat, "[RS] You reset your score.")
client_cmd(id, "spk ^"cleanup(t20) denied(t20)^"")
}
case 2: {
client_print(id, print_chat, "[RS] You reset your score.")
}
case 3: {
client_cmd(id, "spk ^"cleanup(t20) denied(t20)^"")
}
}
}
__________________