My way is a bit long but I hope this will work
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Author"
new g_Joined[33], g_Connected[33]
new g_maxplayer
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled_Post", 1)
g_maxplayer = get_maxplayers()
}
public client_connect(id)
{
//Safety
g_Joined[id] = 0
}
public client_putinserver(id)
{
//Safety
g_Connected[id] = 1
}
public client_disconnect(id)
{
//Remove when they Disconnect
g_Joined[id] = 0
g_Connected[id] = 0
}
public fw_PlayerSpawn_Post(id)
{
if(!g_Connected[id]) return
//If they spam which mean they are in either CT or TS
g_Joined[id] = 1
}
public fw_PlayerKilled_Post(Victim, Attacker)
{
//If they change team, they will dead. Take g_Joined from them
g_Joined[Victim] = 0
}
public yourfunc(id)
{
for(new i=0; i<g_maxplayer;i++)
{
if(!g_Connected[id]) continue
if(g_Joined[id]) continue
client_print(i, print_chat, "type your message here")
}
}
I am not sure if using DeathMsg is better than killed or not but I usually use Ham_Killed more
__________________