Add anti toxic bomb ability into gas mask

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
truex_88
Извън линия
Foreigner
Foreigner
Мнения: 33
Регистриран на: 18 Мар 2019, 18:33
Се отблагодари: 11 пъти

Add anti toxic bomb ability into gas mask

Мнение от truex_88 » 18 Мар 2019, 18:41

could you put it in the GasMask, anti toxic bomb ability? currently only infection grenade protects it. Thank you :)


GAS MASK SMA:

Код за потвърждение: Избери целия код

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

	#include < zp50_core >
	#include < zp50_items >
	
#define _MarkPlayerHasMask(%0)   _bitPlayerHasMask |= (1 << (%0 & 31))
#define _ClearPlayerWithMask(%0)  _bitPlayerHasMask &= ~(1 << (%0 & 31))
#define _PlayerHasMask(%0)       _bitPlayerHasMask & (1 << (%0 & 31))
	
#define _PLUGIN   "[ZP50] Extra item: Gas Mask"
#define _VERSION             "3.0"
#define _AUTHOR           "H.RED.ZONE"

#define EV_INT_nadetype     EV_INT_flTimeStepSound
#define NADETYPE_INFECTION  1111 

new _ItemID

new _bitPlayerHasMask

new _gMaxPlayers, _gIcon, _gMsgSayText

public plugin_init() {
	register_plugin( _PLUGIN, _VERSION, _AUTHOR )
	
	RegisterHam( Ham_Spawn, "player", "_FW_PlayerSpawn", 1 )
	RegisterHam( Ham_Killed, "player", "_FW_PlayerKilled" )
		
	_ItemID = zp_items_register( "Gas Mask", 30 )
	
	_gMaxPlayers = get_maxplayers( )
	_gIcon = get_user_msgid( "StatusIcon" ) 
	_gMsgSayText = get_user_msgid( "SayText" )
}

public plugin_precache() {
	RegisterHam( Ham_Think, "grenade", "_FW_ThinkGrenade", 1 ) 
}

public zp_fw_items_select_post( plr, itemid, ignorecost ) {
        
	if( itemid == _ItemID ) {
		_MarkPlayerHasMask( plr )
		Icon_On( plr )
		ProtoChat(plr, "You now have Gas Mask.")
	}
}

public zp_fw_items_select_pre( plr, itemid ) {
	
	if( itemid == _ItemID ) {
		
		if( zp_core_is_zombie(plr) ) return ZP_ITEM_DONT_SHOW
		
		return ZP_ITEM_AVAILABLE
	}
	return ZP_ITEM_AVAILABLE;
}

public _FW_ThinkGrenade( iEnt ) {
	
	if( is_valid_ent(iEnt) ) {
		
		if( entity_get_int(iEnt, EV_INT_nadetype) == NADETYPE_INFECTION ) {
			
			for( new plr = 1; plr <= _gMaxPlayers; plr++ ) {
				
				if( is_user_alive(plr) 
				
				&& _PlayerHasMask(plr) ) {
					
					if( get_entity_distance(iEnt, plr) <= 240 ) {
						
						_ClearPlayerWithMask( plr )
						remove_entity( iEnt )
						Icon_Off( plr )
						
						ProtoChat( plr, "Infect nade is removed, you don't have mask anymore." )
					}
				}
			}
		}
	}
}

public zp_fw_core_infect( plr ) {
	_ClearPlayerWithMask( plr ) 
	Icon_Off( plr )
}

public _FW_PlayerSpawn( plr ) {
	_ClearPlayerWithMask( plr ) 
	Icon_Off( plr )
}

public _FW_PlayerKilled( plr ) {
	_ClearPlayerWithMask( plr ) 
	Icon_Off( plr )
}

public client_disconnect( plr ) {
	Icon_Off( plr )
}

public Icon_On( plr ) {
	message_begin( MSG_ONE_UNRELIABLE, _gIcon, { 0, 0, 0 }, plr );
	write_byte( 1 )
	write_string( "dmg_gas" )
	write_byte( 0 )
	write_byte( 255 )
	write_byte( 0 )
	message_end( )
}

