/******************************************************************************/
// If you change one of the following settings, do not forget to recompile
// the plugin and to install the new .amx file on your server.
// You can find the list of admin flags in the amx/examples/include/amxconst.inc file.
#define FLAG_AMX_KNIFEARENA ADMIN_CVAR
// Uncomment the following line to enable the AMX logs for this plugin.
//#define USE_LOGS
/******************************************************************************/
#include <translator>
#include <amxmod>
#include <amxmisc>
new g_roundCount
new knife_arena, fr_knife, jasonmode
new bool:knifearena, bool:firstroundknife
public plugin_init() {
load_translations("FirstRoundKnife")
register_plugin(_T("First Round Knife"), "0.3", "MeSter")
register_logevent("eNewRound", 2, "1=Round_Start")
register_logevent("eEndRound", 2, "1=Round_End")
register_event("TextMsg", "eRestart", "a", "2&#Game_C", "2&#Game_w")
register_event("CurWeapon", "switch_to_knife", "be", "1=1", "2!29")
fr_knife = register_cvar("sv_frk_firstround", "1") // Enable/Disable First Round Knife
knife_arena = register_cvar("sv_frk_knifearena", "0")
jasonmode = get_cvar_pointer("pb_jasonmode") // From POD-Bot Metamod plugin
register_concmd("amx_knifearena", "knifemod", FLAG_AMX_KNIFEARENA, _T("<0|1> - disables/enables knife arena"))
}
public eNewRound() {
knifearena = get_cvarptr_num(knife_arena) ? true : false
if(++g_roundCount == 1 && !knifearena && get_cvarptr_num(fr_knife)) {
firstroundknife = true
set_cvarptr_string(jasonmode, "1")
new players[32], inum
get_players(players, inum, "a")
for(new i = 0; i < inum; ++i) {
engclient_cmd(players[i], "weapon_knife")
}
set_hudmessage(0, 100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
show_hudmessage(0, _T("This first round is played with the knifes!"))
}
}
public eEndRound() {
if(g_roundCount == 1 && firstroundknife) {
firstroundknife = false
if(!knifearena)
set_cvarptr_string(jasonmode, "0")
}
}
public eRestart() {
g_roundCount = 0
}
public switch_to_knife(id) {
if(firstroundknife || knifearena)
engclient_cmd(id, "weapon_knife")
}
public knifemod(id, level) {
if(!access(id, level)) {
console_print(id, _T("You have no access to that command."))
return PLUGIN_HANDLED
}
new arg[2]
read_argv(1, arg, charsmax(arg))
#if defined USE_LOGS
new bool:current = knifearena
#endif
if(arg[0] == '1') {
if(knifearena == true) {
console_print(id, _T("Knife arena is already enabled!"))
return PLUGIN_HANDLED
}
set_cvarptr_string(knife_arena, "1")
set_cvarptr_string(jasonmode, "1")
knifearena = true
set_hudmessage(0, 100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
show_hudmessage(0, _T("Knife arena has been enabled, everybody with knife!"))
console_print(id, _T("You have enabled knife arena."))
new players[32], inum
get_players(players, inum, "a")
for(new i = 0; i < inum; ++i) {
engclient_cmd(players[i], "weapon_knife")
}
}
else if(arg[0] == '0') {
if(!knifearena) {
console_print(id, _T("Knife arena is already disabled!"))
return PLUGIN_HANDLED
}
set_cvarptr_string(knife_arena, "0")
set_cvarptr_string(jasonmode, "0")
knifearena = false
set_hudmessage(0, 100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
show_hudmessage(0, _T("Knife arena has been disabled, all weapons are now allowed!"))
console_print(id, _T("You have disabled knife arena."))
}
else {
console_print(id, _T("Usage: amx_knifearena <0|1> - disables/enables knife arena (currently: %s)"),
knifearena ? _T("Enabled") : _T("Disabled"))
}
#if defined USE_LOGS
if(knifearena != current && get_gametime() > 8.0) { // won't log at map change
if(id == 0) {
log_amx("First Round Knife: ^"<SERVER>^" %s knife arena", knifearena ? "enable" : "disable")
}
else {
new szAdminName[32], szAdminAuthid[24], szAdminIpAddress[24]
get_user_name(id, szAdminName, charsmax(szAdminName))
get_user_authid(id, szAdminAuthid, charsmax(szAdminAuthid))
get_user_ip(id, szAdminIpAddress, charsmax(szAdminIpAddress), 1)
log_amx("First Round Knife: ^"<%s><%d><%s><%s>^" %s knife arena",
szAdminName, get_user_userid(id), szAdminAuthid, szAdminIpAddress, knifearena ? "enable" : "disable")
}
}
#endif
return PLUGIN_HANDLED
}