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

Subplugin Submission [ZP] Extra Item: Gas Mask


Post New Thread Reply   
 
Thread Tools Display Modes
z0mb1el0v3r
Senior Member
Join Date: May 2011
Old 06-01-2013 , 15:23   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #91

Sorry bumping, but can someone remake this plugin limit for single player?
Also remove the [1/9000+] thing..

z0mb1el0v3r is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 06-01-2013 , 16:50   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #92

Try..

PHP Code:
/*

                           [ZP] Anti Infect Bomb 
                            - other name - 
                               Gas Mask

    Description: 
    [   Removes bombs that is thrown at zombie        ] 
    [   (it will remove everything in range of 150)   ]

    Credits to : 
    [     AmineKyo     ]
    [    Nick Haldem   ]
    [     Excalibur    ]
    [      micapat     ]
    [       Y060N      ]
    
    Version : 
    [2.2 - Final modifying]
*/

#include < amxmodx >
#include < hamsandwich >
#include < engine >

#include <zp50_core>
#include <zp50_items>
#include <zp50_ammopacks>

#define _PLUGIN   "[ZP50] Extra item: Gas Mask"
#define _VERSION             "2.2"
#define _AUTHOR           "H.RED.ZONE"

#define _MarkPlayerInMask(%0)   _bitPlayerInMask |= (1 << (%0 & 31))
#define _ClearPlayerInMask(%0)  _bitPlayerInMask &= ~(1 << (%0 & 31))
#define _IsPlayerInMask(%0)     _bitPlayerInMask & (1 << (%0 & 31))

#define _MarkPlayerConnected(%0)  _bitPlayerConnected |= (1 << (%0 & 31))
#define _ClearPlayerConnected(%0) _bitPlayerConnected &= ~(1 << (%0 & 31))
#define _IsPlayerConnected(%0)    _bitPlayerConnected & (1 << (%0 & 31))

#define _MarkPlayerAlive(%0)  _bitPlayerAlive |= (1 << (%0 & 31))
#define _ClearPlayerAlive(%0) _bitPlayerAlive &= ~(1 << (%0 & 31))
#define _IsPlayerAlive(%0)    _bitPlayerAlive & (1 << (%0 & 31))

#define EV_INT_nadetype     EV_INT_flTimeStepSound
#define NADETYPE_INFECTION  1111 

#define COST   20           // Item Cost

new g_itemid_buyremoverh
new g_icon 

new _pcvar_range
    
,_pcvar_after_remove
    
,_pcvar_prefix
    
,_pcvar_limit
    
new _bitPlayerInMask
    
,_bitPlayerAlive
    
,_bitPlayerConnected

new g_MsgSayText
    
,g_MaxPlayers
    
,g_Limit[33]
    
new const 
plr_command[][] = {
    
"say /mask",
    
"say_team /mask"    
}    
    
public 
plugin_init() {
    
register_plugin_PLUGIN_VERSION_AUTHOR )
    
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn")
    
RegisterHam(Ham_Think"grenade""fw_ThinkGrenade"1)
    
    
g_itemid_buyremoverh zp_items_register("Gas Mask" COST)
    
    
register_event"HLTV""NewRound""a""1=0""2=0" )
  
    for ( new 
IndexIndex sizeof plr_commandIndex++)
        
register_clcmd(plr_command[Index], "buy_mask")
  
    
_pcvar_range register_cvar"zp_gas_remover_range""200" )
    
_pcvar_after_remove register_cvar"zp_gas_remover_after""1" )
    
_pcvar_prefix register_cvar("zp_gas_mask_prefix""Mask")
    
_pcvar_limit register_cvar("zp_gas_mask_limit""1")
    
    
g_MsgSayText get_user_msgid("SayText");
    
g_MaxPlayers get_maxplayers()
    
g_icon get_user_msgid("StatusIcon"
}

