// Anubis - King Of The Underworld
/* CVARS - copy and paste to shconfig.cfg
//Anubis
anubis_level 0
anibus_showdamage 1 //(0|1) - hide|show bullet damage..
anibus_showchat 1 //(0|1) - hide|show ghostchat messages..
*/
/*
* v1.17 - JTP10181
* - Added ablily to disable the ghostchat like function
* for servers that already have ghostchat
*/
#include <superheromod>
// GLOBAL VARIABLES
new gHeroID
new const gHeroName[] = "Anubis"
new bool:gHasAnubis[SH_MAXSLOTS+1]
new gmsgSayText, gMsgSync1, gMsgSync2
new gPcvarShowDamage, gPcvarShowChat
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Anubis", SH_VERSION_STR, "AssKicR/JTP10181")
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
new pcvarLevel = register_cvar("anubis_level", "0")
gPcvarShowDamage = register_cvar("anibus_showdamage", "1")
gPcvarShowChat = register_cvar("anibus_showchat", "1")
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
gHeroID = sh_create_hero(gHeroName, pcvarLevel)
sh_set_hero_info(gHeroID, "Dark Notices", "Nothing Is Secret From You. Hear Enemies - See Damage")
// FORWARD
register_forward(FM_Voice_SetClientListening, "_FM_Voice_SetClientListening")
// Say
register_clcmd("say", "handle_say")
register_clcmd("say_team", "handle_say")
gmsgSayText = get_user_msgid("SayText")
gMsgSync1 = CreateHudSyncObj()
gMsgSync2 = CreateHudSyncObj()
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(id, heroID, mode)
{
if ( gHeroID != heroID ) return
gHasAnubis[id] = mode ? true : false
sh_debug_message(id, 1, "%s %s", gHeroName, mode ? "ADDED" : "DROPPED")
}
//----------------------------------------------------------------------------------------------
public _FM_Voice_SetClientListening(iReceiver, iSender, bool:bListen)
{
// Set listen to all only for this client
if ( sh_is_active() && is_user_alive(iReceiver) && gHasAnubis[iReceiver] ) {
engfunc(EngFunc_SetClientListening, iReceiver, iSender, true)
forward_return(FMV_CELL, true)
return FMRES_SUPERCEDE
}
forward_return(FMV_CELL, bListen)
return FMRES_IGNORED
}
//----------------------------------------------------------------------------------------------
public handle_say(id)
{
if ( !sh_is_active() || !is_user_connected(id) || !get_pcvar_num(gPcvarShowChat) ) return
new message[191]
read_argv(1, message, charsmax(message))
if ( message[0] == '^0' || equal(message, "[") ) return
new command[9], players[SH_MAXSLOTS], player_count, user
new teamname[7], idName[32], sMessage[192]
read_argv(0, command, charsmax(command))
new idSayTeam = equal(command, "say_team")
new idAlive = is_user_alive(id)
new CsTeams:idTeam = cs_get_user_team(id)
switch(idTeam) {
case CS_TEAM_T: copy(teamname, charsmax(teamname), "(T)")
case CS_TEAM_CT: copy(teamname, charsmax(teamname), "(CT)")
default: copy(teamname, charsmax(teamname), "(SPEC)")
}
get_user_name(id, idName, charsmax(idName))
formatex(sMessage, charsmax(sMessage), "%c[DN]%s%s%s : %s^n", 2, idSayTeam ? teamname : "", idAlive ? "*ALIVE*" : "*DEAD*", idName, message)
// Get all alive players but skip bots
get_players(players, player_count, "ach")
for ( new i = 0; i < player_count; i++ ) {
user = players[i]
if ( !gHasAnubis[user] ) continue
if ( !idAlive || (idSayTeam && idTeam != cs_get_user_team(user)) ) {
message_begin(MSG_ONE_UNRELIABLE, gmsgSayText, _, user)
write_byte(id)
write_string(sMessage)
message_end()
}
}
}
//----------------------------------------------------------------------------------------------
public client_damage(attacker, victim, damage)
{
if ( !sh_is_active() || !get_pcvar_num(gPcvarShowDamage) ) return
if ( victim == attacker ) return
if ( !is_user_connected(victim) || !is_user_connected(attacker) ) return
if ( gHasAnubis[attacker] ) {
set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 2.0, 0.02, 0.02, -1)
ShowSyncHudMsg(attacker, gMsgSync1, "%d", damage)
}
if ( gHasAnubis[victim] ) {
set_hudmessage(200, 0, 0, -1.0, 0.48, 2, 0.1, 2.0, 0.02, 0.02, -1)
ShowSyncHudMsg(victim, gMsgSync2, "%d", damage)
}
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
gHasAnubis[id] = false
}
//----------------------------------------------------------------------------------------------