AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Question] spechealth2 and bits (https://forums.alliedmods.net/showthread.php?t=155579)

vato loco [GE-S] 04-24-2011 04:57

[Question] spechealth2 and bits
 
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 :wink:

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_bIsConnectedg_bIsAliveg_bIsSpectator

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
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_bIsSpectatorid)
    
DelBits(g_bIsAliveid)
    
SetBits(g_bIsConnectedid)
}

public 
client_disconnect(id)
{
    
DelBits(g_bIsSpectatorid)
    
DelBits(g_bIsAliveid)
    
DelBits(g_bIsConnectedid)
}

public 
fw_PlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        
SetBits(g_bIsAliveid)
        
DelBits(g_bIsSpectatorid)
    }
}

public 
fw_PlayerKilled(id)
{
    
DelBits(g_bIsAliveid)
}

public 
ev_SpecHealth2(id)
{
    if(
GetBits(g_bIsConnectedid))
    {
        new 
target read_data(2)
        
        if(
target != 0)
        {
            
SetBits(g_bIsSpectatorid)
        }
    }




All times are GMT -4. The time now is 19:48.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.