public Icon_Off( plr ) {
	message_begin( MSG_ONE_UNRELIABLE, _gIcon, { 0, 0, 0 }, plr )
	write_byte( 0 )
	write_string( "dmg_gas" )
	write_byte( 0 )
	write_byte( 255 )
	write_byte( 0 )
	message_end( )
}

ProtoChat( plr, const sFormat[], any:... ) {
	
	static i; i = plr ? plr : get_player( )
	
	if ( !i ) {
		return PLUGIN_HANDLED;
	}
	
	new sMessage[ 256 ]
	new len = formatex( sMessage, 255, "^x01[^x04ZP^x01] ")
	
	vformat( sMessage[len], 255-len, sFormat, 3 )
	sMessage[ 192 ] = '^0' 
	
	Make_SayText( plr, i, sMessage )
	
	return PLUGIN_CONTINUE
}

get_player( ) {
	for ( new plr; plr <= _gMaxPlayers; plr++ ) {
		if ( is_user_connected(plr) ) {
			return plr
		}
	}
	return PLUGIN_HANDLED
}

Make_SayText( Receiver, Sender, sMessage[] ) {
	if ( !Sender ) {
		return PLUGIN_HANDLED;
	}
	
	message_begin( Receiver ? MSG_ONE_UNRELIABLE : MSG_ALL, _gMsgSayText, {0,0,0}, Receiver )
	write_byte( Sender )
	write_string( sMessage )
	message_end( )
	
	return PLUGIN_CONTINUE;
}

TOXIC BOMB SMA:

Код за потвърждение: Избери целия код

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_util>

#define PLUGIN "[ZP] Toxic Bomb"
#define VERSION "0.1"
#define AUTHOR "Chrescoe1"

//#define public_test

#if !defined public_test
	#include <zombieplague>
#endif

#define weapon "weapon_smokegrenade"
#define standart_wmodel "models/w_smokegrenade.mdl"

new bool:g_has_bomb[33]
const Float:next_think=0.65
const Float:damage_radius=220.0
const Float:gas_damage=8.8
const think_to_delete = 20
const SmokeCount = 15

new const v_grenade_model[]="models/v_zombibomb_bd-s.mdl"
new const p_grenade_model[]="models/p_zombibomb_bd.mdl"
new const w_grenade_model[]="models/w_zombibomb_bd.mdl"
new const bomb_classname[]="zp_toxic_bomb"
new const gas_classname[]="Toxic_Gas"
new gSmoke,Gibs_Model

