Post by ShaunCraft15 on Nov 20, 2021 9:56:36 GMT
Hello Every One i have this biohazard Icon For ZP43 i edit zombie lurker version and i add hudmessage who can support this for zp50 plz
Here My Code
/*
[ZP43] Addon Biohazard Icon
V1.0: First Release By Zombie Lurker
V1.1: Added Dhud And Hudmessages cvar_Control, With Gamemodes Say
*/
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#define PLUGIN "Biohazard Icon"
#define VERSION "1.1"
#define AUTHOR "Zombie Lurker & ShaunCraft"
new iconstatus, cvar_hudmod
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward(FM_PlayerPreThink,"fw_prethink");
iconstatus = get_user_msgid("StatusIcon")
cvar_hudmod = register_cvar("zp_biohazard_icon_hud", "0") // 0 Normal HUD Message, 1 DHUD Message
}
public fw_prethink(id) {
if (is_user_connected(id)) {
if (zp_is_nemesis_round() & 1) {
set_user_icon(id , 1 , 255 , 0 , 0)
} else if (zp_is_survivor_round() & 1) {
set_user_icon(id , 1 , 0 , 0 , 255)
} else if (zp_is_swarm_round() & 1) {
set_user_icon(id , 1 , 255 , 255 , 0)
} else if (zp_is_plague_round() & 1) {
set_user_icon(id , 1 , 255 , 0 , 0)
} else if (zp_has_round_started() & 1) {
set_user_icon(id , 1 , 0 , 255 , 0)
} else if (!zp_has_round_started()) {
set_user_icon(id, 1, 255, 255, 255)
}
}
}
stock set_user_icon(id , mode , red , green , blue) {
message_begin(MSG_ONE,iconstatus,{0,0,0},id);
write_byte(mode);
write_string("dmg_bio");
write_byte(red);
write_byte(green);
write_byte(blue);
message_end();
switch(get_pcvar_num(cvar_hudmod))
{
case 0:
{
set_hudmessage( red, green, blue, 0.01, 0.5, 0, 0.0, 0.1, 0.1, 0.1 );
// Hud Message
if(zp_is_nemesis_round()){
show_hudmessage( id, "Nemesis")
} else if(zp_is_survivor_round()){
show_hudmessage( id, "Survivor")
} else if(zp_is_swarm_round()){
show_hudmessage( id, "Swarm")
} else if(zp_is_plague_round()){
show_hudmessage( id, "Plague")
} else if(zp_has_round_started()){
show_hudmessage( id, "Infection")
} else if(!zp_has_round_started()){
show_hudmessage(id, "Waiting")
}
}
case 1:
{
set_dhudmessage( red, green, blue, 0.01, 0.5, 0, 0.0, 0.1, 0.1, 0.1 );
// DHud Message
if(zp_is_nemesis_round()){
show_dhudmessage( id, "Nemesis")
} else if(zp_is_survivor_round()){
show_dhudmessage( id, "Survivor")
} else if(zp_is_swarm_round()){
show_dhudmessage( id, "Swarm")
} else if(zp_is_plague_round()){
show_dhudmessage( id, "Plague")
} else if(zp_has_round_started()){
show_dhudmessage( id, "Infection")
} else if(!zp_has_round_started()){
show_dhudmessage(id, "Waiting")
}
}
}
}
// Director Hud Message, Stock
stock dhud_color, dhud_x, dhud_y, dhud_effect, dhud_fxtime, dhud_holdtime, dhud_fadeintime, dhud_fadeouttime, dhud_reliable
stock set_dhudmessage( red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0, Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = false )
{
#define clamp_byte(%1) ( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )
dhud_color = pack_color( clamp_byte( red ), clamp_byte( green ), clamp_byte( blue ) )
dhud_x = _: x
dhud_y = _: y
dhud_effect = effects
dhud_fxtime = _: fxtime
dhud_holdtime = _: holdtime
dhud_fadeintime = _: fadeintime
dhud_fadeouttime = _: fadeouttime
dhud_reliable = _: reliable
return 1;
}
stock show_dhudmessage( index, const message[ ], any:... )
{
new buffer[ 128 ]
new numArguments = numargs( )
if( numArguments == 2 )
{
send_dhudMessage( index, message )
}
else if( index || numArguments == 3 )
{
vformat( buffer, charsmax( buffer ), message, 3 )
send_dhudMessage( index, buffer )
}
else
{
new playersList[ 32 ], numPlayers;
get_players( playersList, numPlayers, "ch" )
if( !numPlayers )
{
return 0;
}
new Array:handleArrayML = ArrayCreate()
for( new i = 2, j; i < numArguments; i++ )
{
if( getarg( i ) == LANG_PLAYER )
{
while( ( buffer[ j ] = getarg( i + 1, j++ ) ) ) {}
j = 0
if( GetLangTransKey( buffer ) != TransKey_Bad )
{
ArrayPushCell( handleArrayML, i++ )
}
}
}
new size = ArraySize( handleArrayML )
if( !size )
{
vformat( buffer, charsmax( buffer ), message, 3 )
send_dhudMessage( index, buffer )
}
else
{
for( new i = 0, j; i < numPlayers; i++ )
{
index = playersList[ i ]
for( j = 0; j < size; j++ )
{
setarg( ArrayGetCell( handleArrayML, j ), 0, index )
}
vformat( buffer, charsmax( buffer ), message, 3 )
send_dhudMessage( index, buffer )
}
}
ArrayDestroy( handleArrayML )
}
return 1;
}
stock send_dhudMessage( const index, const message[ ] )
{
message_begin( dhud_reliable ? ( index ? MSG_ONE : MSG_ALL ) : ( index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST ), SVC_DIRECTOR, _, index )
{
write_byte( strlen( message ) + 31 )
write_byte( DRC_CMD_MESSAGE )
write_byte( dhud_effect )
write_long( dhud_color )
write_long( dhud_x )
write_long( dhud_y )
write_long( dhud_fadeintime )
write_long( dhud_fadeouttime )
write_long( dhud_holdtime )
write_long( dhud_fxtime )
write_string( message )
}
message_end()
}