Raised This Month: $ Target: $400
 0% 

How to make HUD permanent?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 05-15-2012 , 07:01   Re: How to make HUD permanent?
Reply With Quote #11

Not sure about this, atm I can't test it, also I dont remember the working code, but test it and tell if is working..

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
 
#define PLUGIN "Dot Crosshair"
#define VERSION "1.0"
#define AUTHOR "DavidJr"
 
 
#define TASKID 210
#define UPDATE 0.50
 
 
#define MAX_PLAYERS    32
 
#define HIDEHUD_CROSSHAIR    (1<<6)
 
#define m_iHideHUD                361
 
#define HideWeaponCrosshair(%1)    ( g_iFlags & (1<<%1) )
 
new SyncObj[4]
 
new 
g_iOldWeapon[MAX_PLAYERS+1]
 
new 
g_iFlags
 
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
 
    
//Register Concmd
    
register_concmd("dot_crosshair","ShowCH")
    
register_concmd("weapon_no_crosshair""AdminCommand_Crosshair"ADMIN_CFG" - <flags>")
 
    
//Register Event
    
register_event("CurWeapon""Event_CurWeapon""be""1=1")
    
register_event("ResetHUD""Event_ResetHUD""be")
    
set_task(UPDATE "ShowCH"TASKID__"b")
 
new 
i
for(04i++)
SyncObj[i] = CreateHudSyncObj(1)
 
}
 
public 
ShowCH(id)
{
set_hudmessage(02550, -1.0, -1.00UPDATE+0.10.51.01.0, -1)
ShowSyncHudMsg(idSyncObj[0], ".")
 
}
 
if(
user_has_weapon(idCSW_AWP))
 
new 
i
for(04i++)
ClearSyncHud(idSyncObj[i])
remove_task(TASKID)
 
else if(!
user_has_weapon(idCSW_AWP))
set_task(UPDATE "ShowCH"TASKID__"b")
 
}  
 
 
public 
Event_ResetHUD(id)
{
    
g_iOldWeapon[id] = 0
}
 
public 
Event_CurWeapon(id)
{
    new 
iCurWeapon read_data(2)
    new 
iOldWeapon g_iOldWeapon[id]
 
    if( 
iCurWeapon != iOldWeapon )
    {
        
g_iOldWeapon[id] = iCurWeapon
 
        
if( HideWeaponCrosshair(iCurWeapon) )
        {
            
set_pdata_int(idm_iHideHUDget_pdata_int(idm_iHideHUD) | HIDEHUD_CROSSHAIR)
        }
        else if( 
HideWeaponCrosshairiOldWeapon ) )
        {
            
set_pdata_int(idm_iHideHUDget_pdata_int(idm_iHideHUD) & ~HIDEHUD_CROSSHAIR)
        }
    }
}
 
public 
AdminCommand_Crosshair(idlevelcid)
{
    if( 
cmd_access(idlevelcid2) )
    {
        new 
szFlags[26]
        
read_argv(1szFlagscharsmax(szFlags))
 
        static const 
iWeaponsIds[] = {CSW_P228CSW_HEGRENADECSW_XM1014CSW_C4CSW_MAC10CSW_AUGCSW_SMOKEGRENADE
                                
CSW_ELITECSW_FIVESEVENCSW_UMP45CSW_GALILCSW_FAMASCSW_USPCSW_GLOCK18
                                
CSW_MP5NAVYCSW_M249CSW_M3CSW_M4A1CSW_TMPCSW_FLASHBANGCSW_DEAGLECSW_SG552
                                
CSW_AK47CSW_KNIFECSW_P90}  
 
        new 
icLetteriVal
        g_iFlags 
0
 
        
while( (cLetter szFlags[i++]) )
        {
            
iVal cLetter 'a'
            
if( <= iVal sizeof(iWeaponsIds) )
            {
                
g_iFlags |= (1<<iWeaponsIds[iVal])
            }
        }
    }
    return 
PLUGIN_HANDLED

It may be wrong, so you can trie use code from this plugin.
bazhenov93 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 00:28.


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