public plugin_precache()
{
	precache_model(v_grenade_model)
	precache_model(p_grenade_model)
	precache_model(w_grenade_model)
	gSmoke= precache_model("sprites/gas_puff_01g.spr")
	Gibs_Model=precache_model("models/woodgibs.mdl")
}
#if !defined public_test
new zp_new_item
#endif
public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_forward(FM_SetModel, "fw_SetModel")
	register_forward(FM_Touch, "fw_Touch")
	
	RegisterHam(Ham_Think, "info_target", "Ham_Gas_Think")
	RegisterHam(Ham_Item_Deploy, weapon, "fw_Item_Deploy_Post", 1)
	
	#if !defined public_test
		zp_new_item= zp_register_extra_item("Toxic Bomb", 5, ZP_TEAM_ZOMBIE)
	#else
		register_clcmd("say /tb","get_toxicbnomb")
	#endif
}
public fw_Item_Deploy_Post(ent)
{
	static id; id = fm_cs_get_weapon_ent_owner(ent)
	if (pev_valid(id))
	if(g_has_bomb[id])
	{
		set_pev(id, pev_viewmodel2, v_grenade_model)
		set_pev(id, pev_weaponmodel2, p_grenade_model)
	}
}
#if !defined public_test
public zp_extra_item_selected(id,itemid)
{
	if(itemid == zp_new_item)
	{
		if(g_has_bomb[id])
		{
			client_print(id,print_chat,"Error! You have this item!")
			return ZP_PLUGIN_HANDLED
		}
		else get_toxicbnomb(id)
	}
	return PLUGIN_HANDLED
}
#endif
public get_toxicbnomb(id)g_has_bomb[id]=true,fm_give_item(id, weapon)
public client_connect(id)g_has_bomb[id]=false
public zp_user_humanized_post(id,survivor)g_has_bomb[id]=false
public fw_SetModel(ent, const Model[])
{
	if(!pev_valid(ent))return FMRES_IGNORED
	if(equal(Model, standart_wmodel))
	{
		static id; id = pev(ent, pev_owner)
		if(g_has_bomb[id])
		#if !defined public_test
		if(zp_get_user_zombie(id))
		#endif
		{
			set_pev(ent, pev_classname, bomb_classname)	
			set_pev(ent, pev_dmgtime, 9999999.0)
			engfunc(EngFunc_SetModel, ent, w_grenade_model)
			
			g_has_bomb[id]=false
			return FMRES_SUPERCEDE
		}
	}
	return FMRES_IGNORED	
}
public fw_Touch(ent, touch)
{
	if(!pev_valid(ent))return HAM_IGNORED
		
	static Classname[32]; pev(ent, pev_classname, Classname, sizeof(Classname))
	if(equal(Classname, bomb_classname))
	{
		static Float:Origin[3]
		pev(ent, pev_origin, Origin)
		set_pev(ent,pev_iuser1,1)
		
		static Entity_Gas
		Entity_Gas = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
		engfunc(EngFunc_SetOrigin, Entity_Gas, Origin)
		set_pev(Entity_Gas, pev_classname, gas_classname)
		set_pev(Entity_Gas, pev_solid, SOLID_NOT)
		set_pev(Entity_Gas, pev_movetype, MOVETYPE_NONE)
		set_pev(Entity_Gas, pev_takedamage, 0.0)
		set_pev(Entity_Gas, pev_deadflag, DEAD_NO)
		set_pev(Entity_Gas, pev_nextthink, get_gametime() + 0.01)
		set_pev(Entity_Gas,pev_owner,pev(ent,pev_owner))
		
		message_begin(MSG_BROADCAST,SVC_TEMPENTITY); 
		write_byte(TE_BREAKMODEL); // TE_
		engfunc(EngFunc_WriteCoord, Origin[0])
		engfunc(EngFunc_WriteCoord, Origin[1])
		engfunc(EngFunc_WriteCoord, Origin[2]+24.0)
		write_coord(14); // size X
		write_coord(14); // size Y
		write_coord(14); // size Z
		write_coord(random_num(-50,50)); // velocity X
		write_coord(random_num(-50,50)); // velocity Y
		write_coord(25); // velocity Z
		write_byte(10); // random velocity
		write_short(Gibs_Model); // sprite
		write_byte(20); // count
		write_byte(15); // life
		write_byte(0x08); // flags
		message_end(); 
		
		engfunc(EngFunc_RemoveEntity, ent)
		
		return HAM_SUPERCEDE
	}
	return HAM_IGNORED
}
public Ham_Gas_Think(ent)
{
	if(!pev_valid(ent))return
	static Classname[32];pev(ent, pev_classname, Classname, sizeof(Classname))
	if(equal(Classname, gas_classname))
	{
		static owner,Float:origin[3],victim
		owner = pev(ent,pev_owner)
		pev(ent,pev_origin,origin)
		victim=-1
		while((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, damage_radius)) != 0)
		{
			if(is_user_connected(victim))
			if (is_user_alive(victim))
			#if !defined public_test
			if (!zp_get_user_zombie(victim))
			#endif
			{
				#if !defined public_test
				if(pev(victim,pev_health)>gas_damage)ExecuteHamB(Ham_TakeDamage, victim,ent, 0, gas_damage, DMG_NERVEGAS);
				else
				#endif
				ExecuteHamB(Ham_TakeDamage, victim, ent, owner, gas_damage, DMG_NERVEGAS)
				ScreenFade(victim,1,0,125,0,125)
			}
		}
		engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
		write_byte(TE_FIREFIELD);
		engfunc(EngFunc_WriteCoord,origin[0])
		engfunc(EngFunc_WriteCoord,origin[1])
		engfunc(EngFunc_WriteCoord,origin[2]+50)
		write_short(floatround(damage_radius/2))//radius
		write_short(gSmoke )
		write_byte(SmokeCount)	//Count
		write_byte(TEFIRE_FLAG_ALPHA | TEFIRE_FLAG_SOMEFLOAT | TEFIRE_FLAG_LOOP );
		write_byte(25)	//duration in sec
		message_end()
		
		set_pev(ent,pev_iuser2,pev(ent,pev_iuser2)+1)
		if(pev(ent,pev_iuser2)>think_to_delete)engfunc(EngFunc_RemoveEntity, ent)
		else set_pev(ent,pev_nextthink,get_gametime()+next_think)
	}
}
//Stocks
stock ScreenFade(id, Timer, Colors1, Colors2, Colors3, Alpha)
{
	if(!is_user_connected(id)) return
	
	message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), _, id);
	write_short((1<<12) * Timer)
	write_short( 14<<18 )
	write_short( 2<<2 )	
	write_byte(Colors1)
	write_byte(Colors2)
	write_byte(Colors3)
	write_byte(Alpha)
	message_end()
}
stock fm_cs_get_weapon_ent_owner(ent)
{
	if(pev_valid(ent)!= 2)return -1
	return get_pdata_cbase(ent, 41, 4)
}

