Raised This Month: $32 Target: $400
 8% 

A human in possession of this item to have glow and aura


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 01-10-2023 , 05:06   A human in possession of this item to have glow and aura
Reply With Quote #1

Hello, would someone show me example codes of how to add glow and aura to the model of a player who is in possession of a extra item in a ZM mod?

For example, i want all humans who possess the following extra item:

Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <zombie_plague_advance>
	
#define _MarkPlayerHasMask(%0)   _bitPlayerHasMask |= (1 << (%0 & 31))
#define _ClearPlayerWithMask(%0)  _bitPlayerHasMask &= ~(1 << (%0 & 31))
#define _PlayerHasMask(%0)       _bitPlayerHasMask & (1 << (%0 & 31))
	
#define _PLUGIN   "[ZP43] 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_register_extra_item( "Anti-Virus Mask \y(\rSingle-Use\y)", 200, ZP_TEAM_HUMAN )
	
	_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_extra_item_selected( plr, itemid ) {
        
	if( itemid == _ItemID ) {
		_MarkPlayerHasMask( plr )
		Icon_On( plr )
		ProtoChat(plr, "You now have Anti-Virus Mask. It will neutralize the effect of 1 infection grenade!")
	}
}

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, "Infection prevented! Your Anti-Virus mask can no longer be used." )
					}
				}
			}
		}
	}
}

public zp_user_infected_post( 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;
}
...to emit glow and aura while having the item. Since the item lasts only for a single round and gets removed when an infection grenade is used on the human, the glow and aura should, too, disappear once the round ends or the gas mask is removed using an infection grenade.

Thanks in advance.

Last edited by GlobalPlague; 01-10-2023 at 09:51.
GlobalPlague is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 01-11-2023 , 07:03   Re: A human in possession of this item to have glow and aura
Reply With Quote #2

apply the glow efect using set_user_rendering when the item is bought and disable it when you want: dying or after using the item, zp user infected pre.

Last edited by lexzor; 01-11-2023 at 07:04.
lexzor is offline
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 01-11-2023 , 16:29   Re: A human in possession of this item to have glow and aura
Reply With Quote #3

Quote:
Originally Posted by lexzor View Post
apply the glow efect using set_user_rendering when the item is bought and disable it when you want: dying or after using the item, zp user infected pre.
The problem is that I don't know how to do it and what code exactly to write.
GlobalPlague is offline
TribalBlood
Member
Join Date: Oct 2020
Old 01-17-2023 , 18:35   Re: A human in possession of this item to have glow and aura
Reply With Quote #4

Quote:
Originally Posted by GlobalPlague View Post
The problem is that I don't know how to do it and what code exactly to write.
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <zombie_plague_advance>
    
#define _MarkPlayerHasMask(%0)   _bitPlayerHasMask |= (1 << (%0 & 31))
#define _ClearPlayerWithMask(%0)  _bitPlayerHasMask &= ~(1 << (%0 & 31))
#define _PlayerHasMask(%0)       _bitPlayerHasMask & (1 << (%0 & 31))
    
#define _PLUGIN   "[ZP43] 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 )
    
    
RegisterHamHam_Spawn"player""_FW_PlayerSpawn")
    
RegisterHamHam_Killed"player""_FW_PlayerKilled" )
        
    
_ItemID zp_register_extra_item"Anti-Virus Mask \y(\rSingle-Use\y)"200ZP_TEAM_HUMAN )
    
    
_gMaxPlayers get_maxplayers( )
    
_gIcon get_user_msgid"StatusIcon" 
    
_gMsgSayText get_user_msgid"SayText" )
}

public 
plugin_precache() {
    
RegisterHamHam_Think"grenade""_FW_ThinkGrenade"
}

public 
zp_extra_item_selectedplritemid ) {
        
    if( 
itemid == _ItemID ) {
        
_MarkPlayerHasMaskplr )
        
Icon_Onplr )
        
set_ent_rendering(plrkRenderFxGlowShell015050kRenderNormal3);
        
ProtoChat(plr"You now have Anti-Virus Mask. It will neutralize the effect of 1 infection grenade!")
    }
}

