View Single Post
Author Message
SAMURAI16
BANNED
Join Date: Sep 2006
Old 03-13-2007 , 09:22   [TUT] User Icon Status
Reply With Quote #1

On this tutorial, I will examplain / show examples about user status icon.
Status icon is a hud icon placed in the screen of player, and is used in some cases for indicates user status.
Can use this for example if an player have on him equip and rocket laucher, to show an icon to indicate that ; it's for aspect ;)

To make to show at a player an hud icon, the icon must be created in a message constant.
Now, let's start:
• First of all, we will declare a variabile for get user msgid. Variable will be called iconstatus.
So,
PHP Code:
new iconstatus 
• In plugin_init, we use variable:
PHP Code:
iconstatus get_user_msgid("StatusIcon"
• Like how i alearly said, we will make to show the status icon with a message constant.
We start with:
PHP Code:
 message_begin(MSG_ONE,iconstatus,{0,0,0},id
• After, we will write a byte with the type of show:
Are available 3 types of show:
0 = Hide
1 = Show
2 = Flash

So we wil use:
PHP Code:
write_byte(1
That means will show the icon status.

• After, will write string the name of sprite icon
Are available 88 icon status.
I maked screenshots where i saw necessary one.

1. dmg_rad:
[IMG]http://img95.**************/img95/5918/dmgradmh4.jpg[/IMG]

2. dmg_heat:
[IMG]http://img178.**************/img178/4803/dmgheatnd4.jpg[/IMG]
3. dmg_gas:
[IMG]http://img72.**************/img72/3686/dmggaser1.jpg[/IMG]

4. dmg_drown:
[IMG]http://img72.**************/img72/6564/dmgdrownps5.jpg[/IMG]

5. dmg_cold:
[IMG]http://img291.**************/img291/7311/dmgcolddw9.jpg[/IMG]

6. dmg_bio:
[IMG]http://img246.**************/img246/9513/dmgbiokb4.jpg[/IMG]

7. dmg_shock:
[IMG]http://img50.**************/img50/8814/dmgshocksh9.jpg[/IMG]


8. item_longjump:
[IMG]http://img59.**************/img59/5223/itemlongjumpyr6.jpg[/IMG]


9. item_battery:
[IMG]http://img62.**************/img62/5586/itembatteryok3.jpg[/IMG]

10. item_healthkit:

11. flash_beam:

12. d_knife:
Also are available all weapons with prefix d_* .Ex: d_ak47, d_awp, d_mp5navy.

13. cross:

14. stopwatch:

15. suit_full:

• I didn't take screenshots to all icons, because rests of them are just lines or stuff like that, and i don't saw any point to use it.
• I used name of icons but without screenshots because limit of images on a thread is 10
• I want to give some credits to Alka because helped me to make last snapshots .

So, we will use
PHP Code:
write_string("sprite name"
• Now we will write the color of icon, in rgb format:
PHP Code:
 write_byte(r)
 
write_byte(b)
 
write_byte(g
• And finnish the message constant
PHP Code:
message_end() 
And complete example, to show an hud icon with icon when user is on air

PHP Code:
#include <amxmodx>
#include <fakemeta>


new iconstatus;

public 
plugin_init() {
    
register_plugin("Status Icon","0.1","SAMURAI");
    
    
register_forward(FM_PlayerPreThink,"fw_prethink");
    
iconstatus get_user_msgid("StatusIcon");
    
}

public 
fw_prethink(id)
{
    if(!(
pev(id,pev_button) & FL_ONGROUND))
    {    
        
message_begin(MSG_ONE,iconstatus,{0,0,0},id);
        
write_byte(1); // status (0=hide, 1=show, 2=flash)
        
write_string("dmg_poison"); // sprite name
        
write_byte(0); // red
        
write_byte(255); // green
        
write_byte(0); // blue
        
message_end();
    }
    

Anyway, i saw some request with list of all incons;
There is..
Code:
selection            
bucket1               
bucket2               
bucket3               
bucket4                
bucket5                
bucket0                
dmg_bio                
dmg_poison           
dmg_chem            
dmg_cold        
dmg_drown            
dmg_heat           
dmg_gas               
dmg_rad                
dmg_shock            
number_0            
number_1            
number_2          
number_3            
number_4            
number_5           
number_6            
number_7            
number_8           
number_9            
divider                
cross                
dollar               
minus                
plus               
c4                
defuser              
stopwatch           
smallskull              
smallc4             
smallvip               
buyzone               
rescue               
escape            
vipsafety            
suit_full            
suit_empty           
suithelmet_full            
suithelmet_empty      
flash_full           
flash_empty            
flash_beam            
train_back          
train_stop            
train_forward1            
train_forward2            
train_forward3          
autoaim_c            
title_half           
title_life            
d_knife                   
d_ak47                  
d_awp                      
d_deagle            
d_flashbang            
d_fiveseven            
d_g3sg1                
d_glock18            
d_grenade            
d_m249               
d_m3                
d_m4a1                
d_mp5navy            
d_p228               
d_p90                
d_scout               
d_sg550               
d_sg552               
d_ump45          
d_usp                
d_tmp                
d_xm1014            
d_skull               
d_tracktrain            
d_aug                    
d_mac10                
d_elite                
d_headshot               
item_battery            
item_healthkit            
item_longjump           
radar


Have fun

Last edited by SAMURAI16; 03-18-2007 at 15:37. Reason: as per the rules, don't post using fonts different than what is normal. fixed.
SAMURAI16 is offline
Send a message via MSN to SAMURAI16