| ConnorMcLeod |
08-13-2010 21:45 |
Re: Death Pre
Last version has more features.
PHP Code:
/* Formatright © 2009, ConnorMcLeod
Hide T Frags 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.
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 Hide T Frags; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <amxmodx> #include <cstrike>
new const VERSION[] = "0.1.0"
const MAX_PLAYERS = 32
enum /*_:DeathMsg_Structure*/ { DeathMsg_KillerID = 1, // byte DeathMsg_VictimID, // byte DeathMsg_IsHeadshot, // byte DeathMsg_TruncatedWeaponName // string }
new g_iMaxPlayers #define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
new g_pCvarHideType new g_iDeathMsg
public plugin_init() { register_plugin("Hide T Frags", VERSION, "ConnorMcLeod")
g_pCvarHideType = register_cvar("jb_hide_te_frags", "1") // 0:inactive, 1:hide killer, 2:hide frag
g_iDeathMsg = get_user_msgid("DeathMsg") register_message(g_iDeathMsg, "Message_DeathMsg")
g_iMaxPlayers = get_maxplayers() }
public Message_DeathMsg() { new KillerID = get_msg_arg_int( DeathMsg_KillerID ) if( IsPlayer( KillerID ) && cs_get_user_team( KillerID ) == CS_TEAM_T ) { switch( get_pcvar_num( g_pCvarHideType ) ) { case 1: { set_msg_arg_int(DeathMsg_KillerID, ARG_BYTE, get_msg_arg_int( DeathMsg_VictimID )) } case 2: { return PLUGIN_HANDLED } case 3: { new iPlayers[MAX_PLAYERS], iNum, id, szTruncatedWeaponName[16] get_players(iPlayers, iNum, "h") get_msg_arg_string(DeathMsg_TruncatedWeaponName, szTruncatedWeaponName, charsmax(szTruncatedWeaponName)) for(new i; i<iNum; i++) { id = iPlayers[i] if( cs_get_user_team(id) == CS_TEAM_T ) { emessage_begin(MSG_ONE, g_iDeathMsg, .player=id) { ewrite_byte(KillerID) ewrite_byte( get_msg_arg_int( DeathMsg_VictimID ) ) ewrite_byte( get_msg_arg_int( DeathMsg_IsHeadshot ) ) ewrite_string(szTruncatedWeaponName) } emessage_end() } } return PLUGIN_HANDLED } } } return PLUGIN_CONTINUE }
|