AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Colored icon for c4 (https://forums.alliedmods.net/showthread.php?t=154864)

bibu 04-14-2011 11:55

Colored icon for c4
 
With cs_set_user_defuse, you can select the color of the icon. With c4 not. Is there any other easy way without using StatusIcon and checking for the icon name?

ConnorMcLeod 04-14-2011 13:49

Re: Colored icon for c4
 
You mean with cs_set_user_plant you can't ?
No, there is no easier way.

bibu 04-14-2011 14:54

Re: Colored icon for c4
 
PHP Code:

  cs_set_user_defuse index, [ defusekit 101600icon[] = "defuser"flash ] ) 

PHP Code:

cs_set_user_plant index, [ plant 1showbombicon ] ) 


ConnorMcLeod 04-14-2011 21:05

Re: Colored icon for c4
 
PHP Code:

    RegisterHam(Ham_Spawn"player""CBasePlayer_Spawn_Post"true)
}

public 
CBasePlayer_Spawn_Post(id)
{
    if( 
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T )
    {
        
give_item(id"weapon_c4")
        
cs_set_user_plant_ext(id112552550)
        
cs_set_user_submodel(id1)
    }
}

cs_set_user_plant_ext(indexplant 1showbombicon 1r=0g=160b=0)
{
    if( !
plant || !showbombicon || (!&& !&& g==160) )
    {
        return 
cs_set_user_plant(indexplantshowbombicon)
    }

    if( 
cs_set_user_plant(indexplant0) )
    {
        static 
iStatusIcon 0
        
if( !iStatusIcon )
        {
            
iStatusIcon get_user_msgid("StatusIcon")
        }

        
message_begin(MSG_ONEiStatusIcon, .player=index)
        
write_byte(1// show
        
write_string("c4")
        
write_byte(r)
        
write_byte(g)
        
write_byte(b)
        
message_end()
        return 
1
    
}
    return 
0



bibu 04-15-2011 18:11

Re: Colored icon for c4
 
Thanks, works perfectly. Is "cs_set_user_submodel" needed?

Arkshine 04-15-2011 18:27

Re: Colored icon for c4
 
Yes, to show the bomb on the player.

bibu 04-15-2011 18:28

Re: Colored icon for c4
 
Can't we see it if we just use give_item?

ConnorMcLeod 04-15-2011 18:29

Re: Colored icon for c4
 
I'm not sure if you only see it if nobody else has c4 or if you don't see it at all.
Just set it each time so you are sure it is shown, or set it to 0 if you want to hide bomber ;)

bibu 04-15-2011 19:00

Re: Colored icon for c4
 
Quote:

Originally Posted by ConnorMcLeod (Post 1450893)
I'm not sure if you only see it if nobody else has c4 or if you don't see it at all.
Just set it each time so you are sure it is shown, or set it to 0 if you want to hide bomber ;)

Ok, thanks again.

Hunter-Digital 04-15-2011 23:43

Re: Colored icon for c4
 
Just a curiosity, wouldn't hooking of StatusIcon message be more reliable ? It'll work for cs_set_user_plant() too I belive.


All times are GMT -4. The time now is 20:12.

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