public 
zp_fw_items_select_pre(iditemid
{
    if (
itemid == g_itemid_buyremoverh
        {
        if (
zp_core_is_zombie(id))
            return 
ZP_ITEM_DONT_SHOW;
        
        if ( 
g_Limit[id] >= get_pcvar_num _pcvar_limit ) )
            return 
ZP_ITEM_NOT_AVAILABLE;
        
        return 
ZP_ITEM_AVAILABLE;
    }
    return 
ZP_ITEM_AVAILABLE;
}

public 
zp_fw_items_select_post(plritemidignorecost)
{
        if (
itemid == g_itemid_buyremoverh
        {
        
_MarkPlayerInMaskplr )
        
ProtoChat(plr"You now have Gas Mask.")
        
Icon_On(plr)
        
g_Limit[plr]++
        }
}  

public 
buy_mask(id) {
    new 
AmmoPacks zp_ammopacks_get(id)
    
    if( 
AmmoPacks COST) {
        
_MarkPlayerInMask(id)
        
zp_ammopacks_set(idAmmoPacks COST);
        
g_Limit[id]++
    }
    else {
        
ProtoChat(id"You can't buy^x04 Gas Mask^x01 now.")
    }    
}

public 
fw_ThinkGrenadeentity ) {
    if( 
is_valid_ententity ) && entity_get_intentityEV_INT_nadetype ) == NADETYPE_INFECTION  ) { 
        new 
_cvar_range get_pcvar_num_pcvar_range 
        new 
_cvar_after_remove get_pcvar_num_pcvar_after_remove )
        
        for( new 
id id <= g_MaxPlayers id++ ) {
            if( 
_IsPlayerAliveid ) && _IsPlayerInMaskid )) {
                            if( 
get_entity_distanceentityid ) <= _cvar_range ) {
                                
remove_entityentity )
                        
                                if( 
_cvar_after_remove ) {
                                        
_ClearPlayerInMaskid )
                            
                                        
Icon_Off(id)    
                                        
ProtoChat(id"Infect nade is removed, you don't have mask anymore.")
                                }
                            }
                    }
                }
        }
    return 
HAM_IGNORED;
}  

public 
NewRound() 
{

     for ( new 
plrplr <= g_MaxPlayersplr++) 
    {
    
_bitPlayerInMask 0
    g_Limit
[plr] = 0
    
}
}

public 
client_connectplr )
{
    
_MarkPlayerConnectedplr )    
}

public 
client_disconnectplr 
{
    
_ClearPlayerConnectedplr )
    
Icon_Offplr )    
}

public 
zp_user_infected_postid )
{
    
_ClearPlayerInMaskid )
    
Icon_Offid )    
}

public 
zp_user_infected_preid 
{
    
_ClearPlayerInMaskid )
    
Icon_Offid )    


public 
Icon_On(plr) {
    
message_beginMSG_ONE_UNRELIABLEg_icon, { 00}, plr );
    
write_byte);
    
write_string"dmg_gas" );
    
write_byte);
    
write_byte255 );
    
write_byte);
    
message_end( );
}
    
public 
Icon_Off(plr) {
    
message_beginMSG_ONE_UNRELIABLEg_icon, { 00}, plr );
    
write_byte);
    
write_string"dmg_gas" );
    
write_byte);
    
write_byte255 );
    
write_byte);
    
message_end( );
}
    
public 
fw_PlayerKilled(plrattackershouldgib) {
    if(
_IsPlayerConnected(plr)) {
        
_ClearPlayerAlive(plr)
        
Icon_Off(plr)    
    }
}

public 
fw_PlayerSpawn(plr) {
    if(
_IsPlayerConnected(plr)) {
        
_MarkPlayerAlive(plr)
        
Icon_Off(plr)
    }
}

ProtoChat (plr, const sFormat[], any:...) {
    static 
iplr plr get_player();
    if ( !
) {
        return 
PLUGIN_HANDLED;
    }
    
    new 
sPrefix[16];
    
get_pcvar_string(_pcvar_prefixsPrefix15);
    
    new 
sMessage[256];
    new 
len formatex(sMessage255"^x01[^x04%s^x01] "sPrefix);
    
vformat(sMessage[len], 255-lensFormat3)
    
sMessage[192] = '^0' 
    
    
Make_SayText(plrisMessage)
    
    return 
PLUGIN_CONTINUE;
}

get_player() {
    for ( new 
plrplr <= g_MaxPlayersplr++) {
        if (
_IsPlayerConnected(plr)) {
            return 
plr;
        }
    }
    return 
PLUGIN_HANDLED
}