Аватар
<VeCo>
Извън линия
AMXX Скриптър
AMXX Скриптър
Мнения: 145
Регистриран на: 28 Яну 2019, 19:01
Се отблагодари: 11 пъти
Получена благодарност: 80 пъти
Обратна връзка:

Add anti toxic bomb ability into gas mask

Мнение от <VeCo> » 18 Мар 2019, 19:07

Add after

Код за потвърждение: Избери целия код

set_pev(ent, pev_dmgtime, 9999999.0)
this

Код за потвърждение: Избери целия код

set_pev(ent, pev_flTimeStepSound, 1111)
:pepo_think3:

Аватар
truex_88
Извън линия
Foreigner
Foreigner
Мнения: 33
Регистриран на: 18 Мар 2019, 18:33
Се отблагодари: 11 пъти

Add anti toxic bomb ability into gas mask

Мнение от truex_88 » 18 Мар 2019, 19:31

if they are thrown directly at me, toxic bomb deleted. but if the grenade explodes, and I go through the smoke, I get the damage

Added in 4 minutes 14 seconds:
he could do it be possible to explode the grenade in any case, but I wouldn't get any damage if I had a gas mask?
I'm sorry for my bad English.

Аватар
<VeCo>
Извън линия
AMXX Скриптър
AMXX Скриптър
Мнения: 145
Регистриран на: 28 Яну 2019, 19:01
Се отблагодари: 11 пъти
Получена благодарност: 80 пъти
Обратна връзка:

Add anti toxic bomb ability into gas mask

Мнение от <VeCo> » 18 Мар 2019, 19:38

ok, ignore what I told you before
try this

Код за потвърждение: Избери целия код

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

#include < zp50_core >
#include < zp50_items >

#define _MarkPlayerHasMask(%0) _bitPlayerHasMask |= (1 << (%0 & 31))
#define _ClearPlayerWithMask(%0) _bitPlayerHasMask &= ~(1 << (%0 & 31))
#define _PlayerHasMask(%0) _bitPlayerHasMask & (1 << (%0 & 31))

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

#define EV_INT_nadetype EV_INT_flTimeStepSound
#define NADETYPE_INFECTION 1111 

new _ItemID

new _bitPlayerHasMask

new _gMaxPlayers, _gIcon, _gMsgSayText

public plugin_init() {
register_plugin( _PLUGIN, _VERSION, _AUTHOR )

RegisterHam( Ham_Spawn, "player", "_FW_PlayerSpawn", 1 )
RegisterHam( Ham_Killed, "player", "_FW_PlayerKilled" )
RegisterHam( Ham_TakeDamage, "player", "_FW_PlayerTakeDamage" )

_ItemID = zp_items_register( "Gas Mask", 30 )

_gMaxPlayers = get_maxplayers( )
_gIcon = get_user_msgid( "StatusIcon" ) 
_gMsgSayText = get_user_msgid( "SayText" )
}

