[ClanSphere] haslo to 'cw'
//#define ADMINS_ONLY // comment this line to allow SCM commands for all players #define MAX_MAPS 128 // max number of maps in map list (if you need more maps, just change this value to suits your needs) #define SCM_DICT "scm.txt" #define SCM_MAPS "maplist.ini" #define SCM_CW "cw.cfg" #define SCM_WARM "warmup.cfg" // DO NOT EDIT BELOW #include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "Simple Clanwar Management" #define VERSION "1.0" #define AUTHOR "rhin0" new g_match_inprogress = 0 new g_mapnames[MAX_MAPS][32] new g_mapcount new g_filename[256] public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say", "check_map", 0, "- [ClanSphere] check if the user say map change command") register_clcmd("say /start", "cmd_start", 0, "- [ClanSphere] 3x restarty i rozpoczecie meczu") register_clcmd("say /stop", "cmd_stop", 0, "- [ClanSphere] zatrzymanie meczu") register_clcmd("say /rr", "cmd_rr", 0, "- [ClanSphere] restart rundy") register_clcmd("say /knife", "cmd_knives", 0, "- [ClanSphere] runda nozowa") register_clcmd("say /help", "cmd_showhelp", 0, "- [ClanSphere] pokaz menu pomocy") register_dictionary(SCM_DICT) read_maps() } #if defined ADMINS_ONLY public client_putinserver(id) { if (access(id, ADMIN_MENU)) { if (is_user_bot(id)) return set_task(10.0, "showhelp", id) } else return } public client_disconnect(id) { remove_task(id) } #else public client_putinserver(id) { if (is_user_bot(id)) return set_task(10.0, "showhelp", id) } public client_disconnect(id) { remove_task(id) } #endif public read_maps() { new textlength get_filename(SCM_MAPS) new line = 0 while (line < MAX_MAPS && read_file(g_filename, line, g_mapnames[line], 30, textlength)) { ++line } log_message("SCM: loaded %i maps", line) g_mapcount = line } public check_map(id) { new said[192] read_args(said, 191) new i = 0 while (i < g_mapcount) { new trash[16], mapname[32] strtok(g_mapnames[i], trash, 15, mapname, 31, '_') format(mapname, 31, "^"/%s^"", mapname) if (equali(said, mapname)) { cmd_changemap(id, g_mapnames[i]) } ++i } } public cmd_changemap(id, mapname[]) { #if defined ADMINS_ONLY if (!access(id, ADMIN_MENU)) { client_print(id, print_chat, "[ClanSphere] %L", id, "NO_ACCESS") return PLUGIN_HANDLED } #endif if (g_match_inprogress != 1) { set_task(2.0, "change_map", 0, mapname, strlen(mapname)) new message[64] format(message, 63, "%L", id, "CHANGELEVEL", mapname) all_msg(message) } else { client_print(id, print_chat, "[ClanSphere] %L", id, "CANNOT_CHANGE_MAP") } return PLUGIN_CONTINUE } public cmd_knives(id) { #if defined ADMINS_ONLY if (!access(id, ADMIN_MENU)) { client_print(id, print_chat, "[ClanSphere] %L", id, "NO_ACCESS") return PLUGIN_HANDLED } #endif if (g_match_inprogress != 1) { g_match_inprogress = 0 set_task(1.0, "restart_round", 0, "1", 1) all_msg("runda nozowa") set_task(3.0, "strip_weapons") set_task(4.0, "knife_msg") } else { client_print(id, print_chat, "[ClanSphere] %L", id, "CANNOT_STOP_MATCH") } return PLUGIN_CONTINUE } public cmd_start(id) { #if defined ADMINS_ONLY if (!access(id, ADMIN_MENU)) { client_print(id, print_chat, "[ClanSphere] %L", id, "NO_ACCESS") return PLUGIN_HANDLED } #endif if (g_match_inprogress != 1) { set_task(1.0, "restart_round", 0, "1", 1) all_msg("rozpoczynanie meczu") g_match_inprogress = 1 get_filename(SCM_CW) server_cmd("exec %s", g_filename) client_print(0, print_chat, "[ClanSphere] %L", LANG_PLAYER, "CWTG_CFG_LOADED") set_task(3.0, "restart_round", 0, "1", 1) set_task(5.0, "restart_round", 0, "3", 1) set_task(9.0, "live_msg") } else { client_print(id, print_chat, "[ClanSphere] %L", id, "CANNOT_START_MATCH") } return PLUGIN_CONTINUE } public cmd_stop(id) { #if defined ADMINS_ONLY if (!access(id, ADMIN_MENU)) { client_print(id, print_chat, "[ClanSphere] %L", id, "NO_ACCESS") return PLUGIN_HANDLED } #endif if (g_match_inprogress == 1) { all_msg("zatrzymanie meczu") g_match_inprogress = 0 get_filename(SCM_WARM) server_cmd("exec %s", g_filename) client_print(0, print_chat, "[ClanSphere] %L", LANG_PLAYER, "WRM_CFG_LOADED") set_task(3.0, "restart_round", 0, "1", 1) set_task(6.0, "all_msg", 0, "mecz zatrzymany", 15) } else { client_print(id, print_chat, "[ClanSphere] %L", id, "CANNOT_STOP_MATCH") } return PLUGIN_CONTINUE } public cmd_rr(id) { #if defined ADMINS_ONLY if (!access(id, ADMIN_MENU)) { client_print(id, print_chat, "[ClanSphere] %L", id, "NO_ACCESS") return PLUGIN_HANDLED } #endif if (g_match_inprogress != 1) { set_task(1.0, "restart_round", 0, "1", 1) all_msg("restart") } else { client_print(id, print_chat, "[ClanSphere] %L", id, "CANNOT_RESTART_MATCH") } return PLUGIN_CONTINUE } public strip_weapons() { new plist_public[32], pnum_public get_players(plist_public, pnum_public) for (new i = 0; i < pnum_public; i++) { if (is_user_connected(plist_public[i]) == 1 && is_user_alive(plist_public[i]) == 1){ strip_user_weapons(plist_public[i]) give_item(plist_public[i], "weapon_knife") } } } public get_filename(filename[]) { new dir[128] get_configsdir(dir, 127) format(g_filename, 255, "%s/scm/%s", dir, filename) if (!file_exists(g_filename)) { log_message("SCM: file %s not found", filename) return PLUGIN_HANDLED } return PLUGIN_CONTINUE } public change_map(map[]) { server_cmd("changelevel %s", map) return PLUGIN_CONTINUE } public restart_round(seconds[]) { server_cmd("sv_restartround %s", seconds) return PLUGIN_CONTINUE } public live_msg() { set_hudmessage(255, 0, 0, -1.0, 0.2, 0, 6.0, 6.0) show_hudmessage(0, "--- live ---^n--- live ---^n--- live ---") client_print(0, print_chat, "*** live ***") client_print(0, print_chat, "*** live ***") client_print(0, print_chat, "*** live ***") return PLUGIN_CONTINUE } public knife_msg() { set_hudmessage(255, 0, 0, -1.0, 0.2, 0, 6.0, 6.0) show_hudmessage(0, "--- runda nozowa ---^n--- runda nozowa---^n--- runda nozowa ---") client_print(0, print_chat, "*** runda nozowa ***") client_print(0, print_chat, "*** runda nozowa ***") client_print(0, print_chat, "*** runda nozowa ***") return PLUGIN_CONTINUE } public all_msg(msg[]) { set_hudmessage(255, 0, 0, -1.0, 0.2, 0, 6.0, 6.0) show_hudmessage(0, "--- %s ---", msg) client_print(0, print_chat, "*** %s ***", msg) return PLUGIN_CONTINUE } public showhelp(id) { #if defined ADMINS_ONLY if (!access(id, ADMIN_MENU)) { client_print(id, print_chat, "[ClanSphere] %L", id, "NO_ACCESS") return PLUGIN_HANDLED } #endif client_print(id, print_chat, "[ClanSphere] %L", id, "HELP_MOTD") return PLUGIN_CONTINUE } public cmd_showhelp(id) { new motd[2048], line[256], title[64] add(motd, 2047, "<html><head><style>") add(motd, 2047, "body {font-family: Tahoma; font-size: 12px}") add(motd, 2047, "code {font-size: 14px; margin: 0 10px 0 0}") add(motd, 2047, "h1 {font-size: 18px; text-align: center}") add(motd, 2047, "h2 {font-size: 14px; font-weight: bold}") add(motd, 2047, "p {text-align: center; margin: 5px}") add(motd, 2047, "a {color: #991A00}") add(motd, 2047, "</style></head><body>") add(motd, 2047, "<div>") format(line, 255, "<h1>ClanSphere MIX @1shot1kill.pl</h1>", PLUGIN, VERSION) add(motd, 2047, line) format(line, 255, "<p>%L <strong>ClanSphere</strong></p>", id, "MOTD_CREDITS") add(motd, 2047, line) format(line, 255, "<p>%L <a href=http://www.ClanSphere.pl>www.ClanSphere.pl</a></p>", id, "MOTD_INFO") add(motd, 2047, line) format(line, 255, "<h2>%L</h2>", id, "MOTD_GEN_CMD") add(motd, 2047, line) format(line, 255, "[list] [*]<code>say /start</code> // %L", id, "MOTD_START_MATCH") add(motd, 2047, line) format(line, 255, " [*]<code>say /stop</code> // %L", id, "MOTD_STOP_MATCH") add(motd, 2047, line) format(line, 255, " [*]<code>say /knife</code> // %L", id, "MOTD_KNIFE_ROUND") add(motd, 2047, line) format(line, 255, " [*]<code>say /rr</code> // %L", id, "MOTD_RESTART_MATCH") add(motd, 2047, line) format(line, 255, " [*]<code>console amx_kickmenu</code> // %L", id, "MOTD_KICK_MENU") add(motd, 2047, line) format(line, 255, "<h2>%L</h2>", id, "MOTD_MAPS_CMD") add(motd, 2047, line) add(motd, 2047, "[list]") new i = 0 while (i < g_mapcount) { new mapcmd[128], trash[16], mapname[32] strtok(g_mapnames[i], trash, 15, mapname, 31, '_') format(mapcmd, 127, " [*]<code>say /%s</code> // %L %s", mapname, id, "MOTD_CHANGELEVEL", g_mapnames[i]) add(motd, 2047, mapcmd) ++i } add(motd, 2047, " [/list]") add(motd, 2047, "</div></body></html>") format(title, 63, "%s %s", PLUGIN, VERSION) show_motd(id, motd, title) return PLUGIN_HANDLED }