hi everyone
my question is simple...
is the way i have done it ok
to get the spectator with bits ?
code was tested
and it seems to work fine...
thx in advance for taking look at the code
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "vl"
#define SetBits(%1,%2) %1 |= 1<<(%2 & 31)
#define DelBits(%1,%2) %1 &= ~(1<<(%2 & 31))
#define GetBits(%1,%2) %1 & 1<<(%2 & 31)
new g_bIsConnected, g_bIsAlive, g_bIsSpectator
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("SpecHealth2", "ev_SpecHealth2", "bd")
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn", 1)
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled", 1)
}
public client_putinserver(id)
{
DelBits(g_bIsSpectator, id)
DelBits(g_bIsAlive, id)
SetBits(g_bIsConnected, id)
}
public client_disconnect(id)
{
DelBits(g_bIsSpectator, id)
DelBits(g_bIsAlive, id)
DelBits(g_bIsConnected, id)
}
public fw_PlayerSpawn(id)
{
if(is_user_alive(id))
{
SetBits(g_bIsAlive, id)
DelBits(g_bIsSpectator, id)
}
}
public fw_PlayerKilled(id)
{
DelBits(g_bIsAlive, id)
}
public ev_SpecHealth2(id)
{
if(GetBits(g_bIsConnected, id))
{
new target = read_data(2)
if(target != 0)
{
SetBits(g_bIsSpectator, id)
}
}
}
__________________