public plugin_precache() {
RegisterHam( Ham_Think, "grenade", "_FW_ThinkGrenade", 1 ) 
}

public zp_fw_items_select_post( plr, itemid, ignorecost ) {

if( itemid == _ItemID ) {
_MarkPlayerHasMask( plr )
Icon_On( plr )
ProtoChat(plr, "You now have Gas Mask.")
}
}

public zp_fw_items_select_pre( plr, itemid ) {

if( itemid == _ItemID ) {

if( zp_core_is_zombie(plr) ) return ZP_ITEM_DONT_SHOW

return ZP_ITEM_AVAILABLE
}
return ZP_ITEM_AVAILABLE;
}

public _FW_ThinkGrenade( iEnt ) {

if( is_valid_ent(iEnt) ) {

if( entity_get_int(iEnt, EV_INT_nadetype) == NADETYPE_INFECTION ) {

for( new plr = 1; plr <= _gMaxPlayers; plr++ ) {

if( is_user_alive(plr) 

&& _PlayerHasMask(plr) ) {

if( get_entity_distance(iEnt, plr) <= 240 ) {

_ClearPlayerWithMask( plr )
remove_entity( iEnt )
Icon_Off( plr )

ProtoChat( plr, "Infect nade is removed, you don't have mask anymore." )
}
}
}
}
}
}

public zp_fw_core_infect( plr ) {
_ClearPlayerWithMask( plr ) 
Icon_Off( plr )
}

public _FW_PlayerSpawn( plr ) {
_ClearPlayerWithMask( plr ) 
Icon_Off( plr )
}

public _FW_PlayerKilled( plr ) {
_ClearPlayerWithMask( plr ) 
Icon_Off( plr )
}

public _FW_PlayerTakeDamage( plr, infl, atk, Float:dmg, dmg_bits ) {
return ( is_user_alive(plr) 

&& _PlayerHasMask(plr) 
&& dmg_bits == DMG_NERVEGAS) ? HAM_SUPERCEDE : HAM_IGNORED
}

public client_disconnect( plr ) {
Icon_Off( plr )
}

public Icon_On( plr ) {
message_begin( MSG_ONE_UNRELIABLE, _gIcon, { 0, 0, 0 }, plr );
write_byte( 1 )
write_string( "dmg_gas" )
write_byte( 0 )
write_byte( 255 )
write_byte( 0 )
message_end( )
}

public Icon_Off( plr ) {
message_begin( MSG_ONE_UNRELIABLE, _gIcon, { 0, 0, 0 }, plr )
write_byte( 0 )
write_string( "dmg_gas" )
write_byte( 0 )
write_byte( 255 )
write_byte( 0 )
message_end( )
}

ProtoChat( plr, const sFormat[], any:... ) {

static i; i = plr ? plr : get_player( )

if ( !i ) {
return PLUGIN_HANDLED;
}

new sMessage[ 256 ]
new len = formatex( sMessage, 255, "^x01[^x04ZP^x01] ")

vformat( sMessage[len], 255-len, sFormat, 3 )
sMessage[ 192 ] = '^0' 

Make_SayText( plr, i, sMessage )

return PLUGIN_CONTINUE
}

get_player( ) {
for ( new plr; plr <= _gMaxPlayers; plr++ ) {
if ( is_user_connected(plr) ) {
return plr
}
}
return PLUGIN_HANDLED
}

Make_SayText( Receiver, Sender, sMessage[] ) {
if ( !Sender ) {
return PLUGIN_HANDLED;
}

message_begin( Receiver ? MSG_ONE_UNRELIABLE : MSG_ALL, _gMsgSayText, {0,0,0}, Receiver )
write_byte( Sender )
write_string( sMessage )
message_end( )

return PLUGIN_CONTINUE;
}
:pepo_think3:

Аватар
truex_88
Извън линия
Foreigner
Foreigner
Мнения: 33
Регистриран на: 18 Мар 2019, 18:33
Се отблагодари: 11 пъти

Add anti toxic bomb ability into gas mask

Мнение от truex_88 » 18 Мар 2019, 19:52

Perfect. Thanks bro! :)

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: Bing [Bot] и 19 госта