since no one checked the code im just gonna tell ya guys i made a second death function with DeathMsg at the end somewhere incase the first one was commented....
PHP Code:
// Menu - Basics
#define M3+BOW_MULT 3.0 // damage multiplier for Ultimate M3 % admin only and Enchanted Bow.
#define HEMULT 4.0 // damage multiplier for Super HE % admin only.
#include <superheromod>
#include <dhudmessage>
#include <chatcolor>
#define AMMOX_HEGRENADE 12
enum _:ITEM_HANDLER { // Easier to read and handle...
WpnSet1 = 3000,
WpnSet2 = 2800,
WpnSet3 = 4000,
WpnSet4 = 6000,
WpnSet5 = 5000,
Enchanted_Weapon = 16000,
Super_HE = 0,
Ultimate_M3 = 0
};
new bool:grenadetrail[SH_MAXSLOTS+1];
new bool:bowtrail[SH_MAXSLOTS+1];
new bool:extradmg[SH_MAXSLOTS+1];
new bool:extrafragdmg[SH_MAXSLOTS+1];
new bool:gMessageShown[SH_MAXSLOTS+1];
new gTrail, gBowTrail, g_pReviveCost;
new const itemcost[ITEM_HANDLER];
new const HEGrenade[] = "models/w_hegrenade.mdl";
public plugin_init()
{
register_plugin("WeaponMenu", "1.0", "RB");
g_pReviveCost = register_cvar("revive_cost", "7000"); // how much it costs to revive yourself % admin only.
register_clcmd("say /buy", "cmd_menu");
register_clcmd("say /revive", "revive");
register_clcmd("say_team /buy", "cmd_menu");
register_clcmd("say_team /revive", "revive");
register_event("AmmoX", "super_grenade", "b");
register_event("CurWeapon", "enchanted_tracer", "be", "1=1", "3>0");
register_event("CurWeapon", "weapon_drop", "be");
register_event( "TeamInfo", "join_team", "a");
register_event( "DeathMsg", "show_DeathMsg", "a", "1>0");
}
public plugin_precache()
{
gTrail = precache_model("sprites/zbeam5.spr");
gBowTrail = precache_model("sprites/laserbeam.spr");
}
public client_damage(attacker, id, damage, weapon, bodypart) //switching extra damamge methods cause ham module seems a little too complex for you, besides this method is easier to deal with grenade extra damage
{
if ( !sh_is_active() || !is_user_alive(id) || !is_user_connected(attacker) ) return;
new headshot = bodypart == 1 ? 1 : 0;
if ( extradmg[attacker] && (1<<weapon) & (1<<CSW_M3)|(1<<CSW_SCOUT) )
{
// do extra damage
new extraDamage = floatround(damage * M3+BOW_MULT - damage);
if (extraDamage > 0) sh_extra_damage(id, attacker, extraDamage, "Ultimate M3 & Enchanted Bow", headshot);
}
if ( extrafragdmg[attacker] && weapon == CSW_HEGRENADE )
{
// do extra damage
new extraDamage = floatround(damage * HEMULT - damage);
if (extraDamage > 0) sh_extra_damage(id, attacker, extraDamage, "Super HE", headshot);
extrafragdmg[attacker] = false; //we only want the extra dmg to work on our one nade
}
}
/*======================================================================
DAMAGE MULT OPTIONS
======================================================================*/
public client_disconnect(id)
{
extradmg[id] = false;
extrafragdmg[id] = false;
}
// if the damage mult and trail effects should dissapear upon the player's death then uncomment this function
public sh_client_death(victim, attacker, headshot, const wpnDescription[])
{
extradmg[victim] = false;
extrafragdmg[victim] = false;
grenadetrail[victim] = false;
bowtrail[victim] = false;
}
/* if the damage mult should only last 1 round then uncomment this function
public sh_round_end()
arrayset(extradmg, false, SH_MAXSLOTS+1);
*/
/*======================================================================
DAMAGE MULT OPTIONS
======================================================================*/
public cmd_menu(id)
{
if ( is_user_alive(id) )
{
client_print_color(id, Blue, "[WpnMenu Made By v1.0 RB]");
new menu = menu_create("Choose Your Weapon Set", "menu_handler");
menu_additem(menu, "/yBuy M4A1 + HE", "0", 0);
menu_additem(menu, "/yBuy AK47 + HE", "1", 0);
menu_additem(menu, "/yBuy AWP + Kevlar", "2", 0);
menu_additem(menu, "/yBuy M249 + Deagle/Flash", "3", 0);
menu_additem(menu, "/yBuy CSW_G3SG1", "4", 0);
new buffer[18]; //allows us to format the color based on admin or not
formatex(buffer, charsmax(buffer), "%sBuy Ultimate M3", (get_user_flags(id) & ADMIN_ADMIN) ? "/y" : "/w");
menu_additem(menu, buffer, "6");
formatex(buffer, charsmax(buffer), "%sBuy Super HE", (get_user_flags(id) & ADMIN_ADMIN) ? "/y" : "/w");
menu_additem(menu, buffer, "7");
switch(cs_get_user_team(id))
{
case CS_TEAM_CT:
{
menu_additem(menu, "/yBuy Enchanted Bow", "5", 0);
}
case CS_TEAM_T:
{
menu_additem(menu, "/yBuy Rapid Semi-Fire Glock", "5", 0);
}
}
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
} else client_print(id, print_chat, "[AMXX] You Have To Be Alive To Use The Menu."); //this insult brought to you by 1 random guy :P
}
public menu_handler(id, menu, item)
{
if ( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
if ( !is_user_alive(id) ) //in case a player waits till they die and then chooses an option
{
menu_destroy(menu);
client_print(id, print_chat, "[AMXX] You Have To Be Alive To Use The Menu.");
return PLUGIN_HANDLED;
}
new data[2], acces, callback, key;
menu_item_getinfo(menu, item, acces, data, 1, _, _, callback);
key = str_to_num(data);
if ( 0 <= key < 8 )
{
new usermoney = cs_get_user_money(id);
new cost = itemcost[key];
if ( usermoney >= cost )
{
if ( 0 <= key <= 4) client_print(id, print_chat, "[AMXX] Bought Weapon Set %i", key+1);
switch(key)
{
case 0: // M4A1 + HE
{
sh_give_weapon(id, CSW_M4A1, true);
sh_give_weapon(id, CSW_HEGRENADE);
}
case 1: // AK47 + HE
{
sh_give_weapon(id, CSW_AK47, true);
sh_give_weapon(id, CSW_HEGRENADE);
}
case 2: // AWP + Kevlar
{
sh_give_weapon(id, CSW_AWP, true);
set_user_armor(id, 100);
}
case 3: // M249 + Deagle/Flash
{
sh_give_weapon(id, CSW_M249, true);
sh_give_weapon(id, CSW_DEAGLE);
sh_give_weapon(id, CSW_FLASHBANG);
}
case 4: sh_give_weapon(id, CSW_G3SG1, true); // G3SG1
case 5: // Enchanted Bow || Rapid Semi-Fire Glock
{
if ( cs_get_user_team(id) == CS_TEAM_CT )
{
client_print(id, print_chat, "[AMXX] Bought Enchanted Bow");
sh_give_weapon(id, CSW_SCOUT, true);
extradmg[id] = true;
bowtrail[id] = true;
}
else if ( cs_get_user_team(id) == CS_TEAM_T )
{
client_print(id, print_chat, "[AMXX] Bought Rapid Semi-Fire Glock");
sh_give_weapon(id, CSW_GLOCK18, true);
}
}
case 6, 7: // Ulimate M3 and Super HE
{
if ( !(get_user_flags(id) & ADMIN_ADMIN) )
{
client_print(id, print_chat, "[AMXX] Only the admins get to use this option."); //this insult brought to you by 1 random guy :P
menu_destroy(menu);
cmd_menu(id);
return PLUGIN_HANDLED;
}
if ( key == 7 )
{
client_print(id, print_chat, "[AMXX] Bought Super HE");
if ( cs_get_user_bpammo(id, CSW_HEGRENADE) >= 1 ) //get_user_weapon only checks current weapon so instead we check if the user has a nade with this code
{
client_print(id, print_chat, "[AMXX] You Already Have A Greande.");
menu_destroy(menu);
cmd_menu(id);
return PLUGIN_HANDLED;
}
sh_give_weapon(id, CSW_HEGRENADE);
grenadetrail[id] = true;
extrafragdmg[id] = true;
} else {
client_print(id, print_chat, "[AMXX] Bought Ultimate M3");
sh_give_weapon(id, CSW_M3, true);
extradmg[id] = true;
}
}
}
} else client_print(id, print_chat, "[AMXX] You Don't Have Enough Money(You Cheap Bastard)."); //this insult brought to you by 1 random guy :P
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public join_team()
{
new id = read_data(1);
if(!is_user_connected(id))
return PLUGIN_CONTINUE;
show_message(id);
return PLUGIN_CONTINUE;
}
show_message(id)
{
if (!gMessageShown[id])
{
gMessageShown[id] = true;
new name[32];
get_user_name(id, name, 31);
set_dhudmessage(227, 96, 8, -1.0, 0.30, 0, 0.25, 3.0, 0.45, 0.90, false);
show_dhudmessage(id, "[AMXX] Hello %s! Type /buy <Weapon Menu>", name);
}
}
public super_grenade(id)
{
if ( !is_user_alive(id) || !grenadetrail[id] ) return;
if ( read_data(1) == AMMOX_HEGRENADE )
{
new iCurrent = -1;
while ( ( iCurrent = engfunc(EngFunc_FindEntityByString, iCurrent, "classname", "grenade") ) > 0 )
{
new string[32];
pev(iCurrent, pev_classname, string, 31);
if ( id == pev(iCurrent, pev_owner) && equali(HEGrenade, string)) //sorry, i'm in the habit of using fakemeta over engine. Engine gave me alot of trouble when I started out and I have a grudge cause of that
{
// Make the nade glow
sh_set_rendering(iCurrent, 225, 0, 20, 100, kRenderFxGlowShell, kRenderTransAlpha); //vittu didn't waste time adding natives for no reason
// Make a trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(22); //TE_BEAMFOLLOW
write_short(iCurrent); // entity:attachment to follow
write_short(gTrail); // sprite index
write_byte(10); // life in 0.1's
write_byte(10); // line width in 0.1's
write_byte(225); // colour
write_byte(90);
write_byte(102);
write_byte(255); // brightness
message_end();
grenadetrail[id] = false; //trail is already attached to our current nade so it's safe to remove our status here before user gets another
break; //found our nade so no reason to continue looping through others
}
}
}
}
public enchanted_tracer(id)
{
if ( !is_user_alive(id) || !bowtrail[id] ) return;
if ( read_data(2) == CSW_SCOUT )
{
new origin[3], aimvec[3];
get_user_origin(id, aimvec, 1);
get_user_origin(id, origin, 3);
// tracer beam
message_begin(MSG_PAS, SVC_TEMPENTITY, origin)
write_byte(0); // TE_BEAMPOINTS
write_coord(origin[0]);
write_coord(origin[1]);
write_coord(origin[2]);
write_coord(aimvec[0]);
write_coord(aimvec[1]);
write_coord(aimvec[2]);
write_short(gBowTrail); // sprite index
write_byte(0); // starting frame
write_byte(10); // frame rate
write_byte(2); // life in 0.1's
write_byte(4); // line width in 0.1's
write_byte(1); // noise in 0.1's
write_byte(0); // colour
write_byte(153);
write_byte(80); // brightness
write_byte(100); // scroll speed
message_end();
}
}
public sh_client_spawn(id)
{
grenadetrail[id] = false;
bowtrail[id] = false;
}
public sh_round_new()
client_print(0, print_chat, "[AMXX] <WpnMenu v1.0 MadeBy RollerBlades>");
public revive(id, usermoney)
{
if ( is_user_alive(id) || !(get_user_flags(id) & ADMIN_ADMIN) ) return;
if (usermoney >= get_pcvar_num(g_pReviveCost))
{
ExecuteHamB(Ham_CS_RoundRespawn, id);
cmd_menu(id);
client_print(id, print_chat, "[AMXX] Bought A Second Life");
} else client_print_color(id, DontChange, "[AMXX] You Need ^4$%d ^1To Revive Your Self(You Cheap Bastard)", get_pcvar_num(g_pReviveCost)); //this insult brought to you by 1 random guy :P
}
public show_DeathMsg(name[32]) // i made a second Death Function in case the first one was commented
{
new iAttacker = read_data(1);
new iVictim = read_data(2);
if (iVictim != iAttacker && (get_user_flags(iVictim) & ADMIN_ADMIN))
{
get_user_name(iVictim, name, 31);
client_print(iVictim, print_chat, "[AMXX] Hello %s! Type /revive <WeaponMenu>", name);
}
}