so i need some help with diffrent stuff today so i made another thread instead of posting in the older one and i also need a nice look for my hudmessage but cant come up with a good look for it, so im wondering if i buy a super grenade and use the trail will the trail then work on a normal grenade??...
PHP Code:
// Menu - Basics
#define M3MULT 3 // damage multiplier for Ultimate M3 # admin only.
#define HEMULT 4 // damage multiplier for Super HE # admin only.
#include <superheromod>
#define AMMOX_HEGRENADE 12
new bool:grenadetrail[SH_MAXSLOTS+1];
new bool:extradmg[SH_MAXSLOTS+1];
new bool:extrafragdmg[SH_MAXSLOTS+1];
new gTrail;
new const itemcost[7] = { 3000, 3000, 4000, 6000, 5000, 0, 0 };
new const HEGrenade[] = "models/w_hegrenade.mdl";
public plugin_init()
{
register_plugin("WeaponMenu", "1.0", "RB");
register_clcmd("say /buy", "cmd_menu");
register_clcmd("say_team /buy", "cmd_menu");
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage");
register_event("AmmoX", "super_grenade", "b");
}
public plugin_precache()
{
gTrail = precache_model("sprites/zbeam5.spr");
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if (victim == attacker || !is_user_connected(attacker)) // non-player damage or self damage
return HAM_IGNORED;
if ( extradmg[attacker] ) SetHamParamFloat(4, damage * M3MULT); //basic dmg multiplier
if ( extrafragdmg[attacker] ) SetHamParamFloat(4, damage * HEMULT); //basic dmg multiplier
return HAM_IGNORED;
}
/*======================================================================
DAMAGE MULT OPTIONS
======================================================================*/
public client_disconnect(id)
{
extradmg[id] = false;
extrafragdmg[id] = false;
}
// if the damage mult 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;
}
/* if the damage mult should only last 1 round then uncomment this function
public sh_round_new()
arrayset(extradmg, false, SH_MAXSLOTS+1);
*/
/*======================================================================
DAMAGE MULT OPTIONS
======================================================================*/
public cmd_menu(id)
{
if ( is_user_alive(id) )
{
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[17]; //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, "5");
formatex(buffer, charsmax(buffer), "%sBuy Super HE", (get_user_flags(id) & ADMIN_ADMIN) ? "/y" : "/w");
menu_additem(menu, buffer, "6");
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.");
}
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 Purchase Stuff.");
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 < 7 )
{
new usermoney; usermoney = cs_get_user_money(id);
new cost; cost = itemcost[key];
if ( usermoney >= cost )
{
cs_set_user_money(id, usermoney - cost, 1);
if ( key == 6 ) client_print(id, print_chat, "[AMXX] Bought Ultimate M3");
if ( key == 7 ) client_print(id, print_chat, "[AMXX] Bought Super HE");
else 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: // The Ultimate Shotgun(ADMIN)
{
if ( !(get_user_flags(id) & ADMIN_ADMIN) )
{
menu_destroy(menu);
cmd_menu(id);
return PLUGIN_HANDLED;
}
sh_give_weapon(id, CSW_M3, true);
extradmg[id] = true;
}
case 6: // The Super Grenade(ADMIN)
{
if ( !(get_user_flags(id) & ADMIN_ADMIN) )
{
menu_destroy(menu);
cmd_menu(id);
return PLUGIN_HANDLED;
}
if ( get_user_weapon(id) == CSW_HEGRENADE)
{
menu_destroy(menu);
cmd_menu(id);
client_print(id, print_chat, "[AMXX] You Already Have A Greande.");
return PLUGIN_HANDLED;
}
sh_give_weapon(id, CSW_HEGRENADE);
grenadetrail[id] = true;
extrafragdmg[id] = true;
}
}
} else client_print(id, print_chat, "[AMXX] You Don't Have Enough Money(You Cheap Bastard).");
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public client_putinserver(id)
{
new message[22];
format(message, charsmax(message), "Type /Buy <Weapon Menu>");
set_hudmessage(0, 0, 0, -0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0);
show_hudmessage(id, message);
}
public super_grenade(id)
{
if ( !sh_is_active() || !is_user_alive(id) ) return;
if ( read_data(1) == AMMOX_HEGRENADE )
{
if ( grenadetrail[id] )
{
new iCurrent = -1;
while ( ( iCurrent = find_ent_by_tname(iCurrent, "grenade") ) > 0 )
{
new string[32];
entity_get_string(iCurrent, EV_SZ_model, string, 31);
if ( id == entity_get_edict(iCurrent, EV_ENT_owner) && equali(HEGrenade, string))
{
new Float:glowColor[3] = {225.0, 0.0, 20.0};
// Make the nade glow
entity_set_int(iCurrent, EV_INT_renderfx, kRenderFxGlowShell);
entity_set_vector(iCurrent, EV_VEC_rendercolor, glowColor);
// Make the nade a bit invisible to make glow look better
entity_set_int(iCurrent, EV_INT_rendermode, kRenderTransAlpha);
entity_set_float(iCurrent, EV_FL_renderamt, 100.0 );
// 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();
}
}
}
}
}
public sh_client_spawn(id)
{
if ( sh_is_active() && is_user_alive(id) && get_user_flags(id) & ADMIN_ADMIN ) {
grenadetrail[id] = false;
}
}