AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   [TUT] User Icon Status (https://forums.alliedmods.net/showthread.php?t=52529)

SAMURAI16 03-13-2007 09:22

[TUT] User Icon Status
 
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

Howdy! 03-13-2007 09:31

Re: [TUT] User Icon Status
 
...

watch 03-13-2007 09:57

Re: [TUT] User Icon Status
 
I know its just an example but it would be better to cache whether the player has been send the message rather than send it over and over. Then when they release attack, remove it. D:

VEN 03-13-2007 10:20

Re: [TUT] User Icon Status
 
Furthermore this may lead to client's overflow.

unikow 03-13-2007 11:56

Re: [TUT] User Icon Status
 
Quote:

Are available 9 icon status.
Where are the last 3???

SAMURAI16 03-13-2007 13:21

Re: [TUT] User Icon Status
 
Quote:

Originally Posted by unikow (Post 452012)
Where are the last 3???

ops, available are 6 ;)

2. Changed the example ;)

Drak 03-13-2007 15:10

Re: [TUT] User Icon Status
 
Wont this only work in CS?

Hawk552 03-13-2007 22:11

Re: [TUT] User Icon Status
 
Quote:

Originally Posted by SixTwin (Post 452073)
Wont this only work in CS?

AFAIK it should work across the board.

sawce 03-13-2007 22:45

Re: [TUT] User Icon Status
 
StatusIcon is not in NS, and if memory serves it's not in DoD either. I'm not too sure aboot that one, though

It's in the standard SDK, so most mods still have it.

Hawk552 03-13-2007 23:07

Re: [TUT] User Icon Status
 
Quote:

Originally Posted by sawce (Post 452216)
StatusIcon is not in NS, and if memory serves it's not in DoD either. I'm not too sure aboot that one, though

It's in the standard SDK, so most mods still have it.

Yeah, but that's because Flayra disables like everything useful and fun.


All times are GMT -4. The time now is 13:44.

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