Raised This Month: $ Target: $400
 0% 

[Question] spechealth2 and bits


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 04-24-2011 , 04:57   [Question] spechealth2 and bits
Reply With Quote #1

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_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)
        }
    }

__________________

Last edited by vato loco [GE-S]; 04-24-2011 at 05:08.
vato loco [GE-S] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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