Can someone tell me if this method of sending a fake death message after zombies are selected by the game is safe? I had tried another method before, but there were zombies on the same team as the humans
PHP Code:
new g_GameModeInfectionID
new g_MsgDeathMsg, g_MsgScoreAttrib
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
g_MsgDeathMsg = get_user_msgid("DeathMsg")
g_MsgScoreAttrib = get_user_msgid("ScoreAttrib")
}
public plugin_cfg()
{
g_GameModeInfectionID = zp_gamemodes_get_id("Infection Mode")
}
public zp_fw_core_infect_post(id, attacker)
{
// Set custom grenade model
new current_mode = zp_gamemodes_get_current()
if (current_mode != g_GameModeInfectionID)
return;
SendDeathMsg(attacker, id)
FixDeadAttrib(id)
}
// Send Death Message for infections
SendDeathMsg(attacker, victim)
{
if(attacker == victim){
message_begin(MSG_BROADCAST, g_MsgDeathMsg)
write_byte(attacker) // killer
write_byte(victim) // victim
write_byte(0) // headshot flag
write_string("teammate") // killer's weapon
message_end()
}
}
// Fix Dead Attrib on scoreboard
FixDeadAttrib(id)
{
message_begin(MSG_BROADCAST, g_MsgScoreAttrib)
write_byte(id) // id
write_byte(0) // attrib
message_end()
}