Raised This Month: $ Target: $400
 0% 

Using the plugin with variables


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 06-12-2011 , 11:31   Using the plugin with variables
Reply With Quote #1

I am trying to change this plugin with variables individual for each player. So it doesn't have to use any cvars at all. I created a menu for it and now I need to check the variables. But as the original plugin is with enums, I don't have any idea how I can here check for example for the variable of the player:

PHP Code:
public Event_ResetHUD(id)
{
    if 
//which variable
    
{
           
//do what?
    
}
    if 
//which variable
    
{
           
//do what else?
    
}

The same for "Event_HideWeapon".

Here is the list of the variables and the whole plugin:

PHP Code:
new bool:hud_money[33]
new 
bool:hud_timer[33]
new 
bool:hud_flashlight[33]
new 
bool:hud_radar_hp_ap[33]
new 
bool:hud_crosshair[33]
new 
bool:hud_wpnlist[33
PHP Code:
#include <amxmodx> 
#include <fakemeta>
#include <hamsandwich>

#define VERSION "0.6" 

const HUD_HIDE_CAL 1<<0
const HUD_HIDE_FLASH 1<<1
const HUD_HIDE_ALL 1<<2    
const HUD_HIDE_RHA 1<<3
const HUD_HIDE_TIMER 1<<4
const HUD_HIDE_MONEY 1<<5
const HUD_HIDE_CROSS 1<<6
const HUD_DRAW_CROSS 1<<7

const HIDE_GENERATE_CROSSHAIR HUD_HIDE_FLASH|HUD_HIDE_RHA|HUD_HIDE_TIMER|HUD_HIDE_MONEY|HUD_DRAW_CROSS

#define    m_iHideHUD            361
#define    m_iClientHideHUD        362
#define    m_pClientActiveItem        374

enum _:Hide_Hud {
    
Hide_Cal,
    
Hide_Flash,
    
Hide_All,
    
Hide_Rha,
    
Hide_Timer,
    
Hide_Money,
    
Hide_Cross,
    
Draw_Cross
}

new 
g_bitHudFlags

new g_pCvars[Hide_Hud]

public 
plugin_init() 

    
register_plugin("HUD Customizer"VERSION"Igoreso/ConnorMcLeod"
    
    
g_pCvars[Hide_Cal] = register_cvar("amx_hud_hide_cross_ammo_weaponlist""0")
    
g_pCvars[Hide_Flash] = register_cvar("amx_hud_hide_flashlight""1")
    
g_pCvars[Hide_All] = register_cvar("amx_hud_hide_all""1")
    
g_pCvars[Hide_Rha] = register_cvar("amx_hud_hide_radar_health_armor""1")
    
g_pCvars[Hide_Timer] = register_cvar("amx_hud_hide_timer""1")
    
g_pCvars[Hide_Money] = register_cvar("amx_hud_hide_money""0")
    
g_pCvars[Hide_Cross] = register_cvar("amx_hud_hide_crosshair""0")
    
g_pCvars[Draw_Cross] = register_cvar("amx_hud_draw_crosshair""0")

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")

    
register_event("ResetHUD""Event_ResetHUD""b")
    
register_event("HideWeapon""Event_HideWeapon""b")

    
Event_HLTV_New_Round()
}

public 
Event_HLTV_New_Round()
{
    for(new 
ii<Hide_Hudi++)
    {
        if( 
get_pcvar_numg_pCvars[i] ) )
        {
            
g_bitHudFlags |= 1<<i
        
}
    }
}

public 
Event_ResetHUD(id)
{
    if( 
g_bitHudFlags )
    {
        
set_pdata_int(idm_iClientHideHUD0)
        
set_pdata_int(idm_iHideHUDg_bitHudFlags)
    }    
}

public 
Event_HideWeaponid )
{
    new 
iFlags read_data(1)
    if( 
g_bitHudFlags && (iFlags g_bitHudFlags != g_bitHudFlags) )
    {
        
set_pdata_int(idm_iClientHideHUD0)
        
set_pdata_int(idm_iHideHUDiFlags|g_bitHudFlags)
    }

    if( 
iFlags HIDE_GENERATE_CROSSHAIR && !(g_bitHudFlags HUD_DRAW_CROSS) && is_user_alive(id) )
    {
        
set_pdata_cbase(idm_pClientActiveItemFM_NULLENT)
    }

__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
 



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 23:27.


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