public 
_FW_ThinkGrenadeiEnt ) {
    
    if( 
is_valid_ent(iEnt) ) {
        
        if( 
entity_get_int(iEntEV_INT_nadetype) == NADETYPE_INFECTION ) {
            
            for( new 
plr 1plr <= _gMaxPlayersplr++ ) {
                
                if( 
is_user_alive(plr
                
                && 
_PlayerHasMask(plr) ) {
                    
                    if( 
get_entity_distance(iEntplr) <= 240 ) {
                        
                        
_ClearPlayerWithMaskplr )
                        
remove_entityiEnt )
                        
Icon_Offplr )
                        
set_ent_rendering(plr);
                        
                        
ProtoChatplr"Infection prevented! Your Anti-Virus mask can no longer be used." )
                    }
                }
            }
        }
    }
}

public 
zp_user_infected_postplr ) {
    
_ClearPlayerWithMaskplr 
    
Icon_Offplr )
    
set_ent_rendering(plr);
}

public 
_FW_PlayerSpawnplr ) {
    
_ClearPlayerWithMaskplr 
    
Icon_Offplr )
    
set_ent_rendering(plr);
}

public 
_FW_PlayerKilledplr ) {
    
_ClearPlayerWithMaskplr 
    
Icon_Offplr )
    
set_ent_rendering(plr);
}

public 
client_disconnectplr ) {
    
Icon_Offplr )
    
set_ent_rendering(plr);
}

public 
Icon_Onplr ) {
    
message_beginMSG_ONE_UNRELIABLE_gIcon, { 00}, plr );
    
write_byte)
    
write_string"dmg_gas" )
    
write_byte)
    
write_byte255 )
    
write_byte)
    
message_end( )
}

public 
Icon_Offplr ) {
    
message_beginMSG_ONE_UNRELIABLE_gIcon, { 00}, plr )
    
write_byte)
    
write_string"dmg_gas" )
    
write_byte)
    
write_byte255 )
    
write_byte)
    
message_end( )
}

ProtoChatplr, const sFormat[], any:... ) {
    
    static 
iplr plr get_player( )
    
    if ( !
) {
        return 
PLUGIN_HANDLED;
    }
    
    new 
sMessage256 ]
    new 
len formatexsMessage255"^x01[^x04ZP^x01] ")
    
    
vformatsMessage[len], 255-lensFormat)
    
sMessage192 ] = '^0' 
    
    
Make_SayTextplrisMessage )
    
    return 
PLUGIN_CONTINUE
}

get_player( ) {
    for ( new 
plrplr <= _gMaxPlayersplr++ ) {
        if ( 
is_user_connected(plr) ) {
            return 
plr
        
}
    }
    return 
PLUGIN_HANDLED
}

Make_SayTextReceiverSendersMessage[] ) {
    if ( !
Sender ) {
        return 
PLUGIN_HANDLED;
    }
    
    
message_beginReceiver MSG_ONE_UNRELIABLE MSG_ALL_gMsgSayText, {0,0,0}, Receiver )
    
write_byteSender )
    
write_stringsMessage )
    
message_end( )
    
    return 
PLUGIN_CONTINUE;

__________________
My Steam Profile

- Online Rarely -
TribalBlood is offline
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 01-18-2023 , 11:24   Re: A human in possession of this item to have glow and aura
Reply With Quote #5

check out this plugin -> https://forums.alliedmods.net/showthread.php?t=83839
and try it on yours
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
metal_upa
Senior Member
Join Date: Jun 2016
Old 01-19-2023 , 01:13   Re: A human in possession of this item to have glow and aura
Reply With Quote #6

This should work. Good luck.
Spoiler

Last edited by metal_upa; 01-19-2023 at 01:43.
metal_upa is offline
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 01-22-2023 , 12:14   Re: A human in possession of this item to have glow and aura
Reply With Quote #7

Quote:
Originally Posted by TribalBlood View Post
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <zombie_plague_advance>
    
#define _MarkPlayerHasMask(%0)   _bitPlayerHasMask |= (1 << (%0 & 31))
#define _ClearPlayerWithMask(%0)  _bitPlayerHasMask &= ~(1 << (%0 & 31))
#define _PlayerHasMask(%0)       _bitPlayerHasMask & (1 << (%0 & 31))
    
