Code: Select all
#include <amxmodx>
#define PLUGIN "Weapon Icon"
#define VERSION "1.0"
#define AUTHOR "Zenix (m$ubn)"
new iconstatus;
new user_icons[32][192];
new icon_origin[3] = {0,0,0}
new pcv_show;
new pcv_iloc;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event ("CurWeapon", "update_icon", "ab")
register_event("DeathMsg", "event_death", "a")
pcv_show = register_cvar("amx_show_weapon_icon", "1");
pcv_iloc = register_cvar("amx_show_weapon_icon_location", "1");
register_concmd("amx_weapon_icon", "weapon_icon_toggle", ADMIN_CVAR, "Toggle display of the weapon icon on/off (default on)")
check_icon_loc();
}
public update_icon(id) {
check_icon_loc();
if(!get_pcvar_num(pcv_show) || get_pcvar_num(pcv_iloc) == 0)
return PLUGIN_CONTINUE;
if(is_user_alive(id))
{
new iwpn, wclip, wammo, sprite[192], icon_color[3] = {0, 160, 0}
remove_weapon_icon(id)
iwpn = get_user_weapon(id, wclip, wammo)
switch(iwpn) {
case CSW_P228: sprite = "d_p228"
case CSW_SCOUT: sprite = "d_scout"
case CSW_HEGRENADE: sprite = "d_grenade"
case CSW_XM1014: sprite = "d_xm1014"
case CSW_C4: sprite = "d_c4"
case CSW_MAC10: sprite = "d_mac10"
case CSW_AUG: sprite = "d_aug"
case CSW_SMOKEGRENADE: sprite = "d_grenade"
case CSW_ELITE: sprite = "d_elite"
case CSW_FIVESEVEN: sprite = "d_fiveseven"
case CSW_UMP45: sprite = "d_ump45"
case CSW_SG550: sprite = "d_sg550"
case CSW_GALIL: sprite = "d_galil"
case CSW_FAMAS: sprite = "d_famas"
case CSW_USP: sprite = "d_usp"
case CSW_MP5NAVY: sprite = "d_mp5navy"
case CSW_M249: sprite = "d_m249"
case CSW_M3: sprite = "d_m3"
case CSW_M4A1: sprite = "d_m4a1"
case CSW_TMP: sprite = "d_tmp"
case CSW_G3SG1: sprite = "d_g3sg1"
case CSW_FLASHBANG: sprite = "d_flashbang"
case CSW_DEAGLE: sprite = "d_deagle"
case CSW_SG552: sprite = "d_sg552"
case CSW_AK47: sprite = "d_ak47"
case CSW_KNIFE: sprite = "d_knife"
case CSW_P90: sprite = "d_p90"
case CSW_VEST: sprite = "suit_full"
case CSW_VESTHELM: sprite = "suithelmet_full"
case CSW_GLOCK18: sprite = "d_glock18"
case CSW_AWP: sprite = "d_awp"
case 0: sprite = ""
default: sprite = ""
}
if (is_user_ok(id)) {
if (equali(sprite, "") || !is_user_ok(id)) {
remove_weapon_icon(id)
} else {
// draw the sprite itself (only on a human user's screen)
// marker ////////////////////////////////////////////////////////////////////////////////
message_begin(MSG_ONE,iconstatus,icon_origin,id);
write_byte(1); // status (0=hide, 1=show, 2=flash)
write_string(sprite); // sprite name
/*
4 stages - Normal, 1 Clip, No Clip + Some ammo, Completely Out
*/
// ammo check, this is for the color of the icon
get_user_ammo(id, iwpn, wammo, wclip) // update vars correctly
if (wclip == 0 && wammo == 0) icon_color = {0, 0, 255} // outta ammo!
if (wclip == wammo || wclip > wammo) icon_color = {255, 150, 150} // last clip!
if (wammo > 0 && wclip == 0) icon_color = {255, 100, 100} // almost out!
// attempt at percentage max clip & % red/green color
// 1: Get max ammo for weapon
//maxammo = maxclip(iwpn);
write_byte(icon_color[0]); // red
write_byte(icon_color[1]); // green
write_byte(icon_color[2]); // blue
message_end();
}
user_icons[id] = sprite;
}
}
return PLUGIN_CONTINUE
}
public weapon_icon_toggle(id) {
new toggle[32], players[32], num, player, status[32] = "enabled"
read_argv(1, toggle, 1)
if (equali(toggle, "1")) {
status = "enabled"
} else if (equali(toggle, "0")) {
status = "disabled"
} else if (equali(toggle, "")) {
console_print(id, "Usage: amx_weapon_icon <1/0> - Toggles wether or not showing the user's current weapon as an icon")
console_print(id, "Weapon Icon is currently %s", status)
return PLUGIN_HANDLED
}
set_cvar_string("amx_show_weapon_icon", toggle)
client_print(0, print_chat, "Weapon Icon is now %s", status)
get_players(players, num)
for (new i=0; i<num; i++) {
player = players[i]
if (!equali(user_icons[player], "") && !equali(players[i], "") && is_user_ok(id)) {
remove_weapon_icon(i)
}
}
return PLUGIN_CONTINUE
}
public remove_weapon_icon(id) {
if (is_user_ok(id)) {
message_begin(MSG_ONE,iconstatus,icon_origin,id);
write_byte(0);
write_string(user_icons[id]);
message_end();
}
}
public is_user_ok(id) {
// check if the user is "ok": they are connected, not a bot, and alive
if (is_user_connected(id) && !is_user_bot(id) && is_user_alive(id))
return true
return false
}
public event_death() {
new player = read_data(2) // the dead player's ID (1-32)
if (is_user_connected(player) && !is_user_bot(player)) { // remove icon
message_begin(MSG_ONE,iconstatus,icon_origin,player);
write_byte(0);
write_string(user_icons[player]);
message_end();
}
}
public check_icon_loc() {
if(!get_pcvar_num(pcv_iloc))
return PLUGIN_CONTINUE;
new value = get_pcvar_num(pcv_iloc);
if (value == 0)
iconstatus = 0;
if (value == 1)
iconstatus = get_user_msgid("StatusIcon");
if (value == 2)
iconstatus = get_user_msgid("Scenario");
return PLUGIN_CONTINUE;
}
Code: Select all
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
//Define fade type
#define FFADE_OUT 0x0001
#define SPECMODE_ALIVE 0
//CVAR
new cvar_death, cvar_red, cvar_green, cvar_blue, cvar_damage
//MSG
new g_MsgScreenFade, g_MsgScreenShake
public plugin_init()
{
// Register plugin call
register_plugin("Damage & Death Effect", "1.3.3", "YKH =]")
//CVAR
cvar_death = register_cvar("amx_killed_effect_on", "1")
cvar_red = register_cvar("death_color_r","0")
cvar_green = register_cvar("death_color_g","0")
cvar_blue = register_cvar("death_color_b","0")
cvar_damage = register_cvar("damage_num","60")
//Forward
RegisterHam(Ham_Killed, "player", "fw_Killed")
RegisterHam(Ham_Killed, "player", "Ham_Killed_player_Post", 1);
RegisterHam(Ham_TakeDamage, "player", "fw_Damage")
// Message IDs
g_MsgScreenFade = get_user_msgid("ScreenFade")
g_MsgScreenShake = get_user_msgid("ScreenShake")
}
public fw_Killed(victim)
{
if(get_pcvar_num(cvar_death))
{
message_begin(MSG_ONE_UNRELIABLE, g_MsgScreenFade, _, victim)
write_short(12288) // Duration
write_short(12288) // Hold time
write_short(FFADE_OUT) // Fade type
write_byte (get_pcvar_num(cvar_red)) // Red
write_byte (get_pcvar_num(cvar_green)) // Green
write_byte (get_pcvar_num(cvar_blue)) // Blue
write_byte (255) // Alpha
message_end()
}
}
public Ham_Killed_player_Post(victim, attacker)
{
set_pev(victim, pev_iuser1, SPECMODE_ALIVE);
return HAM_IGNORED;
}
public fw_Damage(victim, inflictor, attacker, Float:damage, damage_type)
{
if ((victim != attacker) && (damage > get_pcvar_num(cvar_damage)))
{
message_begin(MSG_ONE_UNRELIABLE, g_MsgScreenShake, _, victim)
write_short( 1<<14 )
write_short( 1<<14 )
write_short( 1<<14 )
message_end();
message_begin(MSG_ONE_UNRELIABLE, g_MsgScreenFade, _, victim)
write_short( 1<<10 )
write_short( 1<<10 )
write_short( 1<<12 )
write_byte( 250 )
write_byte( 0 )
write_byte( 0 )
write_byte( 125 )
message_end()
}
}
Code: Select all
#include <zombie_escape>
new const szEntities[][] =
{
"func_train",
"func_vehicle",
"func_tracktrain",
"func_door"
}
public plugin_init()
{
register_plugin("No Block", "1.0", "Raheem")
for (new i = 0; i < charsmax(szEntities); i++)
{
RegisterHam(Ham_Blocked, szEntities[i], "Fw_Blocked_Post", 1)
}
}
public Fw_Blocked_Post(iEnt, id)
{
if (is_user_alive(id) && pev_valid(iEnt))
{
new Float:flVelocity[3]
velocity_by_aim(id, 550, flVelocity)
flVelocity[0] += 20.0
flVelocity[1] += 20.0
flVelocity[2] += 20.0
set_entvar(id, var_velocity, flVelocity)
}
}
Code: Select all
#include <zombie_escape>
new cvars_message_type
public plugin_init()
{
register_plugin("[ZE] Break Message","1.2","Raheem")
// Ham
RegisterHam(Ham_TakeDamage, "func_breakable", "Fw_HamBreakableKilled_Post", 1)
// Cvars
cvars_message_type = register_cvar("ze_message_type", "1")
}
public Fw_HamBreakableKilled_Post(iEnt, iWeapon, iKiller)
{
if(get_entvar(iEnt, var_health) < 0)
{
static szName[32]
get_user_name(iKiller, szName, charsmax(szName))
if(iKiller == 0)
return HAM_IGNORED
if (get_pcvar_num(cvars_message_type) == 1)
{
ze_colored_print(0,"!gPlayer !t%s !ghas broken Something!y!", szName)
}
else if (get_pcvar_num(cvars_message_type) == 2)
{
set_hudmessage(random(256), random(256), random(256), -1.0, 0.21, 0, 4.0, 4.0)
show_hudmessage(0, "Player %s has broken Something!", szName)
}
else if (get_pcvar_num(cvars_message_type) == 3)
{
client_print(0, print_console, "Player %s has broken Something!", szName)
}
}
return HAM_IGNORED
}
Code: Select all
#include <zombie_escape>
// Defines
#define AIMTASK 500
// Cvars
new cvar_message_type
public plugin_init()
{
register_plugin("[ZE] Breakable Hint", "1.1", "Raheem")
// Cvars
cvar_message_type = register_cvar("ze_break_hint_type", "1")
// Tasks
set_task(0.5, "Check_AimTask", AIMTASK, _, _, "b")
}
public Check_AimTask()
{
if (get_pcvar_num(cvar_message_type) == 0)
{
remove_task(AIMTASK, 0)
return
}
for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
{
if (!is_user_alive(id))
continue
new iEntIndex, iBody
get_user_aiming(id, iEntIndex, iBody)
if(is_valid_ent(iEntIndex) && !is_user_connected(iEntIndex))
{
new szClassName[32]
get_entvar(iEntIndex, var_classname, szClassName, charsmax(szClassName))
if(equal(szClassName, "func_breakable"))
{
if (get_pcvar_num(cvar_message_type) == 1)
{
set_hudmessage(random(256), random(256), random(256), 0.1, -0.3, 2, 2.0, 2.0)
show_hudmessage(id, "[Hint] You can break this Entity!")
}
else if (get_pcvar_num(cvar_message_type) == 2)
{
client_print(id, print_center, "[Hint] You can break this Entity!")
}
}
}
}
}
Code: Select all
#include <zombie_escape>
new Thunder
public plugin_precache()
{
Thunder = precache_model("sprites/lgtning.spr")
precache_sound("ambience/thunder_clap.wav")
}
public plugin_init()
{
register_plugin("[ZE] Thunder On Infect", "1.0", "LegendofWarior")
}
public ze_user_infected(iVictim, iAttacker)
{
new vorigin[3], srco[3]
get_user_origin(iVictim, vorigin)
vorigin[2] -= 26
srco[0] = vorigin[0] + 150
srco[1] = vorigin[1] + 150
srco[2] = vorigin[2] + 800
ThunderCarabine(srco, vorigin)
ThunderCarabine(srco, vorigin)
ThunderCarabine(srco, vorigin)
emit_sound(0 ,CHAN_ITEM, "ambience/thunder_clap.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
ThunderCarabine(vec1[3], vec2[3])
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(0)
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
write_coord(vec2[0])
write_coord(vec2[1])
write_coord(vec2[2])
write_short(Thunder)
write_byte(1)
write_byte(5)
write_byte(2)
write_byte(20)
write_byte(30)
write_byte(200)
write_byte(200)
write_byte(200)
write_byte(200)
write_byte(200)
message_end()
message_begin(MSG_PVS, SVC_TEMPENTITY, vec2)
write_byte(9)
write_coord(vec2[0])
write_coord(vec2[1])
write_coord(vec2[2])
message_end()
}