Make_SayText(ReceiverSendersMessage[]) {
    if (!
Sender) {
        return 
PLUGIN_HANDLED;
    }
    
message_begin(Receiver MSG_ONE_UNRELIABLE MSG_ALLg_MsgSayText, {0,0,0}, Receiver)
    
write_byte(Sender)
    
write_string(sMessage)
    
message_end()
    
    return 
PLUGIN_CONTINUE;

wicho is offline
z0mb1el0v3r
Senior Member
Join Date: May 2011
Old 06-01-2013 , 21:36   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #93

Thx wicho! It work~

However, I have a small problem with it.
When I put the limit more than 1, for example 2, after I bought the 1st one I can still buy the 2nd one while the 1st one is still available with me. Is this a bug or something? Can you make it go transparent after I bought it until I have used the item, then I can buy the second one again?
z0mb1el0v3r is offline
arditjaha
Member
Join Date: Jul 2013
Old 08-12-2013 , 06:25   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #94

Can you add a model from it ? For example like the gasmask from the half life mode paranoia . It will be very realistic
arditjaha is offline
HELGHAST
New Member
Join Date: Feb 2014
Old 02-20-2014 , 06:14   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #95

Quote:
Originally Posted by wicho View Post
Try..

PHP Code:
/*

                           [ZP] Anti Infect Bomb 
                            - other name - 
                               Gas Mask

    Description: 
    [   Removes bombs that is thrown at zombie        ] 
    [   (it will remove everything in range of 150)   ]

    Credits to : 
    [     AmineKyo     ]
    [    Nick Haldem   ]
    [     Excalibur    ]
    [      micapat     ]
    [       Y060N      ]
    
    Version : 
    [2.2 - Final modifying]
*/

#include < amxmodx >
#include < hamsandwich >
#include < engine >

#include <zp50_core>
#include <zp50_items>
#include <zp50_ammopacks>

#define _PLUGIN   "[ZP50] Extra item: Gas Mask"
#define _VERSION             "2.2"
#define _AUTHOR           "H.RED.ZONE"

#define _MarkPlayerInMask(%0)   _bitPlayerInMask |= (1 << (%0 & 31))
#define _ClearPlayerInMask(%0)  _bitPlayerInMask &= ~(1 << (%0 & 31))
#define _IsPlayerInMask(%0)     _bitPlayerInMask & (1 << (%0 & 31))

#define _MarkPlayerConnected(%0)  _bitPlayerConnected |= (1 << (%0 & 31))
#define _ClearPlayerConnected(%0) _bitPlayerConnected &= ~(1 << (%0 & 31))
#define _IsPlayerConnected(%0)    _bitPlayerConnected & (1 << (%0 & 31))

#define _MarkPlayerAlive(%0)  _bitPlayerAlive |= (1 << (%0 & 31))
#define _ClearPlayerAlive(%0) _bitPlayerAlive &= ~(1 << (%0 & 31))
#define _IsPlayerAlive(%0)    _bitPlayerAlive & (1 << (%0 & 31))

#define EV_INT_nadetype     EV_INT_flTimeStepSound
#define NADETYPE_INFECTION  1111 

#define COST   20           // Item Cost

new g_itemid_buyremoverh
new g_icon 

new _pcvar_range
    
,_pcvar_after_remove
    
,_pcvar_prefix
    
,_pcvar_limit
    
new _bitPlayerInMask
    
,_bitPlayerAlive
    
,_bitPlayerConnected

new g_MsgSayText
    
,g_MaxPlayers
    
,g_Limit[33]
    
new const 
plr_command[][] = {
    
"say /mask",
    
"say_team /mask"    
}    
    
public 
plugin_init() {
    
register_plugin_PLUGIN_VERSION_AUTHOR )
    
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn")
    
RegisterHam(Ham_Think"grenade""fw_ThinkGrenade"1)
    
    
g_itemid_buyremoverh zp_items_register("Gas Mask" COST)
    
    
register_event"HLTV""NewRound""a""1=0""2=0" )
  
    for ( new 
IndexIndex sizeof plr_commandIndex++)
        
register_clcmd(plr_command[Index], "buy_mask")
  
    
_pcvar_range register_cvar"zp_gas_remover_range""200" )
    
_pcvar_after_remove register_cvar"zp_gas_remover_after""1" )
    
_pcvar_prefix register_cvar("zp_gas_mask_prefix""Mask")
    
_pcvar_limit register_cvar("zp_gas_mask_limit""1")
    
    
g_MsgSayText get_user_msgid("SayText");
    
g_MaxPlayers get_maxplayers()
    
g_icon get_user_msgid("StatusIcon"
}

public 
zp_fw_items_select_pre(iditemid
{
    if (
itemid == g_itemid_buyremoverh
        {
        if (
zp_core_is_zombie(id))
            return 
ZP_ITEM_DONT_SHOW;
        
        if ( 
g_Limit[id] >= get_pcvar_num _pcvar_limit ) )
            return 
ZP_ITEM_NOT_AVAILABLE;
        
        return 
ZP_ITEM_AVAILABLE;
    }
    return 
ZP_ITEM_AVAILABLE;
}

public 
zp_fw_items_select_post(plritemidignorecost)
{
        if (
itemid == g_itemid_buyremoverh
        {
        
_MarkPlayerInMaskplr )
        
ProtoChat(plr"You now have Gas Mask.")
        
Icon_On(plr)
        
g_Limit[plr]++
        }
}  

public 
buy_mask(id) {
    new 
AmmoPacks zp_ammopacks_get(id)
    
    if( 
AmmoPacks COST) {
        
_MarkPlayerInMask(id)
        
zp_ammopacks_set(idAmmoPacks COST);
        
g_Limit[id]++
    }
    else {
        
ProtoChat(id"You can't buy^x04 Gas Mask^x01 now.")
    }    
}

public 
fw_ThinkGrenadeentity ) {
    if( 
is_valid_ententity ) && entity_get_intentityEV_INT_nadetype ) == NADETYPE_INFECTION  ) { 
        new 
_cvar_range get_pcvar_num_pcvar_range 
        new 
_cvar_after_remove get_pcvar_num_pcvar_after_remove )
        
        for( new 
id id <= g_MaxPlayers id++ ) {
            if( 
_IsPlayerAliveid ) && _IsPlayerInMaskid )) {
                            if( 
get_entity_distanceentityid ) <= _cvar_range ) {
                                
remove_entityentity )
                        
                                if( 
_cvar_after_remove ) {
                                        
_ClearPlayerInMaskid )
                            
                                        
Icon_Off(id)    
                                        
