Raised This Month: $51 Target: $400
 12% 

Subplugin Submission [ZP] Extra Item: Gas Mask


Post New Thread Reply   
 
Thread Tools Display Modes
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 07-12-2012 , 00:45   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #61

PHP Code:
public plugin_init() 
{
        
// ...

    
new entity create_entity"info_target" );
    if( 
entity )
    {
        
register_think"entity_mask""Mask__Think" );
        
entity_set_stringentityEV_SZ_classname"entity_mask" );
        
entity_set_floatentityEV_FL_nextthink5.0 );
    }
}

public 
Mask__Thinkentity )
{
    if( 
get_pcvar_num_pcvar_after_icon_on ) == )
    {
        for( new 
id id <= g_MaxPlayers id++ ) 
        {
            if( 
_IsPlayerAliveid ) && _IsPlayerInMaskid ))
            {
                
message_beginMSG_ONE_UNRELIABLEg_icon, { 00}, id );
                
write_byte_cvar_icon_status );
                
write_string"dmg_gas" );
                
write_byte);
                
write_byte255 );
                
write_byte);
                
message_end( );
            }
        }
    }
    
    
entity_set_floatentityEV_FL_nextthink0.1 ); // Change it maybe, I don't know what's the duration of a icon

__________________

Last edited by micapat; 07-12-2012 at 00:46.
micapat is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 07-12-2012 , 00:50   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #62

Don't you think its to much usage for simple thing?
__________________
H.RED.ZONE is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 07-12-2012 , 00:54   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #63

Nop.
__________________
micapat is offline
Y060N
BANNED
Join Date: Dec 2011
Location: www.equilibriumcs.com
Old 07-12-2012 , 00:58   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #64

So just write the icon message when he buys the gas mask, then when the infection nade is stopped, take away the icon?

PHP Code:
message_beginMSG_ONE_UNRELIABLEg_icon, { 00}, id );
                    
write_byte);
                    
write_string"dmg_gas" );
                    
write_byte);
                    
write_byte255 );
                    
write_byte);
                    
message_end( ); 
when he buys it

and then when you want it off:

PHP Code:
message_beginMSG_ONE_UNRELIABLEg_icon, { 00}, id );
                    
write_byte);
                    
write_string"dmg_gas" );
                    
write_byte);
                    
write_byte);
                    
write_byte);
                    
message_end( ); 
The first byte that you write is the "status". 0 = off, 1 = show/hold, 2 = flash icon

Last edited by Y060N; 07-12-2012 at 01:00.
Y060N is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 07-12-2012 , 01:01   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #65

Nope it will be removed in 5 sec i think. :/
In this plugin we need to use micapat 's method i think it's much but still...
__________________

Last edited by H.RED.ZONE; 07-12-2012 at 01:03.
H.RED.ZONE is offline
Y060N
BANNED
Join Date: Dec 2011
Location: www.equilibriumcs.com
Old 07-12-2012 , 01:03   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #66

Quote:
Originally Posted by H.RED.ZONE View Post
Nope it will be removed in 5 sec i think. :/
In this plugin we need to use micapat 's method i think it's much but still...
I am saying don't use a think entity for this. Just send 1 message to the client when he buys the mask, 1 message when the mask is removed. Way better than registering a think that is happening every 5 seconds.

In regard to your edit, it will not be removed in 5 seconds, I have used this method and it holds the icon until it is removed if you set it to write_byte ( 1 )


PHP Code:
gasmask_iconidrg)
{
    
    
message_beginMSG_ONEgmsgIcon, {0,0,0}, id )
    switch ( 
get_pcvar_num(whatever cvar is called) )
    {
        case 
0:
        
write_byte)
        case 
1:
        
write_byte)
        case 
1:
        
write_byte)
    }
    
write_string"dmg_gas" )
    
write_byte)
    
write_byte)
    
write_byte)
    
message_end()


Last edited by Y060N; 07-12-2012 at 01:23.
Y060N is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 07-12-2012 , 01:04   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #67

It won't work...the message will be removed...
Did you tested it?

In your edit i see you tested it that means i will need to do so too...
__________________

Last edited by H.RED.ZONE; 07-12-2012 at 01:06.
H.RED.ZONE is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 07-12-2012 , 01:07   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #68

http://wiki.amxmodx.org/Half-Life_1_...nts#StatusIcon

Icon can be hold logically with status = 1. You can reduce the code (:
__________________
micapat is offline
Y060N
BANNED
Join Date: Dec 2011
Location: www.equilibriumcs.com
Old 07-12-2012 , 01:08   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #69

Quote:
Originally Posted by H.RED.ZONE View Post
It won't work...the message will be removed...
Did you tested it?
I just edited my post with an example. No think necessary and yes I have tested it. I use a function similar that just calls this:

PHP Code:
gasmask_iconidstatusrg)
{
    
    
message_beginMSG_ONEgmsgIcon, {0,0,0}, id )
    
write_bytestatus )
    
write_string"dmg_gas" )
    
write_byte)
    
write_byte)
    
write_byte)
    
message_end()

And then when I want it on, I call the function with a 1, when I want it off, I call function with status = 0

Edit: You should also just write a changelog and have 1 final version posted, I doubt anyone will want to use an inefficient plugin for fun.

Last edited by Y060N; 07-12-2012 at 01:24.
Y060N is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 07-12-2012 , 01:24   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #70

Updated.
__________________
H.RED.ZONE 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 09:56.


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