#define _PLUGIN   "[ZP43] 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 )
    
    
RegisterHamHam_Spawn"player""_FW_PlayerSpawn")
    
RegisterHamHam_Killed"player""_FW_PlayerKilled" )
        
    
_ItemID zp_register_extra_item"Anti-Virus Mask \y(\rSingle-Use\y)"200ZP_TEAM_HUMAN )
    
    
_gMaxPlayers get_maxplayers( )
    
_gIcon get_user_msgid"StatusIcon" 
    
_gMsgSayText get_user_msgid"SayText" )
}

public 
plugin_precache() {
    
RegisterHamHam_Think"grenade""_FW_ThinkGrenade"
}

public 
zp_extra_item_selectedplritemid ) {
        
    if( 
itemid == _ItemID ) {
        
_MarkPlayerHasMaskplr )
        
Icon_Onplr )
        
set_ent_rendering(plrkRenderFxGlowShell015050kRenderNormal3);
        
ProtoChat(plr"You now have Anti-Virus Mask. It will neutralize the effect of 1 infection grenade!")
    }
}

public 
_FW_ThinkGrenadeiEnt ) {
    
    if( 
is_valid_ent(iEnt) ) {
        
        if( 
entity_get_int(iEntEV_INT_nadetype) == NADETYPE_INFECTION ) {
            
            for( new 
plr 1plr <= _gMaxPlayersplr++ ) {
                
                if( 
is_user_alive(plr
                
                && 
_PlayerHasMask(plr) ) {
                    
                    if( 
get_entity_distance(iEntplr) <= 240 ) {
                        
                        
_ClearPlayerWithMaskplr )
                        
remove_entityiEnt )
                        
Icon_Offplr )
                        
set_ent_rendering(plr);
                        
                        
ProtoChatplr"Infection prevented! Your Anti-Virus mask can no longer be used." )
                    }
                }
            }
        }
    }
}

public 
zp_user_infected_postplr ) {
    
_ClearPlayerWithMaskplr 
    
Icon_Offplr )
    
set_ent_rendering(plr);
}

public 
_FW_PlayerSpawnplr ) {
    
_ClearPlayerWithMaskplr 
    
Icon_Offplr )
    
set_ent_rendering(plr);
}

public 
_FW_PlayerKilledplr ) {
    
_ClearPlayerWithMaskplr 
    
Icon_Offplr )
    
set_ent_rendering(plr);
}

public 
client_disconnectplr ) {
    
Icon_Offplr )
    
set_ent_rendering(plr);
}

public 
Icon_Onplr ) {
    
message_beginMSG_ONE_UNRELIABLE_gIcon, { 00}, plr );
    
write_byte)
    
write_string"dmg_gas" )
    
write_byte)
    
write_byte255 )
    
write_byte)
    
message_end( )
}

public 
Icon_Offplr ) {
    
message_beginMSG_ONE_UNRELIABLE_gIcon, { 00}, plr )
    
write_byte)
    
write_string"dmg_gas" )
    
write_byte)
    
write_byte255 )
    
write_byte)
    
message_end( )
}

ProtoChatplr, const sFormat[], any:... ) {
    
    static 
iplr plr get_player( )
    
    if ( !
) {
        return 
PLUGIN_HANDLED;
    }
    
    new 
sMessage256 ]
    new 
len formatexsMessage255"^x01[^x04ZP^x01] ")
    
    
vformatsMessage[len], 255-lensFormat)
    
sMessage192 ] = '^0' 
    
    
Make_SayTextplrisMessage )
    
    return 
PLUGIN_CONTINUE
}

get_player( ) {
    for ( new 
plrplr <= _gMaxPlayersplr++ ) {
        if ( 
is_user_connected(plr) ) {
            return 
plr
        
}
    }
    return 
PLUGIN_HANDLED
}

Make_SayTextReceiverSendersMessage[] ) {
    if ( !
Sender ) {
        return 
PLUGIN_HANDLED;
    }
    
    
message_beginReceiver MSG_ONE_UNRELIABLE MSG_ALL_gMsgSayText, {0,0,0}, Receiver )
    
write_byteSender )
    
write_stringsMessage )
    
message_end( )
    
    return 
PLUGIN_CONTINUE;

It seems it doesn't work properly:

GlobalPlague 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 02:53.


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