Raised This Month: $ Target: $400
 0% 

User status icon don't disappear when weapon isn't he grenade


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
m0skVi4a
Senior Member
Join Date: May 2011
Location: Rousse, Bulgaria
Old 09-13-2011 , 14:26   User status icon don't disappear when weapon isn't he grenade
Reply With Quote #1

Hello
I have a litle problem that i can't solve...
Here is a code
PHP Code:
public PreThink(id)
{
    new 
clipammo
    
new userweapon get_user_weapon(idclipammo)
        
    if(
userweapon == CSW_HEGRENADE && g_Weapon[id])
    {
        if(!(
pev(id,pev_button) & FL_ONGROUND))
        {    
            
message_begin(MSG_ONE,iconstatus,{0,0,0},id);
            
write_byte(1);
            
write_string("item_healthkit");
            
write_byte(255);
            
write_byte(0); 
            
write_byte(0);
            
message_end();
        }
    }

The problem is that when i change to he grenade the icon show, but after i change to he grenade when i change to other weapon, the icon stil show. I want the icon to show only when user current wepon is he grenade. How can i fixit?

Last edited by m0skVi4a; 09-13-2011 at 14:32.
m0skVi4a is offline
Send a message via Skype™ to m0skVi4a
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 09-13-2011 , 15:03   Re: User status icon don't disappear when weapon isn't he grenade
Reply With Quote #2

A. Don't use prethink for this.
B. Send the message again with the first byte being 0 to remove the icon status.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Stereo
Veteran Member
Join Date: Dec 2010
Old 09-13-2011 , 15:12   Re: User status icon don't disappear when weapon isn't he grenade
Reply With Quote #3

you need register event CurWeapon and check if the weapon is he grenade (with get_user_weapon(index) ) or not
Stereo is offline
m0skVi4a
Senior Member
Join Date: May 2011
Location: Rousse, Bulgaria
Old 09-13-2011 , 15:10   Re: User status icon don't disappear when weapon isn't he grenade
Reply With Quote #4

What to use else prethink
m0skVi4a is offline
Send a message via Skype™ to m0skVi4a
m0skVi4a
Senior Member
Join Date: May 2011
Location: Rousse, Bulgaria
Old 09-13-2011 , 15:14   Re: User status icon don't disappear when weapon isn't he grenade
Reply With Quote #5

PHP Code:
public CurWeapon(id)
{
    new 
clipammo
    
new userweapon get_user_weapon(idclipammo)
        
    if(
userweapon == CSW_HEGRENADE && g_Weapon[id])
    {
        if(!(
pev(id,pev_button) & FL_ONGROUND))
        {    
            
message_begin(MSG_ONE,iconstatus,{0,0,0},id);
            
write_byte(1);
            
write_string("item_healthkit");
            
write_byte(255);
            
write_byte(0); 
            
write_byte(0);
            
message_end();
        }
    }
    else
    {
        if(!(
pev(id,pev_button) & FL_ONGROUND))
        {    
            
message_begin(MSG_ONE,iconstatus,{0,0,0},id);
            
write_byte(0);
            
write_string("item_healthkit");
            
write_byte(255);
            
write_byte(0); 
            
write_byte(0);
            
message_end();
        }
    }    

that?
m0skVi4a is offline
Send a message via Skype™ to m0skVi4a
Stereo
Veteran Member
Join Date: Dec 2010
Old 09-13-2011 , 15:27   Re: User status icon don't disappear when weapon isn't he grenade
Reply With Quote #6

Yes but:

PHP Code:
new clipammo
new userweapon get_user_weapon(idclipammo



PHP Code:
new userweapon get_user_weapon(id
And to hide the icon:


PHP Code:
message_begin(MSG_ONE,iconstatus,{0,0,0},id);
write_byte(0);
write_string("item_healthkit");
write_byte(255); //Unnecessary
write_byte(0); //Unnecessary
write_byte(0); //Unnecessary
message_end(); 
Stereo is offline
m0skVi4a
Senior Member
Join Date: May 2011
Location: Rousse, Bulgaria
Old 09-13-2011 , 15:36   Re: User status icon don't disappear when weapon isn't he grenade
Reply With Quote #7

Yes now work. Because you both help me i've not give any one +karma
m0skVi4a is offline
Send a message via Skype™ to m0skVi4a
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 01:30.


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