ProtoChat(id"Infect nade is removed, you don't have mask anymore.")
                                }
                            }
                    }
                }
        }
    return 
HAM_IGNORED;
}  

public 
NewRound() 
{

     for ( new 
plrplr <= g_MaxPlayersplr++) 
    {
    
_bitPlayerInMask 0
    g_Limit
[plr] = 0
    
}
}

public 
client_connectplr )
{
    
_MarkPlayerConnectedplr )    
}

public 
client_disconnectplr 
{
    
_ClearPlayerConnectedplr )
    
Icon_Offplr )    
}

public 
zp_user_infected_postid )
{
    
_ClearPlayerInMaskid )
    
Icon_Offid )    
}

public 
zp_user_infected_preid 
{
    
_ClearPlayerInMaskid )
    
Icon_Offid )    


public 
Icon_On(plr) {
    
message_beginMSG_ONE_UNRELIABLEg_icon, { 00}, plr );
    
write_byte);
    
write_string"dmg_gas" );
    
write_byte);
    
write_byte255 );
    
write_byte);
    
message_end( );
}
    
public 
Icon_Off(plr) {
    
message_beginMSG_ONE_UNRELIABLEg_icon, { 00}, plr );
    
write_byte);
    
write_string"dmg_gas" );
    
write_byte);
    
write_byte255 );
    
write_byte);
    
message_end( );
}
    
public 
fw_PlayerKilled(plrattackershouldgib) {
    if(
_IsPlayerConnected(plr)) {
        
_ClearPlayerAlive(plr)
        
Icon_Off(plr)    
    }
}

public 
fw_PlayerSpawn(plr) {
    if(
_IsPlayerConnected(plr)) {
        
_MarkPlayerAlive(plr)
        
Icon_Off(plr)
    }
}

ProtoChat (plr, const sFormat[], any:...) {
    static 
iplr plr get_player();
    if ( !
) {
        return 
PLUGIN_HANDLED;
    }
    
    new 
sPrefix[16];
    
get_pcvar_string(_pcvar_prefixsPrefix15);
    
    new 
sMessage[256];
    new 
len formatex(sMessage255"^x01[^x04%s^x01] "sPrefix);
    
vformat(sMessage[len], 255-lensFormat3)
    
sMessage[192] = '^0' 
    
    
Make_SayText(plrisMessage)
    
    return 
PLUGIN_CONTINUE;
}

get_player() {
    for ( new 
plrplr <= g_MaxPlayersplr++) {
        if (
_IsPlayerConnected(plr)) {
            return 
plr;
        }
    }
    return 
PLUGIN_HANDLED
}

Make_SayText(ReceiverSendersMessage[]) {
    if (!
Sender) {
        return 
PLUGIN_HANDLED;
    }
    
message_begin(Receiver MSG_ONE_UNRELIABLE MSG_ALLg_MsgSayText, {0,0,0}, Receiver)
    
write_byte(Sender)
    
write_string(sMessage)
    
message_end()
    
    return 
PLUGIN_CONTINUE;

I can't compile it to amxx
/tmp/textgNudUe.sma(26) : fatal error 100: cannot read from file: "zp50_core" Compilation aborted. 1 Error.

Any ideas?
HELGHAST is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 02-20-2014 , 13:51   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #96

download zombie_plague 5.0
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 07-24-2014 , 21:34   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #97

I have rewriten this plugin, it was not tested yet.
__________________
H.RED.ZONE is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 08-14-2014 , 01:23   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #98

I test it and work fine, maybe u can add the command again to buy it and the limit..

Last edited by wicho; 08-14-2014 at 01:28.
wicho is offline
New and Clueless
Senior Member
Join Date: Dec 2015
Old 05-11-2016 , 14:35   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #99

Want gas mask to last all round? ZMD done it for me, and if you want the same check out alliedmodders allie website: http://zppv.boards.net/post/8957/thread

Copy/paste the code when you see "for problem 10" - this is the one for gas mask to last all round.
__________________

ANY SCRIPTER ON THIS FORUM HAS FREE VIP/ADMIN IN MY SERVER!
New and Clueless is offline
Reply


Thread Tools
Display Modes

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 07:07.


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