Raised This Month: $ Target: $400
 0% 

How to remove HUD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-16-2012 , 13:00   How to remove HUD
Reply With Quote #1

How to Remove Hud Message using /say command?
Randomize is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-16-2012 , 13:01   Re: How to remove HUD
Reply With Quote #2

What hudmessage?
__________________
<VeCo> is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-16-2012 , 13:04   Re: How to remove HUD
Reply With Quote #3

PHP Code:
//Crosshair Type
//Special thanks to <VeCo>

#include <amxmodx>
#include <engine>

#define PLUGIN "Crosshair Type"
#define VERSION "1.1"
#define AUTHOR "DavidJr"

// *restricted* sniper weapons
#define SNIPER_WEAPONS (1 << CSW_AWP | 1 << CSW_SCOUT | 1 << CSW_G3SG1 | 1 << CSW_SG550)
 
new sync
public plugin_init() {
    
register_plugin("PLUGIN","VERSION","DavidJr")
    
sync CreateHudSyncObj() // HUD sync object
 
    
new ent create_entity("info_target")
    
entity_set_string(ent,EV_SZ_classname,"dot_crosshair"// classname
    
entity_set_float(ent,EV_FL_nextthink,get_gametime() + 1.0// think every second
    
    //console command
    
register_concmd("show_menu_ch","cmd_show_menu_ch")
    
    
//thinking entity
    
register_think("cross_crosshair","cross_crosshair_think"// call "cross_crosshair_think" function on think
    
register_think("dot_crosshair","dot_crosshair_think"// call "dot_crosshair_think" function on think
    
register_think("round_crosshair","round_crosshair_think"// call "round_crosshair_think" function on think
}
 
public 
cross_crosshair_think(ent// entity thinks...
{
    
entity_set_float(ent,EV_FL_nextthink,get_gametime() + 1.0// continue thinking every second
 
    
if(!get_playersnum()) return // server is empty, there's no need to show HUD messages...
 
    
static players[32],numi,id
    get_players
(players,num,"a"// get all alive players in the server
 
    
for(i=0;i<num;i++) // loop trough them...
    
{
        
id players[i// store player index in a more convenient variable
 
        
if(<< get_user_weapon(id) & SNIPER_WEAPONS) continue // if this player is holding a sniper - continue with the next player
 
        // else, show the HUD message...
 
        
set_hudmessage(02550, -1.0, -1.0,  .holdtime 1.0// skip default values
        
ShowSyncHudMsg(id,sync"+"// show crosshair HUD
    
}
}  
public 
dot_crosshair_think(ent// entity thinks...
{
    
entity_set_float(ent,EV_FL_nextthink,get_gametime() + 1.0// continue thinking every second
 
    
if(!get_playersnum()) return // server is empty, there's no need to show HUD messages...
 
    
static players[32],numi,id
    get_players
(players,num,"a"// get all alive players in the server
 
    
for(i=0;i<num;i++) // loop trough them...
    
{
        
id players[i// store player index in a more convenient variable
 
        
if(<< get_user_weapon(id) & SNIPER_WEAPONS) continue // if this player is holding a sniper - continue with the next player
 
        // else, show the HUD message...
 
        
set_hudmessage(02550, -1.0, -1.0,  .holdtime 1.0// skip default values
        
ShowSyncHudMsg(id,sync"*"// show crosshair HUD
    
}
}  
public 
round_crosshair_think(ent// entity thinks...
{
    
entity_set_float(ent,EV_FL_nextthink,get_gametime() + 1.0// continue thinking every second
 
    
if(!get_playersnum()) return // server is empty, there's no need to show HUD messages...
 
    
static players[32],numi,id
    get_players
(players,num,"a"// get all alive players in the server
 
    
for(i=0;i<num;i++) // loop trough them...
    
{
        
id players[i// store player index in a more convenient variable
 
        
if(<< get_user_weapon(id) & SNIPER_WEAPONS) continue // if this player is holding a sniper - continue with the next player
 
        // else, show the HUD message...
 
        
set_hudmessage(02550, -1.0, -1.0,  .holdtime 1.0// skip default values
        
ShowSyncHudMsg(id,sync"o"// show crosshair HUD
    
}
}  
// Show Menu CH
public cmd_show_menu_ch(id)
{
    new 
menu menu_create("\yChoose Crosshair Type""menu_crosshair")
    
menu_additem(menu"Cross +""1"0)
    
menu_additem(menu"Dot *""2"0)
    
menu_additem(menu"Round o""3"0)
    
// Add more Options if you wish
    
    
menu_display(idmenu0)
}
// Menu CH
public menu_crosshair(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64], accesscallback
    menu_item_getinfo
(menuitemaccessdata5iName63callback)
    
    switch(
str_to_num(data))
    {
        case 
1register_concmd(cross,"cross_crosshair")
        case 
2register_concmd(cross,"dot_crosshair")
        case 
3register_concmd(cross,"round_crosshair")
        
// Add more Options if you wish
    
}
    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED

I have give the menu but when i select it, the hud doesn't want to change

forget this:
case 1: register_concmd(cross,"cross_crosshair")
case 2: register_concmd(cross,"dot_crosshair")
case 3: register_concmd(cross,"round_crosshair")

it's slow hack part

Last edited by Randomize; 05-16-2012 at 13:08. Reason: remove slow hack part
Randomize is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-16-2012 , 13:06   Re: How to remove HUD
Reply With Quote #4

Don't use "bind", that's slowhacking.

Use only 1 entity with only 1 think and make a variable for the crosshair symbol...
__________________
<VeCo> is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-16-2012 , 13:09   Re: How to remove HUD
Reply With Quote #5

okay.. how? can i hook it like this? http://forums.alliedmods.net/showthr...ght=remove+hud

Last edited by Randomize; 05-16-2012 at 13:10.
Randomize is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-16-2012 , 13:45   Re: How to remove HUD
Reply With Quote #6

Make a global variable like:

PHP Code:
new user_crosshair_type[33
Then change this:

PHP Code:
 menu_additem(menu"Cross +""1"0)
menu_additem(menu"Dot *""2"0)
menu_additem(menu"Round o""3"0
To this:

PHP Code:
 menu_additem(menu"Cross +""43"0// actually this 0 is set by default, you don't need to write it
menu_additem(menu"Dot *""42"0)
menu_additem(menu"Round o""111"0
Then change this:

PHP Code:
 switch(str_to_num(data))
{
case 
1register_concmd(cross,"cross_crosshair")
case 
2register_concmd(cross,"dot_crosshair")
case 
3register_concmd(cross,"round_crosshair")
// Add more Options if you wish

To this:

PHP Code:
user_crosshair_type[id] = str_to_num(data
Then change this:

PHP Code:
 set_hudmessage(02550, -1.0, -1.0, .holdtime 1.0// skip default values
ShowSyncHudMsg(id,sync"o"// show crosshair HUD 
To this

PHP Code:
 set_hudmessage(02550, -1.0, -1.0, .holdtime 1.0// skip default values
ShowSyncHudMsg(id,sync"%c",user_crosshair_type[id]) // show crosshair HUD 
And add:

PHP Code:
public client_connect(iduser_crosshair_type[id] = 111 // default crosshair is "o" 

So here is how does it works:

We set the "info" of the crosshair menu options as numbers 43, 42, 111. These numbers are actually character indexes that represent a character. In our case these are the indexes of the crosshair HUD characters - "+", "*" and "o".
When we select an option, the menu passes the "info" parameter of menu_additem to the "data" string in the menu handler. So, now we can set the selected character to the "user_crosshair_type" variable to store the user HUD crosshair character.
Then when we display the HUD message, we use "%c", which gets a character index and transfers it to a character. We get that index from our user_crosshair_type variable, so every player will see his own selected HUD crosshair.
On client connect we set the default HUD character for the player - that's 111 or the "o" character.

Here I made a simple program that displays the character ID by given character.
I also attached the source code (compiled with DEV C++), ready to use .exe file is in the bin folder. (That's not a virus, lol)
Attached Files
File Type: zip Character Index Displayer.zip (262.2 KB, 63 views)
__________________
<VeCo> is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-16-2012 , 13:50   Re: How to remove HUD
Reply With Quote #7

wew.. thank you so much dude btw, what is cid? I'll try the code tomorrow,
Randomize is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-16-2012 , 20:14   Re: How to remove HUD
Reply With Quote #8

Quote:
Originally Posted by Randomize View Post
wew.. thank you so much dude btw, what is cid? I'll try the code tomorrow,
cid is your command ID. I odn't really know what its for.....i just do what i'm told.
Liverwiz is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-16-2012 , 20:29   Re: How to remove HUD
Reply With Quote #9

Quote:
Originally Posted by Liverwiz View Post
cid is your command ID. I odn't really know what its for.....i just do what i'm told.
I know it it's for user_crosshair_type[id]
Randomize is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-16-2012 , 19:55   Re: How to remove HUD
Reply With Quote #10

I got 2 Warnings notice when compiled it
Randomize 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 00:28.


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