From 78c191b4c93338816b5e04b78d33b7d38bec5cf5 Mon Sep 17 00:00:00 2001 From: Lukasz Wlasinksi Date: Fri, 10 Sep 2004 11:47:43 +0000 Subject: [PATCH] added dod plugins --- plugins/dod/dodstats.sma | 26 + plugins/dod/menufront.sma | 201 +++++++ plugins/dod/plmenu.sma | 667 +++++++++++++++++++++ plugins/dod/plugins.ini | 42 ++ plugins/dod/stats.sma | 1055 +++++++++++++++++++++++++++++++++ plugins/dod/stats_logging.sma | 66 +++ plugins/dod/statssounds.sma | 29 + 7 files changed, 2086 insertions(+) create mode 100755 plugins/dod/dodstats.sma create mode 100755 plugins/dod/menufront.sma create mode 100755 plugins/dod/plmenu.sma create mode 100755 plugins/dod/plugins.ini create mode 100755 plugins/dod/stats.sma create mode 100755 plugins/dod/stats_logging.sma create mode 100755 plugins/dod/statssounds.sma diff --git a/plugins/dod/dodstats.sma b/plugins/dod/dodstats.sma new file mode 100755 index 00000000..97ed9449 --- /dev/null +++ b/plugins/dod/dodstats.sma @@ -0,0 +1,26 @@ +/* Get Score for DoD STATS. + * + * (c) 2004, SidLuke + * This file is provided as is (no warranties). + * + * Function calculates position in rank. + * + * Stats: + * 0 - kills + * 1 - deaths + * 2 - headshots + * 3 - teamkilling + * 4 - shots + * 5 - hits + * 6 - damage + * 7 - score + * + * File location: $moddir/addons/amx + */ + +#include + +public get_score(stats[9],body[8]) +{ + return stats[0] - stats[1] - stats[3] /* kills - deaths - TKs */ +} \ No newline at end of file diff --git a/plugins/dod/menufront.sma b/plugins/dod/menufront.sma new file mode 100755 index 00000000..cb0d1899 --- /dev/null +++ b/plugins/dod/menufront.sma @@ -0,0 +1,201 @@ +/* AMX Mod X +* Menus Front-End Plugin +* +* by the AMX Mod X Development Team +* originally developed by OLO +* +* This file is part of AMX Mod X. +* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +*/ + +#include +#include + +new g_menuPosition[33] + +#define MENUS_NUMBER 16 + +new g_menuBody[MENUS_NUMBER][] = { + "KICK_PLAYER", + "BAN_PLAYER", + "SLAP_SLAY", + "TEAM_PLAYER", + + "CHANGEL", + "VOTE_MAPS", + + "SPECH_STUFF", + "CLIENT_COM", + + // Next Page + + "SERVER_COM", + "CVARS_SET", + "CONFIG", + "LANG_SET", + "STATS_SET", + + "PAUSE_PLUG", + "RES_WEAP", + + "TELE_PLAYER" /* Last is Teleport menu - if you want to move it + change also code in displayMenu (look for fun module check) */ +} + +new g_menuCmd[MENUS_NUMBER][] = { + "amx_kickmenu", + "amx_banmenu", + "amx_slapmenu", + "amx_teammenu", + + "amx_mapmenu", + "amx_votemapmenu", + + "amx_speechmenu", + "amx_clcmdmenu", + + // Next Page + + "amx_cmdmenu", + "amx_cvarmenu", + "amx_cfgmenu", + "amx_setlangmenu", + "amx_statscfgmenu", + + "amx_pausecfgmenu", + "amx_restmenu", + + "amx_teleportmenu" +} + +// Second value sets if menu is only for CS... +new g_menuAccess[MENUS_NUMBER][2] = { + {ADMIN_KICK,0}, + {ADMIN_BAN,0}, + {ADMIN_SLAY,0}, + {ADMIN_LEVEL_A,0}, + + {ADMIN_MAP,0}, + {ADMIN_MAP,0}, + + {ADMIN_MENU,0}, + {ADMIN_LEVEL_A,0}, + + // Next Page + + {ADMIN_MENU,0}, + {ADMIN_CVAR,0}, + {ADMIN_MENU,0}, + {ADMIN_CFG,0}, + {ADMIN_CFG,0}, + + {ADMIN_CFG,0}, + {ADMIN_CFG,1}, + + {ADMIN_LEVEL_A,0} +} + +new g_coloredMenus +new g_cstrikeRunning +new g_funModule + +public plugin_init() { + register_plugin("Menus Front-End",AMXX_VERSION_STR,"AMXX Dev Team") + + register_dictionary("menufront.txt") + register_dictionary("common.txt") + + register_menucmd(register_menuid("AMX Mod X Menu"),1023,"actionMenu") + register_clcmd("amxmodmenu","cmdMenu",ADMIN_MENU,"- displays menus") + + g_coloredMenus = colored_menus() + g_cstrikeRunning = cstrike_running() + g_funModule = is_module_loaded("Fun") +} + +public actionMenu(id,key) { + switch (key) { + case 8: displayMenu(id,++g_menuPosition[id]) + case 9: displayMenu(id,--g_menuPosition[id]) + default: client_cmd(id, g_menuCmd[ g_menuPosition[id] * 8 + key ] ) + } + return PLUGIN_HANDLED +} + +displayMenu(id,pos) { + if (pos < 0) return + + new menuBody[512] + new b = 0 + new start = pos * 8 + + if ( start >= MENUS_NUMBER ) + start = pos = g_menuPosition[id] = 0 + + new len = format(menuBody,511, + g_coloredMenus ? "\yAMX Mod X Menu\R%d/%d^n\w^n" : "AMX Mod X Menu %d/%d^n^n" , pos+1, 2 ) + + new end = start + 8 + new keys = MENU_KEY_0 + + if (end > MENUS_NUMBER ) + end = MENUS_NUMBER + + new flags = get_user_flags(id) + + for (new a = start; a < end; ++a) { + if ( a == MENUS_NUMBER - 1 && !g_funModule ) + continue // checks if there is fun module for teleport menu + + if ( (flags & g_menuAccess[a][0]) && ( g_menuAccess[a][1] ? g_cstrikeRunning : 1 ) ) { + keys |= (1< +#include +#include + +new g_menuPosition[33] +new g_menuPlayers[33][32] +new g_menuPlayersNum[33] +new g_menuOption[33] +new g_menuSettings[33] + +new g_menuSelect[33][64] +new g_menuSelectNum[33] + +#define MAX_CLCMDS 24 + +new g_clcmdName[MAX_CLCMDS][32] +new g_clcmdCmd[MAX_CLCMDS][64] +new g_clcmdMisc[MAX_CLCMDS][2] +new g_clcmdNum + +new g_coloredMenus + +public plugin_init() { + register_plugin("Players Menu",AMXX_VERSION_STR,"AMXX Dev Team") + + register_dictionary("plmenu.txt") + register_dictionary("common.txt") + + register_clcmd("amx_kickmenu","cmdKickMenu",ADMIN_KICK,"- displays kick menu") + register_clcmd("amx_banmenu","cmdBanMenu",ADMIN_BAN,"- displays ban menu") + register_clcmd("amx_slapmenu","cmdSlapMenu",ADMIN_SLAY,"- displays slap/slay menu") + register_clcmd("amx_teammenu","cmdTeamMenu",ADMIN_LEVEL_A,"- displays team menu") + register_clcmd("amx_clcmdmenu","cmdClcmdMenu",ADMIN_LEVEL_A,"- displays client cmds menu") + + register_menucmd(register_menuid("Ban Menu"),1023,"actionBanMenu") + register_menucmd(register_menuid("Kick Menu"),1023,"actionKickMenu") + register_menucmd(register_menuid("Slap/Slay Menu"),1023,"actionSlapMenu") + register_menucmd(register_menuid("Team Menu"),1023,"actionTeamMenu") + register_menucmd(register_menuid("Client Cmds Menu"),1023,"actionClcmdMenu") + + g_coloredMenus = colored_menus() + + new clcmds_ini_file[64] + get_configsdir(clcmds_ini_file, 63) + format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file) + load_settings(clcmds_ini_file) +} + +/* Ban menu */ + +public actionBanMenu(id,key) { + switch (key) { + case 7: { + ++g_menuOption[id] + g_menuOption[id] %= 3 + + switch(g_menuOption[id]){ + case 0: g_menuSettings[id] = 0 + case 1: g_menuSettings[id] = 5 + case 2: g_menuSettings[id] = 60 + } + + displayBanMenu(id,g_menuPosition[id]) + } + case 8: displayBanMenu(id,++g_menuPosition[id]) + case 9: displayBanMenu(id,--g_menuPosition[id]) + default: { + new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] + + new name[32], name2[32], authid[32],authid2[32] + get_user_name(player,name2,31) + get_user_authid(id,authid,31) + get_user_authid(player,authid2,31) + get_user_name(id,name,31) + new userid2 = get_user_userid(player) + + log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", + name,get_user_userid(id),authid, name2,userid2,authid2, g_menuSettings[id] ) + + switch (get_cvar_num("amx_show_activity")) { + case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_2",name,name2) + case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_1",name2) + } + + if (equal("4294967295",authid2)) { /* lan */ + new ipa[32] + get_user_ip(player,ipa,31,1) + server_cmd("addip %d %s;writeip",g_menuSettings[id],ipa) + } + else + server_cmd("banid %d #%d kick;writeid",g_menuSettings[id],userid2) + + server_exec() + + displayBanMenu(id,g_menuPosition[id]) + } + } + return PLUGIN_HANDLED +} + +displayBanMenu(id,pos) { + if (pos < 0) return + + get_players(g_menuPlayers[id],g_menuPlayersNum[id]) + + new menuBody[512] + new b = 0 + new i + new name[32] + new start = pos * 7 + + if (start >= g_menuPlayersNum[id]) + start = pos = g_menuPosition[id] = 0 + + new len = format(menuBody,511, g_coloredMenus ? + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", + id,"BAN_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) + + new end = start + 7 + new keys = MENU_KEY_0|MENU_KEY_8 + + if (end > g_menuPlayersNum[id]) + end = g_menuPlayersNum[id] + + for (new a = start; a < end; ++a) { + i = g_menuPlayers[id][a] + get_user_name(i,name,31) + + if ( is_user_bot(i) || access(i,ADMIN_IMMUNITY) ) { + ++b + if ( g_coloredMenus ) + len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) + else + len += format(menuBody[len],511-len,"#. %s^n",name) + } + else { + keys |= (1<<%s><>^" slap with %d damage ^"%s<%d><%s><>^"", + name,get_user_userid(id),authid, g_menuSettings[id], name2,get_user_userid(player),authid2 ) + switch (get_cvar_num("amx_show_activity")) { + case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAP_2",name,name2,g_menuSettings[id]) + case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAP_1",name2,g_menuSettings[id]) + } + } + else { + log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", + name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 ) + switch(get_cvar_num("amx_show_activity")) { + case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAY_2",name,name2) + case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAY_1",name2) + } + } + + if ( g_menuOption[id]) + user_slap(player, ( get_user_health(player) > g_menuSettings[id] ) ? g_menuSettings[id] : 0 ) + else + user_kill( player ) + + displaySlapMenu(id,g_menuPosition[id]) + } + } + return PLUGIN_HANDLED +} + + +displaySlapMenu(id,pos) { + if (pos < 0) return + + get_players(g_menuPlayers[id],g_menuPlayersNum[id]) + + new menuBody[512] + new b = 0 + new i + new name[32], team[8] + new start = pos * 7 + + if (start >= g_menuPlayersNum[id]) + start = pos = g_menuPosition[id] = 0 + + new len = format(menuBody,511, g_coloredMenus ? + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", + id,"SLAP_SLAY_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) + + new end = start + 7 + new keys = MENU_KEY_0|MENU_KEY_8 + + if (end > g_menuPlayersNum[id]) + end = g_menuPlayersNum[id] + + for (new a = start; a < end; ++a) { + i = g_menuPlayers[id][a] + get_user_name(i,name,31) + get_user_team(i,team,7) + + if ( !is_user_alive(i) || access(i,ADMIN_IMMUNITY) ) { + ++b + if ( g_coloredMenus ) + len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w", b,name,team) + else + len += format(menuBody[len],511-len,"#. %s %s^n",name,team) + } + else + { + keys |= (1<<%s><>^" kick ^"%s<%d><%s><>^"", + name,get_user_userid(id),authid, name2,userid2,authid2 ) + + switch (get_cvar_num("amx_show_activity")) { + case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_2",name,name2) + case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_1",name2) + } + + server_cmd("kick #%d",userid2) + server_exec() + + displayKickMenu(id,g_menuPosition[id]) + } + } + return PLUGIN_HANDLED +} + +displayKickMenu(id,pos) { + if (pos < 0) return + + get_players(g_menuPlayers[id],g_menuPlayersNum[id]) + + new menuBody[512] + new b = 0 + new i + new name[32] + new start = pos * 8 + + if (start >= g_menuPlayersNum[id]) + start = pos = g_menuPosition[id] = 0 + + new len = format(menuBody,511, g_coloredMenus ? + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", + id,"KICK_MENU",pos+1,( g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) ) + + new end = start + 8 + new keys = MENU_KEY_0 + + if (end > g_menuPlayersNum[id]) + end = g_menuPlayersNum[id] + + for (new a = start; a < end; ++a) { + i = g_menuPlayers[id][a] + get_user_name(i,name,31) + + if ( access(i,ADMIN_IMMUNITY) ) { + ++b + if ( g_coloredMenus ) + len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) + else + len += format(menuBody[len],511-len,"#. %s^n",name) + + } + else { + keys |= (1<<%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", + name,get_user_userid(id),authid, name2,get_user_userid(player),authid2, g_menuOption[id] ? "Allies" : "Axis" ) + + switch (get_cvar_num("amx_show_activity")) { + case 2: client_print(0,print_chat,"%L",id,"ADMIN_TRANSF_2",name,name2,g_menuOption[id] ? "Allies" : "Axis" ) + case 1: client_print(0,print_chat,"%L",id,"ADMIN_TRANSF_1",name2,g_menuOption[id] ? "Allies" : "Axis" ) + } + + dod_user_kill(player) + engclient_cmd(player,"jointeam", g_menuOption[id] ? "1" : "2" ) + + displayTeamMenu(id,g_menuPosition[id]) + } + } + return PLUGIN_HANDLED +} + +displayTeamMenu(id,pos) { + if (pos < 0) return + + get_players(g_menuPlayers[id],g_menuPlayersNum[id]) + + new menuBody[512] + new b = 0 + new i, iteam + new name[32], team[8] + new start = pos * 7 + + if (start >= g_menuPlayersNum[id]) + start = pos = g_menuPosition[id] = 0 + + new len = format(menuBody,511, g_coloredMenus ? + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", + id,"TEAM_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) + + new end = start + 7 + new keys = MENU_KEY_0|MENU_KEY_8 + + if (end > g_menuPlayersNum[id]) + end = g_menuPlayersNum[id] + + for (new a = start; a < end; ++a) { + i = g_menuPlayers[id][a] + get_user_name(i,name,31) + iteam = get_user_team(i,team,7) + + if ( (iteam == (g_menuOption[id] ? 1 : 2)) || access(i,ADMIN_IMMUNITY) ) { + ++b + if ( g_coloredMenus ) + len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w",b,name,team) + else + len += format(menuBody[len],511-len,"#. %s %s^n",name,team) + } + else { + keys |= (1<= g_menuPlayersNum[id]) + start = pos = g_menuPosition[id] = 0 + + new len = format(menuBody,511, g_coloredMenus ? + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", + id, "CL_CMD_MENU", pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) + + new end = start + 7 + new keys = MENU_KEY_0|MENU_KEY_8 + + if (end > g_menuPlayersNum[id]) + end = g_menuPlayersNum[id] + + for (new a = start; a < end; ++a) { + i = g_menuPlayers[id][a] + get_user_name(i,name,31) + + if ( !g_menuSelectNum[id] || access(i,ADMIN_IMMUNITY) ) { + ++b + if ( g_coloredMenus ) + len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) + else + len += format(menuBody[len],511-len,"#. %s^n",name) + } + else { + keys |= (1< 3 ) + { + while ( replace( g_clcmdCmd[ g_clcmdNum ] ,63,"\'","^"") ) { + // do nothing + } + + g_clcmdMisc[ g_clcmdNum ][1] = read_flags ( szFlags ) + g_clcmdMisc[ g_clcmdNum ][0] = read_flags ( szAccess ) + g_clcmdNum++ + } + } + return 1 +} + +public plugin_modules() +{ + require_module("dodx") +} \ No newline at end of file diff --git a/plugins/dod/plugins.ini b/plugins/dod/plugins.ini new file mode 100755 index 00000000..59807818 --- /dev/null +++ b/plugins/dod/plugins.ini @@ -0,0 +1,42 @@ +; AMX Mod X plugins + +; Admin Base - Always one has to be activated +admin.amxx ; admin base (required for any admin-related) +;admin_sql.amxx ; admin base - SQL version (comment admin.amxx) + +; Basic +admincmd.amxx ; basic admin console commands +adminhelp.amxx ; help command for admin console commands +adminslots.amxx ; slot reservation +multilingual.amxx ; Multi-Lingual management + +; Menus +menufront.amxx ; front-end for admin menus +cmdmenu.amxx ; command menu (speech, settings) +plmenu.amxx ; players menu (kick, ban, client cmds.) +;telemenu.amxx ; teleport menu (Fun Module required!) +mapsmenu.amxx ; maps menu (vote, changelevel) + +; Chat / Messages +adminchat.amxx ; console chat commands +;antiflood.amxx ; prevent clients from chat-flooding the server +scrollmsg.amxx ; displays a scrolling message +imessage.amxx ; displays information messages +adminvote.amxx ; vote commands + +; Map related +nextmap.amxx ; displays next map in mapcycle +mapchooser.amxx ; allows to vote for next map +timeleft.amxx ; displays time left on map + +; Configuration +pausecfg.amxx ; allows to pause and unpause some plugins +statscfg.amxx ; allows to manage stats plugins via menu and commands + +; DOD X Stats Plugins +statscfg.amx ; allows to manage stats plugins via menu and commands +stats.amx ; stats on death or round end (DoD X Module required!) +;statssounds.amx ; precache plugin for stats plugins +;stats_logging.amx ; weapons stats logging (DoD X Module required!) + +; Custom - Add 3rd party plugins here diff --git a/plugins/dod/stats.sma b/plugins/dod/stats.sma new file mode 100755 index 00000000..775975a2 --- /dev/null +++ b/plugins/dod/stats.sma @@ -0,0 +1,1055 @@ +/* AMX Mod script. +* +* (c) 2004, SidLuke +* This file is provided as is (no warranties). +* +* Plugin works with Stats Settings Plugin. Just run both of them. +* By amx_statscfg command (from Stats Settings Plugin) +* you will be able to set all settings and save them to a file. +* +* Example of usage for some options: +* amx_statscfg on SayTop15 +* amx_statscfg on SayRank +* +* Accept able are also parts of name: +* amx_statscfg off say +* amx_statscfg on End +*/ + +#include +#include +#include + +public EndPlayer // displays player stats at the end of map +public EndTop15 // displays top15 at the end of map + +public SayStatsAll // displays players stats and rank +public SayTop15 // displays first 15. players ,cvar dodstats_topvalue really:) +public SayRank // displays user position in rank +public SayStatsMe // displays user stats + +public ShowAttackers // shows attackers +public ShowVictims // shows victims +public ShowKiller // shows killer +public KillerHp // displays killer hp to victim console and screen +public SayHP // displays information about user killer +public SayFF // displays friendly fire status + +public MultiKill +public MultiKillSound +public KnifeKill +public KnifeKillSound +public GrenadeKill +public GrenadeSuicide +public HeadShotKill +public HeadShotKillSound +public KillingStreak +public KillingStreakSound +public DoubleKill +public DoubleKillSound +public BulletDamage +public TAInfo +public RoundScore +public EndRoundStats +public GreCatch +public GreCatchSound +public EnemyGreKill +public EnemyGreKillSound +public LeadSounds +public MortarKill + +new g_streakKills[33][2] +new g_multiKills[33][2] +new Float:g_prevKill +new g_prevKillerId +new g_KillCount; +new g_RoundScore[2] + +new g_userPosition[33] +new g_userState[33] +new g_userPlayers[33][32] +new g_Buffer[2048] + +new g_Killers[33][3] +new Float:g_DeathStats[33] + +new g_bodyParts[8][] = { + "WHOLEBODY", + "HEAD", + "CHEST", + "STOMACH", + "LEFTARM", + "RIGHTARM", + "LEFTLEG", + "RIGHTLEG" +} +new g_MultiKillMsg[7][] = { + "MULTI_MSG", + "ULTRA_MSG", + "SPREE_MSG", + "RAMPAGE_MSG" , + "UNSTOPPABLE_MSG" , + "MONSTER_MSG", + "GODLIKE_MSG" +} +new g_Sounds[7][] = { + "multikill", + "ultrakill", + "killingspree", + "rampage", + "unstoppable", + "monsterkill", + "godlike" +} +new g_KillingMsg[7][] = { + "MULTI_SMALL", + "ULTRA_SMALL", + "SPREE_SMALL", + "RAMPAGE_SMALL", + "UNSTOPPABLE_SMALL", + "MONSTER_SMALL", + "GODLIKE_SMALL" +} +new g_KnifeMsg[4][] = { + "KNIFE_MSG1", + "KNIFE_MSG2", + "KNIFE_MSG3", + "KNIFE_MSG4" +} +new g_HeMessages[4][] = { + "HE_MSG1", + "HE_MSG2", + "HE_MSG3", + "HE_MSG4" +} +new g_SHeMessages[4][] = { + "SHE_MSG1", + "SHE_MSG2", + "SHE_MSG3", + "SHE_MSG4" +} +new g_HeadShots[7][] = { + "HEAD_MSG1", + "HEAD_MSG2", + "HEAD_MSG3", + "HEAD_MSG4", + "HEAD_MSG5", + "HEAD_MSG6", + "HEAD_MSG7" +} + +new g_DoubleKillMsg[3][] = { + "DOUBLE_MSG1", + "DOUBLE_MSG2", + "DOUBLE_MSG3" +} + +new g_DoubleKillSound[3][] = { + "doublekill", + "multikill", + "godlike" +} + +new mortarmsg[2][]={ + "MORTAR_MSG1", + "MORTAR_MSG2" +} + +new g_addStast[] = "amx_statscfg add ^"%s^" %s" +new g_disabledMsg[] = "DISABLED_MSG" +new g_htmlFile[64] +new g_htmlDir[64] + +public plugin_init() { + register_plugin("DoD Stats","0.20dod","SidLuke") + + register_dictionary("common.txt") + register_dictionary("stats_dod.txt") + + register_event("30","eInterMission","a") + register_event("ResetHUD","eResetHud","b") + + register_event("RoundState","round_end","a","1=3","1=4") + register_event("RoundState","show_score","a","1=1") + register_event("CurWeapon","NadeCatch","b","1=1","2=15","2=16") + register_event("ObjScore","get_score","a") + + register_clcmd("say /hp","cmdKiller",0,"- displays info. about your killer") + register_clcmd("say /stats","cmdStats",0,"- displays others stats") + register_clcmd("say /statsme","cmdStatsMe",0,"- displays your stats") + register_clcmd("say /top15","cmdTop15",0,"- displays top 15 players") + register_clcmd("say /top10","cmdTop15",0,"- displays top 15 players") // for statsme users :) + register_clcmd("say /topx","cmdTop15",0,"- displays top X players") + register_clcmd("say /rank","cmdRank",0,"- displays your server stats") + register_clcmd("say /ff","cmdFF",0,"- displays friendly fire status") + + register_cvar("dodstats_topvalue","15") + register_cvar("dodstats_maxmenupos","7") + register_cvar("dodstats_statstime","5.0") + + register_statsfwd(XMF_DAMAGE) + register_statsfwd(XMF_DEATH) + + register_menucmd(register_menuid("Server Stats"),1023,"actionStatsMenu") + + get_datadir(g_htmlDir,63) + +} + +public plugin_cfg(){ + server_cmd(g_addStast,"Stats at the end of map","EndPlayer") + server_cmd(g_addStast,"Top15 at the end of map","EndTop15") + server_cmd(g_addStast,"Say /stats","SayStatsAll") + server_cmd(g_addStast,"Say /top15","SayTop15") + server_cmd(g_addStast,"Say /rank","SayRank") + server_cmd(g_addStast,"Say /statsme","SayStatsMe") + server_cmd(g_addStast,"Show Attackers","ShowAttackers") + server_cmd(g_addStast,"Show Victims","ShowVictims") + server_cmd(g_addStast,"Show killer","ShowKiller") + server_cmd(g_addStast,"Show killer hp","KillerHp") + server_cmd(g_addStast,"Say /hp","SayHP") + server_cmd(g_addStast,"Say /ff","SayFF") + + server_cmd(g_addStast,"MultiKill","MultiKill") + server_cmd(g_addStast,"MultiKill Sound","MultiKillSound") + server_cmd(g_addStast,"Knife Kill","KnifeKill") + server_cmd(g_addStast,"Knife Kill Sound","KnifeKillSound") + server_cmd(g_addStast,"Grenade Kill","GrenadeKill") + server_cmd(g_addStast,"Grenade Suicide","GrenadeSuicide") + server_cmd(g_addStast,"HeadShot Kill","HeadShotKill") + server_cmd(g_addStast,"HeadShot Kill Sound","HeadShotKillSound") + server_cmd(g_addStast,"Killing Streak","KillingStreak") + server_cmd(g_addStast,"Killing Streak Sound","KillingStreakSound") + server_cmd(g_addStast,"Double Kill","DoubleKill") + server_cmd(g_addStast,"Double Kill Sound","DoubleKillSound") + server_cmd(g_addStast,"Bullet Damage","BulletDamage") + server_cmd(g_addStast,"TA/TK Info","TAInfo") + server_cmd(g_addStast,"Round Score","RoundScore") + server_cmd(g_addStast,"End Round Stats","EndRoundStats") + server_cmd(g_addStast,"Grenade Catch","GreCatch") + server_cmd(g_addStast,"Grenade Catch Sound","GreCatchSound") + server_cmd(g_addStast,"Enemy Grenade Kill","EnemyGreKill") + server_cmd(g_addStast,"Enemy Grenade Kill Sound","EnemyGreKillSound") + server_cmd(g_addStast,"Lead Sounds","LeadSounds") + server_cmd(g_addStast,"Mortar Kill","MortarKill") +} + +public cmdFF(id){ + if ( !SayFF ){ + client_print(id,print_chat,"%L",id,g_disabledMsg ) + return PLUGIN_HANDLED + } + client_print( 0, print_chat,"%L^t%L",LANG_PLAYER,"FFIRE_IS",LANG_PLAYER, ( get_cvar_num( "mp_friendlyfire" ) ) ? "ON" : "OFF" ) + return PLUGIN_CONTINUE +} + +public cmdStatsMe(id){ + if ( !SayStatsMe || !isDSMActive() ){ + client_print(id,print_chat,"%L",id,g_disabledMsg ) + return PLUGIN_HANDLED + } + displayStats_steam(id,id) + return PLUGIN_CONTINUE +} + +displayStats_steam(id,dest) { + new name[32], stats[9], body[8] + get_user_wstats(id,0,stats,body) + + format(g_htmlFile,63,"%s/%d.htm",g_htmlDir,dest) + + delete_file(g_htmlFile) + + copy(g_Buffer,2047,"
")
+
+ write_file(g_htmlFile,g_Buffer,-1)
+
+ format(g_Buffer,2047,"",
+               dest,"M_KILLS",dest,"M_DEATHS",dest,"M_SCORE",dest,"M_TKS",dest,"M_HITS",dest,"M_SHOTS",dest,"M_HS")
+
+ write_file(g_htmlFile,g_Buffer,-1) 
+
+ format(g_Buffer,2047,"
%L
%L
%L
%L
%L
%L
%L
%d
%d
%d
%d
%d
%d
%d



",stats[0],stats[1],stats[7],stats[3],stats[5],stats[4],stats[2]) + + write_file(g_htmlFile,g_Buffer,-1) + + format(g_Buffer,2047,"", + dest,"M_WEAPON",dest,"M_SHOTS",dest,"M_HITS",dest,"M_DAMAGE",dest,"M_KILLS",dest,"M_DEATHS") + + write_file(g_htmlFile,g_Buffer,-1) + + for(new a = 1; a < DODMAX_WEAPONS; ++a) { + if (get_user_wstats(id,a,stats,body)){ + if ( xmod_is_melee_wpn(a) ) + stats[4] = -1; + xmod_get_wpnname(a,name,31) + format(g_Buffer,2047,"^n",name,stats[4],stats[5],stats[6],stats[0],stats[1]) + + write_file(g_htmlFile,g_Buffer,-1) + } + } + copy(g_Buffer,2047,"
%L
%L
%L
%L
%L
%L
%s
%d
%d
%d
%d
%d
") + + write_file(g_htmlFile,g_Buffer,-1) + + get_user_name(id,name,31) + link_html_motd(dest,name) +} + +public cmdRank(id){ + if ( !SayRank || !isDSMActive() ){ + client_print(id,print_chat,"%L",id,g_disabledMsg ) + return PLUGIN_HANDLED + } + displayRank_steam(id,id) + + return PLUGIN_CONTINUE +} + +displayRank_steam(id,dest) { + new name[32], stats[9], body[8] + new rank_pos = get_user_stats(id,stats,body) + + format(g_htmlFile,63,"%s/%d.htm",g_htmlDir,dest) + + delete_file(g_htmlFile) + + copy(g_Buffer,2047,"
")
+
+ write_file(g_htmlFile,g_Buffer,-1)
+
+ format(g_Buffer,2047,
+               "",dest,"M_KILLS",dest,"M_DEATHS",dest,"M_SCORE",dest,"M_TKS",dest,"M_HITS",dest,"M_SHOTS",dest,"M_HS")
+
+ write_file(g_htmlFile,g_Buffer,-1)
+
+ format(g_Buffer,2047,
+               "
%L%L%L%L%L%L%L
%d%d%d%d%d%d%d


", + stats[0],stats[1],stats[7],stats[3],stats[5],stats[4],stats[2]) + + write_file(g_htmlFile,g_Buffer,-1) + + format(g_Buffer,2047,"%L^n%L: %d^n%L: %d^n%L: %d^n%L: %d^n%L: %d^n%L: %d^n%L: %d^n",dest,"M_HITS",dest,g_bodyParts[1],body[1],dest,g_bodyParts[2],body[2],dest,g_bodyParts[3],body[3],dest,g_bodyParts[4],body[4],dest,g_bodyParts[5],body[5],dest,g_bodyParts[6],body[6],dest,g_bodyParts[7],body[7]) + + write_file(g_htmlFile,g_Buffer,-1) + + format(g_Buffer,2047,"%L %d %L %d",dest,(id==dest)?"M_YOUR_RANK_IS":"M_THEIR_RANK_IS", + rank_pos,dest,"M_OF",get_statsnum()) + + write_file(g_htmlFile,g_Buffer,-1) + + format(g_Buffer,2047,"
") + + write_file(g_htmlFile,g_Buffer,-1) + + get_user_name(id,name,31) + + link_html_motd(dest,name) +} + +public cmdTop15(id) { + if ( !SayTop15 || !isDSMActive() ){ + client_print(id,print_chat,"%L",id,g_disabledMsg ) + return PLUGIN_HANDLED + } + + format(g_htmlFile,63,"%s/%d.htm",g_htmlDir,id) + + delete_file(g_htmlFile) + + getTop15_steam(id) + + new g_Top[8] + format(g_Top,7,"%L",id,"TOPX",get_cvar_num("dodstats_topvalue")) + + link_html_motd(id,g_Top) + return PLUGIN_CONTINUE +} + +/* get top 15 */ +getTop15_steam(id){ + new stats[9], body[8], name[32] + copy(g_Buffer,2047,"
")
+
+  write_file(g_htmlFile,g_Buffer,-1)
+
+  format(g_Buffer,2047,"", id,"M_NICK",id,"M_KILLS",id,"M_DEATHS",id,"M_SCORE",id,"M_HS",id,"M_HITS",id,"M_SHOTS",id,"M_HS")
+
+  write_file(g_htmlFile,g_Buffer,-1)
+
+  new imax = get_statsnum()
+  new itmax =  get_cvar_num("dodstats_topvalue")
+  if (imax > itmax ) 
+    imax = itmax
+
+  for(new a = 0; a < imax; ++a){
+    get_stats(a,stats,body,name,31);
+
+    format(g_Buffer,2047,"^n",a+1,name,stats[0],stats[1],stats[7],stats[3],stats[5],stats[4],stats[2])
+    write_file(g_htmlFile,g_Buffer,-1)
+  }
+  format(g_Buffer,2047,"
#
%L
%L
%L
%L
%L
%L
%L
%L
%d.
%s
%d
%d
%d
%d
%d
%d
%d
") + write_file(g_htmlFile,g_Buffer,-1) +} + +public endGameStats(){ + new i + if ( EndPlayer ){ + new players[32], inum + get_players(players,inum) + for(i = 0; i < inum; ++i){ + displayStats_steam(players[i],players[i]) + } + } + else if ( EndTop15 ){ + new players[32], inum + get_players(players,inum) + + new g_Top[8], top = get_cvar_num("dodstats_topvalue") + for(i = 0; i < inum; ++i){ + format(g_Top,15,"%L",i,"TOPX",top) + getTop15_steam(i) + show_motd(players[i],g_Buffer,g_Top) + } + } +} + +public eInterMission() + if ( isDSMActive() ) + set_task(1.0,"endGameStats") + +public cmdStats(id){ + if ( !SayStatsAll || !isDSMActive() ){ + client_print(id,print_chat,"%L",id,g_disabledMsg ) + return PLUGIN_HANDLED + } + showStatsMenu(id,g_userPosition[id]=0) + return PLUGIN_CONTINUE +} + + +/* build list of attackers */ +getAttackers(id) { + new name[32],wpn[32], stats[9],body[8],found=0 + new pos = format(g_Buffer,2047,"%L^n",id,"ATTACKERS") + new amax = get_maxplayers() + for(new a = 1; a <= amax; ++a){ + + if(get_user_astats(id,a,stats,body,wpn,31)){ + found = 1 + if (stats[0]) + format(wpn,31," -- %s",wpn) + else + wpn[0] = 0 + get_user_name(a,name,31) + pos += format(g_Buffer[pos],2047-pos,"%s -- %d %L / %d %L%s^n",name,stats[6],id,"DMG",stats[5],id,"HIT_S",wpn) + } + } + return found + +} + +/* build list of victims */ +getVictims(id) { + new name[32],wpn[32], stats[9],body[8],found=0 + new pos = format(g_Buffer,2047,"%L^n",id,"VICTIMS") + new amax = get_maxplayers() + for(new a = 1; a <= amax; ++a){ + if(get_user_vstats(id,a,stats,body,wpn,31)){ + found = 1 + if (stats[1]) + format(wpn,31," -- %s",wpn) + else + wpn[0] = 0 + get_user_name(a,name,31) + pos += format(g_Buffer[pos],2047-pos,"%s -- %d %L / %d %L%s^n",name,stats[6],id,"DMG",stats[5],id,"HITS",wpn) + } + } + return found +} + +/* build list of hita for AV List */ +getHits(id,killer) { + new stats[9], body[8], pos = 0 + g_Buffer[0] = 0 + get_user_astats(id,killer,stats,body) + for(new a = 1; a < 8; ++a) + if(body[a]) + pos += format(g_Buffer[pos],2047-pos,"%L: %d^n",id,g_bodyParts[a],body[a]) +} + +/* build list of hits for say hp */ +getMyHits(id,killed) { + new name[32], stats[9], body[8], found = 0 + get_user_name(killed,name,31) + new pos = format(g_Buffer,2047,"%L",id,"YOU_HIT",name) + get_user_vstats(id,killed,stats,body) + for(new a = 1; a < 8; ++a){ + if(body[a]){ + found = 1 + pos += format(g_Buffer[pos],2047-pos," %L: %d ",id,g_bodyParts[a],body[a]) + } + } + return found + +} + +public eResetHud( id ) + g_Killers[ id ][0] = 0 + +public cmdKiller(id) { + if ( !SayHP || !isDSMActive() ){ + client_print(id,print_chat,"%L",id,g_disabledMsg ) + return PLUGIN_HANDLED + } + if (g_Killers[id][0]) { + new name[32], stats[9], body[8], wpn[33], mstats[9], mbody[8] + get_user_name(g_Killers[id][0],name,31) + get_user_astats(id,g_Killers[id][0],stats,body,wpn,31) + get_user_vstats(id,g_Killers[id][0],mstats,mbody) + client_print(id,print_chat,"%L",id,"KILL_INFO1", name,wpn,float(g_Killers[id][2]) * 0.0254 ) + client_print(id,print_chat,"%L",id,"KILL_INFO2", stats[6],stats[5], g_Killers[id][1] ) + client_print(id,print_chat,"%L",id,"KILL_INFO3", mstats[6], mstats[5] ) + + if (getMyHits(id,g_Killers[id][0])) client_print(id,print_chat,"%L",id,"KILL_INFO4",g_Buffer) + } + else { + client_print(id,print_chat,"%L",id,"NO_KILLER") + } + return PLUGIN_CONTINUE +} + +public actionStatsMenu(id,key){ + switch(key){ + case 7: { + g_userState[id] = 1 - g_userState[id] + showStatsMenu(id,g_userPosition[id]) + } + case 8: showStatsMenu(id,++g_userPosition[id]) + case 9: showStatsMenu(id,--g_userPosition[id]) + default:{ + new option = g_userPosition[id] * get_cvar_num("dodstats_maxmenupos") + key + new index = g_userPlayers[id][option] + if (is_user_connected(index)){ + if (g_userState[id]){ + displayRank_steam(index,id) + } + else{ + displayStats_steam(index,id) + } + } + showStatsMenu(id,g_userPosition[id]) + } + } + return PLUGIN_HANDLED +} + +showStatsMenu(id,pos){ + if (pos < 0) return PLUGIN_HANDLED + new max_menupos = get_cvar_num("dodstats_maxmenupos") + new menu_body[512], inum, k = 0, start = pos * max_menupos + get_players(g_userPlayers[id],inum) + if (start >= inum) start = pos = g_userPosition[id] = 0 + + new len = format(menu_body,511,"\y%L\R%d/%d^n\w^n",id,"SERVER_STATS",pos + 1,((inum/max_menupos)+((inum%max_menupos)?1:0))) + new name[32], end = start + max_menupos, keys = (1<<9)|(1<<7) + if (end > inum) end = inum + for(new a = start; a < end; ++a){ + get_user_name(g_userPlayers[id][a],name,31) + keys |= (1< get_gametime() ) + continue + show_hudmessage(i,"%L",i,"NADE_CAUGHT",player_name) + } + } + if ( GreCatchSound ) client_cmd(0,"spk misc/impressive") + } + } + return PLUGIN_CONTINUE +} + +public show_score(){ + if ( RoundScore && isDSMActive() ){ + set_hudmessage( 255, 100, 50, -1.0, 0.30, 0, 4.0, 5.0, 0.5, 0.15, 3 ) + show_hudmessage( 0 ,"Allies %d -- %d Axis^n(%d--%d)", g_RoundScore[0] , g_RoundScore[1] , dod_get_team_score(ALLIES) , dod_get_team_score(AXIS) ) + } + return PLUGIN_CONTINUE +} + +public round_end(){ + if ( !isDSMActive() ) + return PLUGIN_CONTINUE + + if ( RoundScore ){ + new result = read_data(1) + g_RoundScore[result-3]++ + } + + if ( !EndRoundStats ) return PLUGIN_CONTINUE + + new g_Buffer2[511], len, players[32], pnum, stats[9],bodyhits[8] + get_players( players , pnum ) + + + new score = 0, kills = 0, hs =0 , damage = 0, hits = 0, who1 = 0, who2 = 0, who3 = 0 + new name1[32],name2[32],name3[32] + + for(new i = 0; i < pnum; ++i){ + get_user_rstats( players[i],stats, bodyhits ) + if ( stats[7] > score ){ + who1 = players[i] + score = stats[7] + + + } + } + for(new i = 0; i < pnum; ++i){ + get_user_rstats( players[i],stats, bodyhits ) + if ( stats[0] > kills ){ + who2 = players[i] + kills = stats[0] + hs = stats[2] + } + } + for(new i = 0; i < pnum; ++i){ + get_user_rstats( players[i],stats, bodyhits ) + if ( stats[6] > damage ){ + who3 = players[i] + hits = stats[5] + damage = stats[6] + } + } + + if ( is_user_connected(who1) ) { + get_user_name( who1, name1, 31 ) + } + if ( is_user_connected(who2) ) { + get_user_name( who2, name2, 31 ) + + } + if ( is_user_connected(who3) ) { + get_user_name( who3, name3, 31 ) + } + + get_players(players,pnum,"c") + for (new i=0;i get_gametime() ) + continue + show_hudmessage(i,"%L",i,"NADE_FAILED",victim_name) + } + + } + + if ( selfKill || TK ) + + return PLUGIN_CONTINUE + + new vorigin[3], korigin[3] + + get_user_origin(victim,vorigin) + get_user_origin(killer,korigin) + g_Killers[victim][0] = killer + g_Killers[victim][1] = get_user_health(killer) + g_Killers[victim][2] = get_distance(vorigin,korigin) + + g_DeathStats[victim] = get_gametime() + statstime + + + if ( ShowKiller && !(!get_cvar_num("dodstats_rankbots") && (is_user_bot(killer) || is_user_bot(killer))) ){ + new stats[9], body[8], wpn[33], mstats[9], mbody[8] + + get_user_astats(victim,killer,stats,body,wpn,31) + get_user_vstats(victim,killer,mstats,mbody) + set_hudmessage(220,80,0,0.05,0.15,0, statstime, 12.0, 1.0, 2.0, 1) + getHits(victim,killer) + show_hudmessage(victim,"%L%L%L%L",victim,"KILL_INFO1",killer_name,wpn,float(g_Killers[victim][2]) * 0.0254, + /*2*/ victim,"KILL_INFO2",stats[6],stats[5],g_Killers[victim][1], + /*3*/ victim,"KILL_INFO3",mstats[6],mstats[5], + /*4*/ victim,"KILL_INFO4",g_Buffer ) + } + + if ( KillerHp ){ + new kmsg[128] + format(kmsg,127,"%L",victim,"STILL_HAS",killer_name,g_Killers[victim][1]) + client_print(victim,print_console,"%s^n",kmsg) + set_hudmessage(255,255,255,0.02,0.9,2, 1.5, 3.0, 0.02, 5.0, 2) + show_hudmessage(victim,kmsg) + } + + if ( KillingStreak || KillingStreakSound ){ + g_streakKills[ killer ][ 0 ]++ + g_streakKills[ killer ][ 1 ] = 0 + new a = g_streakKills[ killer ][ 0 ] - 3 + if ( (a > -1) && !( a % 2 ) ) { + if ( (a >>= 1) > 6 ) a = 6 + if ( KillingStreak ){ + set_hudmessage(0, 100, 255, 0.05, 0.55, 2, 0.02, 6.0, 0.01, 0.1, 3) + for (new i=1;i<=get_maxplayers();i++){ + if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() ) + continue + show_hudmessage(i,"%L",i,g_KillingMsg[ a ], killer_name) + } + } + if ( KillingStreakSound ) client_cmd( 0 , "spk misc/%s" , g_Sounds[ a ] ) + + + } + } + + if ( MultiKill || MultiKillSound ) { + g_multiKills[killer][0]++ + g_multiKills[killer][1] += headshot + new param[2] + param[0] = killer + param[1] = g_multiKills[killer][0] + set_task( 4.0 + float( param[1] ) ,"checkKills",0,param,2) + } + + if ( xmod_is_melee_wpn(wpnindex) && ( KnifeKill || KnifeKillSound ) ){ + if ( KnifeKill ){ + + + set_hudmessage(255, 100, 100, -1.0, 0.15, 1, 6.0, 6.0, 0.5, 0.15, 1) + for (new i=1;i<=get_maxplayers();i++){ + if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() ) + + continue + show_hudmessage(i,"%L",i,g_KnifeMsg[ random_num(0,3) ],killer_name,victim_name) + } + } + if ( KnifeKillSound ) client_cmd(0,"spk misc/humiliation") + } + else if ( grenade ){ + if ( enemygre ){ + if ( EnemyGreKill ){ + set_hudmessage(255, 100, 100, -1.0, 0.15, 1, 6.0, 6.0, 0.5, 0.15, 1) + for (new i=1;i<=get_maxplayers();i++){ + if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() ) + continue + show_hudmessage(i,"%L",LANG_PLAYER,"NADE_MASTER",killer_name) + } + } + if ( EnemyGreKillSound ) client_cmd(0,"spk misc/godlike") + } + else if ( GrenadeKill ){ + set_hudmessage(255, 100, 100, -1.0, 0.15, 1, 6.0, 6.0, 0.5, 0.15, 1) + for (new i=1;i<=get_maxplayers();i++){ + if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() ) + continue + show_hudmessage(i,"%L",i,g_HeMessages[ random_num(0,3)],killer_name,victim_name) + } + } + } + + if ( headshot && (HeadShotKill || HeadShotKillSound) && !xmod_is_melee_wpn(wpnindex) ){ + if ( HeadShotKill ){ + new weapon[32], message[128], players[32], pnum + xmod_get_wpnname(wpnindex,weapon,31) + + get_players(players,pnum,"c") + for (new i=0;i get_gametime() ) + continue + format( message, 127, "%L",players[i],g_HeadShots[ random_num(0,6) ] ) + replace( message, 127 , "$vn", victim_name ) + replace( message, 127 , "$wn", weapon ) + replace( message, 127 , "$kn", killer_name ) + set_hudmessage(100, 100, 255, -1.0, 0.19, 0, 6.0, 6.0, 0.5, 0.15, 1) + show_hudmessage(players[i],message) + } + } + if ( HeadShotKillSound ) client_cmd(0,"spk misc/headshot") + } + + if ( wpnindex == DODW_MORTAR && MortarKill ){ + set_hudmessage(100, 100, 255, -1.0, 0.19, 0, 6.0, 6.0, 0.5, 0.15, 1) + for (new i=1;i<=get_maxplayers();i++){ + if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() ) + continue + show_hudmessage(i,"%L",i,mortarmsg[random_num(0,1)],killer_name,victim_name) + } + } + + if ( DoubleKill || DoubleKillSound ){ + new Float:nowtime = get_gametime() + if ( g_prevKill == nowtime && g_prevKillerId == killer ){ + g_KillCount++ + if ( DoubleKill || DoubleKillSound){ + set_task(0.01,"showDoubleKill") + } + } + else g_KillCount = 1 + + g_prevKill = nowtime + g_prevKillerId = killer + } + + return PLUGIN_CONTINUE +} + +public showDoubleKill(){ + new pos = g_KillCount - 2 + if ( pos > 2 ) pos = 2 + if ( DoubleKill ) { + new name[32] + get_user_name(g_prevKillerId,name,31) + if ( pos == 2 ){ + new kills[3] + num_to_str(g_KillCount,kills,2) + } + set_hudmessage(65, 102, 158, -1.0, 0.25, 0, 6.0, 6.0, 0.5, 0.15, 3) + for (new i=1;i<=get_maxplayers();i++){ + if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() ) + continue + show_hudmessage(i,"%L",i,g_DoubleKillMsg[pos],name,g_KillCount) + } + } + if ( DoubleKillSound ) { + client_cmd(0,"spk misc/%s",g_DoubleKillSound[pos]) + } +} + +public checkKills(param[]){ + new id = param[0] + new a = param[1] + if (a == g_multiKills[id][0]){ + a -= 3 + if ( a > -1 ){ + if ( MultiKill ) { + new name[32] + get_user_name(id,name,31) + set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2) + if ( a > 6 ) a = 6 + for (new i=1;i<=get_maxplayers();i++){ + if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() ) + continue + show_hudmessage(i,"%L",i,g_MultiKillMsg[a],name,g_multiKills[id][0],g_multiKills[id][1]) + } + } + if ( MultiKillSound ) client_cmd(0,"spk misc/%s",g_Sounds[a]) + } + g_multiKills[id] = { 0,0 } + } +} + +/*************** + LeadSounds +****************/ + +new LeaderScore +new NumOfLeaders +new LeaderID +new PScore[33] + +public client_disconnect(id) { + if ( !LeadSounds || isDSMActive() ) return PLUGIN_CONTINUE + if ( PScore[id] == LeaderScore && LeaderScore > 0 ){ + NumOfLeaders -- + PScore[id] = 0 + if ( NumOfLeaders == 0 ){ + LeaderScore = 0 + for ( new i=1; i<33; i++ ) + if ( PScore[i] > LeaderScore ){ + + + LeaderScore = PScore[i] + NumOfLeaders = 1 + LeaderID = i + } + else if ( PScore[i] == LeaderScore ) + NumOfLeaders ++ + + if ( LeaderScore == 0 ) + NumOfLeaders = 0 + else if ( NumOfLeaders == 1 ) + client_cmd( LeaderID,"spk misc/takenlead" ) + else if ( NumOfLeaders > 1 ) + for ( new i=1; i<33; i++ ) + if ( PScore[i] == LeaderScore ) + client_cmd( i,"spk misc/tiedlead") + //else no players on server or have 0 score + } + + else if ( NumOfLeaders == 1 ) + if ( LeaderID != id ){ + client_cmd( LeaderID,"spk misc/takenlead" ) + } + else { + for ( new i=1; i<33; i++ ) + if ( PScore[i] == LeaderScore ) client_cmd( i,"spk misc/takenlead" ) + } + } + else PScore[id] = 0 + return PLUGIN_CONTINUE +} + +public get_score(){ + if ( !LeadSounds || !isDSMActive() ) return PLUGIN_CONTINUE + new PlayerID = read_data(1) + new PlayerScore = read_data(2) + + if ( PlayerScore > PScore[PlayerID] ){ + PScore[PlayerID] = PlayerScore + + + if ( PlayerScore > LeaderScore ){ + if ( NumOfLeaders == 1 ){ + if ( LeaderID != PlayerID ){ + client_cmd( LeaderID,"spk misc/lostlead" ) + client_cmd( PlayerID,"spk misc/takenlead" ) + } + } + else if ( NumOfLeaders > 1 ){ + + for ( new i=1; i<33; i++ ) + if ( PScore[i] == LeaderScore && i != PlayerID ) + client_cmd( i,"spk misc/lostlead" ) + client_cmd( PlayerID,"spk misc/takenlead" ) + } + else if ( NumOfLeaders == 0 ){ // start + for ( new i=1; i<33; i++ ) + if ( i != PlayerID && is_user_connected(i) ) client_cmd( i,"spk misc/lostlead" ) + client_cmd( PlayerID,"spk misc/takenlead" ) + } + + LeaderScore = PlayerScore + LeaderID = PlayerID + NumOfLeaders = 1 + } + else if ( PlayerScore == LeaderScore ){ + if ( NumOfLeaders == 1 ) + client_cmd( LeaderID,"spk misc/tiedlead" ) + client_cmd( PlayerID,"spk misc/tiedlead" ) + NumOfLeaders++ + } + } + return PLUGIN_CONTINUE +} + +new g_BufferSmall[256] +link_html_motd(index,name[]){ + +format(g_BufferSmall,127,"\ +",g_htmlDir,index) + +show_motd(index,g_BufferSmall,name) +} + +isDSMActive(){ + if ( get_cvar_num("dodstats_pause") ) + return 0 + return 1 +} + +public plugin_modules() +{ + require_module("dodx") +} diff --git a/plugins/dod/stats_logging.sma b/plugins/dod/stats_logging.sma new file mode 100755 index 00000000..98a3ca66 --- /dev/null +++ b/plugins/dod/stats_logging.sma @@ -0,0 +1,66 @@ +/* AMX Mod script. (Feb 4th, 2003) + * + * Stats Logging + * by JustinHoMi + * + */ + +#include +#include + +new g_pingSum[33] +new g_pingCount[33] + +public plugin_init() + register_plugin("Stats Logging","0.20dod","AMXX Dev Team") + +public client_disconnect(id) { + if ( is_user_bot( id ) || !isDSMActive() ) return PLUGIN_CONTINUE + remove_task( id ) + new szTeam[16],szName[32],szAuthid[32], iStats[9], iHits[8], szWeapon[16] + new iUserid = get_user_userid( id ) + get_user_info(id,"team", szTeam, 15 ) + szTeam[0] -= 32; + get_user_name(id, szName ,31 ) + get_user_authid(id, szAuthid , 31 ) + for(new i = 1 ; i < DODMAX_WEAPONS; ++i ) { + if( get_user_wstats( id , i ,iStats , iHits ) ) { + xmod_get_wpnlogname( i , szWeapon , 15 ) + log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^") (score ^"%d^")", + szName,iUserid,szAuthid,szTeam,szWeapon,iStats[4],iStats[5],iStats[0], iStats[2],iStats[3],iStats[6],iStats[1],iStats[7]) + log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats2^" (weapon ^"%s^") (head ^"%d^") (chest ^"%d^") (stomach ^"%d^") (leftarm ^"%d^") (rightarm ^"%d^") (leftleg ^"%d^") (rightleg ^"%d^")", + szName,iUserid,szAuthid,szTeam,szWeapon,iHits[1],iHits[2],iHits[3], iHits[4],iHits[5],iHits[6],iHits[7]) + } + } + new iTime = get_user_time( id , 1 ) + log_message("^"%s<%d><%s><%s>^" triggered ^"time^" (time ^"%d:%02d^")", + szName,iUserid,szAuthid,szTeam, (iTime / 60), (iTime % 60) ) + log_message("^"%s<%d><%s><%s>^" triggered ^"latency^" (ping ^"%d^")", + szName,iUserid,szAuthid,szTeam, (g_pingSum[id] / ( g_pingCount[id] ? g_pingCount[id] : 1 ) ) ) + return PLUGIN_CONTINUE +} + +public client_putinserver(id) { + if ( !is_user_bot( id ) ){ + g_pingSum[ id ] = g_pingCount[ id ] = 0 + set_task( 19.5 , "getPing" , id , "" , 0 , "b" ) + } +} + +public getPing( id ) { + new iPing, iLoss + get_user_ping( id , iPing, iLoss) + g_pingSum[ id ] += iPing + ++g_pingCount[ id ] +} + +isDSMActive(){ + if ( get_cvar_num("dodstats_pause") ) + return 0 + return 1 +} + +public plugin_modules() +{ + require_module("dodx") +} diff --git a/plugins/dod/statssounds.sma b/plugins/dod/statssounds.sma new file mode 100755 index 00000000..978e6c7d --- /dev/null +++ b/plugins/dod/statssounds.sma @@ -0,0 +1,29 @@ +/* +* Plugin for sounds precache +*/ + +#include + +public plugin_precache(){ + precache_sound( "misc/impressive.wav") + precache_sound( "misc/headshot.wav") + precache_sound( "misc/multikill.wav") + precache_sound( "misc/doublekill.wav") + precache_sound( "misc/godlike.wav") + precache_sound( "misc/ultrakill.wav") + precache_sound( "misc/killingspree.wav") + precache_sound( "misc/rampage.wav") + precache_sound( "misc/unstoppable.wav") + precache_sound( "misc/monsterkill.wav") + precache_sound( "misc/humiliation.wav") + + precache_sound( "misc/takenlead.wav" ) + precache_sound( "misc/tiedlead.wav" ) + precache_sound( "misc/lostlead.wav" ) + + return PLUGIN_CONTINUE +} + +public plugin_init() { + register_plugin("DoD Sounds Precache","0.20dod","SidLuke") +} \ No newline at end of file