Originally Posted by filo
(Post 769845)
@ miccino9408 What possibilty there are to make play a sound where there is a single human left??
I found this:
Code:
/*================================================================================
[Message Hooks]
=================================================================================*/
// Current Weapon info
public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
// Player not alive or not an active weapon
if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
return;
// Get weapon id
static weapon
weapon = get_msg_arg_int(2)
// Store weapon id for reference
g_currentweapon[msg_entity] = weapon
// Replace weapon models with custom ones
replace_models(msg_entity)
// Unlimited Clip Ammo?
if (MAXBPAMMO[weapon] > 2 && (g_survivor[msg_entity] || get_pcvar_num(cvar_infammo) > 1))
{
// Refill when it's running out
if (get_msg_arg_int(3) < 7)
{
// Get weapon entity
static wname[32], weapon_ent
get_weaponname(weapon, wname, sizeof wname - 1)
weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
// Max out clip ammo
fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
}
// HUD should show full clip all the time
set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon])
}
}
// BP Ammo update
public message_ammo_x(msg_id, msg_dest, msg_entity)
{
// Get ammo type
static type
type = get_msg_arg_int(1)
// Unknown ammo type
if (type >= sizeof AMMOWEAPON) return;
// Get weapon id
static weapon
weapon = AMMOWEAPON[type]
// Primary and secondary only
if (MAXBPAMMO[weapon] > 2)
{
// Get ammo amount
static amount
amount = get_msg_arg_int(2)
// Unlimited BP Ammo?
if (g_survivor[msg_entity] || get_pcvar_num(cvar_infammo))
{
if (amount < MAXBPAMMO[weapon])
{
fm_set_user_bpammo(msg_entity, weapon, MAXBPAMMO[weapon])
set_msg_arg_int(2, get_msg_argtype(2), MAXBPAMMO[weapon])
}
}
// Bots automatically buy ammo when needed
else if (!g_zombie[msg_entity] && !g_survivor[msg_entity] && g_ammopacks[msg_entity] > 0 && amount <= BUYAMMO[weapon] && is_user_bot(msg_entity))
clcmd_buyammo(msg_entity);
}
}
I Added this:
Code:
/*================================================================================
[Message Hooks]
=================================================================================*/
// Current Weapon info
public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
// Player not alive or not an active weapon
if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
return;
// Get weapon id
static weapon
weapon = get_msg_arg_int(2)
// Store weapon id for reference
g_currentweapon[msg_entity] = weapon
// Replace weapon models with custom ones
replace_models(msg_entity)
// Unlimited Clip Ammo?
if (MAXBPAMMO[weapon] > 2 && (!g_survivor[msg_entity] || get_pcvar_num(cvar_infammo) > 1))
{
// Refill when it's running out
if (get_msg_arg_int(3) < 7)
{
// Get weapon entity
static wname[32], weapon_ent
get_weaponname(weapon, wname, sizeof wname - 1)
weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
// Max out clip ammo
fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
}
// HUD should show full clip all the time
set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon])
}
}
// BP Ammo update
public message_ammo_x(msg_id, msg_dest, msg_entity)
{
// Get ammo type
static type
type = get_msg_arg_int(1)
// Unknown ammo type
if (type >= sizeof AMMOWEAPON) return;
// Get weapon id
static weapon
weapon = AMMOWEAPON[type]
// Primary and secondary only
if (MAXBPAMMO[weapon] > 2)
{
// Get ammo amount
static amount
amount = get_msg_arg_int(2)
// Unlimited BP Ammo?
if (!g_survivor[msg_entity] || get_pcvar_num(cvar_infammo))
{
if (amount < MAXBPAMMO[weapon])
{
fm_set_user_bpammo(msg_entity, weapon, MAXBPAMMO[weapon])
set_msg_arg_int(2, get_msg_argtype(2), MAXBPAMMO[weapon])
}
}
// Bots automatically buy ammo when needed
else if (!g_zombie[msg_entity] && !g_survivor[msg_entity] && g_ammopacks[msg_entity] > 0 && amount <= BUYAMMO[weapon] && is_user_bot(msg_entity))
clcmd_buyammo(msg_entity);
}
}
And the Survivor has not Unlimited ammo anymore, but he can't buy anymore so at this line delete the ! from g_survivor
Code:
// Bots automatically buy ammo when needed
else if (!g_zombie[msg_entity] && !g_survivor[msg_entity] && g_ammopacks[msg_entity] > 0 && amount <= BUYAMMO[weapon] && is_user_bot(msg_entity))
clcmd_buyammo(msg_entity);
}
So the Bots can buy more ammo when survivor, but i dont know how to enable to player buy ammo as survivor.
|