Código:
/*======================================================================================
/
/ [ZP] Extra Item : Flamethrower
/ ( weapon for HUMANS )
/
/ by The_Thing
/
/
/
/ Description :
/
/ Now on Zombie mod has appeared new weapon, that is Flamethrower.
/ You can burn zombies alive, but don't forget that this weapon will cost to You some ammo packs.
/
/
/
/ Cvars :
/
/ zp_ft_enable <1|0> // Turn it on or off, default is 1.
/ zp_ft_client_buy <1|0> // This means that You can buy this weapon, default is 1.
/ zp_ft_obey_buyzone <1|0> // This means that You must buy it only when You are in buyzone, default is 0.
/ zp_ft_obey_buytime <1|0> // This means that You can only buy it if buyzone seconds are not passed, default is 0.
/ zp_ft_cost "37" // This means how much flamethrower cost to You.
/ zp_ft_fuelcost "25" // How much Fuel for Flamethrower will cost.
/ zp_ft_fueltank "55" // How much fuel ammo will be in one clip.
/ zp_ft_damage "34" // How much damage will do to zombies.
/ zp_ft_xplode_dmg "60" // How much damage will be if it will explode.
/ zp_ft_damage_dis "120" // How far You can shoot flames.
/ zp_ft_splash_dis "40" // How far fire will splash.
/
/
/
/ Commands :
/
/ To buy flamethrower You can use chat messages too.
/ say /bft to buy flamethrower
/ or say_team /bft
/
/
/
/ Credits :
/
/ Cheap_Suit - For his flamethrower plugin. :)
/
/
/
/ Changelog :
/
/ 29/10/2008 - v0.1 - First release
/
/
/
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include < fun >
#include <csx>
#include < xs >
#include <zombieplague>
new wpn_ft
new sprite_fire, sprite_burn, sprite_xplo
new g_freezetime,g_restarted
new Float:g_starttime, Float:g_Delay[33]
new g_enabled, g_client_buy, g_damage, g_xplode_dmg, g_ft_cost, g_fuelcost, g_fueltank, g_fbuyzone
new g_buytime, g_damage_dis, g_splash_dis
new g_buyzone[33], g_FuelTank[33], g_Activated[33], g_hasFlamethrower[33],
g_FireFlamethrower[33], g_BuyFuel[33]
new g_item_name[] = { "Flamethrower" }
new g_itemid_flamethrower
static PLUGIN_NAME[] = "[ZP] Extra : Flamethrower"
static PLUGIN_AUTHOR[] = "The_Thing"
static PLUGIN_VERSION[] = "0.1"
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_cvar("ft_version", PLUGIN_VERSION, FCVAR_SERVER)
g_enabled = register_cvar("zp_ft_enable", "1")
g_client_buy = register_cvar("zp_ft_client_buy", "1")
g_fbuyzone = register_cvar("zp_ft_obey_buyzone", "0")
g_buytime = register_cvar("zp_ft_obey_buytime", "0")
g_ft_cost = register_cvar("zp_ft_cost", "37")
g_fuelcost = register_cvar("zp_ft_fuelcost", "5")
g_fueltank = register_cvar("zp_ft_fueltank", "50")
g_damage = register_cvar("zp_ft_damage", "34")
g_xplode_dmg = register_cvar("zp_ft_xplode_dmg", "30")
g_damage_dis = register_cvar("zp_ft_damage_dis", "100")
g_splash_dis = register_cvar("zp_ft_splash_dis", "40")
g_itemid_flamethrower = zp_register_extra_item(g_item_name, get_pcvar_num(g_ft_cost), ZP_TEAM_HUMAN)
register_clcmd("say /bft", "cmd_BuyFlamethrower", ADMIN_USER, "- Buys a flamethrower")
register_clcmd("say_team /bft", "cmd_BuyFlamethrower", ADMIN_USER, "- Buys a flamethrower")
register_clcmd("ft_give", "cmd_GiveFlamethrowers",ADMIN_BAN, "<@all/ct/t>/userid - Gives free flamethrowers")
register_event("DeathMsg", "Event_DeathMsg", "a")
register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
register_event("StatusIcon", "Event_BuyZone", "b", "2=buyzone")
register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0")
register_event("TextMsg", "Event_WeaponDrop", "be", "2=#Weapon_Cannot_Be_Dropped")
register_event("TextMsg", "Event_GameRestart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
register_logevent("LogEvent_RoundStart", 2, "0=World triggered", "1=Round_Start")
register_forward(FM_CmdStart, "fw_CmdStart")
register_forward(FM_PlayerPostThink, "fw_PlayerPostThink")
register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
register_think("flamethrower", "think_Flamethrower")
register_touch("flamethrower", "player", "touch_Flamethrower")
wpn_ft = custom_weapon_add("weapon_flamethrower", 0, "flamethrower")
if(!get_pcvar_num(g_enabled)) pause("ad", PLUGIN_NAME)
}
public plugin_precache()
{
precache_sound("flamethrower.wav")
precache_sound("items/ammopickup2.wav")
sprite_xplo = precache_model("sprites/zerogxplode.spr")
sprite_fire = precache_model("sprites/explode1.spr")
sprite_burn = precache_model("sprites/xfire.spr")
precache_model("models/v_knife.mdl")
precache_model("models/p_knife.mdl")
precache_model("models/shield/v_shield_knife.mdl")
precache_model("models/shield/p_shield_knife.mdl")
precache_model("models/w_flamethrower.mdl")
precache_model("models/v_flamethrower.mdl")
precache_model("models/p_flamethrower.mdl")
}
public zp_extra_item_selected(itemid, id)
{
if (itemid == g_itemid_flamethrower)
{
if ( is_user_alive(id) && !zp_get_user_zombie(id) )
{
g_hasFlamethrower[id] = 1
g_FuelTank[id] = get_pcvar_num(g_fueltank)
new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1])
if(weaponID == CSW_KNIFE)
{
g_Activated[id] = true
set_flamethrower_model(id)
}
client_cmd(id, "spk items/ammopickup2")
client_print(id, print_chat, "You bought a flamethrower (press 3 to use)")
}
}
}
public cmd_GiveFlamethrowers(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new Arg1[64], target
read_argv(1, Arg1, 63)
new adminName[32]
get_user_name(id, adminName, 31)
new targetTeam
new Players[32], iNum
if(Arg1[0] == '@')
{
if(equali(Arg1[1], "all"))
{
targetTeam = 0
get_players(Players, iNum, "a")
}
else if(equali(Arg1[1], "ct"))
{
targetTeam = 2
get_players(Players, iNum, "ae" , "ct")
}
for(new i = 0; i < iNum; ++i)
{
target = Players[i]
g_hasFlamethrower[target] = 1
g_FuelTank[target] = get_pcvar_num(g_fueltank)
new temp[2], weaponID = get_user_weapon(target, temp[0], temp[1])
if(weaponID == CSW_KNIFE)
{
g_Activated[target] = true
set_flamethrower_model(target)
}
client_cmd(target, "spk items/ammopickup2")
client_print(target, print_chat, "You have been given a flamethrower (press 3 to use)")
}
switch(targetTeam)
{
case 0: client_print(0, print_chat, "Admin: %s has given everyone a flamethrower", adminName)
case 1: client_print(0, print_chat, "Admin: %s has given all ct's a flamethrower", adminName)
}
}
else
{
target = cmd_target(id, Arg1, 0)
if(!is_user_connected(target) || !is_user_alive(target) || !zp_get_user_zombie(target))
return PLUGIN_HANDLED
new targetName[32]
get_user_name(target, targetName, 31)
g_hasFlamethrower[target] = 1
g_FuelTank[target] = get_pcvar_num(g_fueltank)
new temp[2], weaponID = get_user_weapon(target, temp[0], temp[1])
if(weaponID == CSW_KNIFE)
{
g_Activated[target] = true
set_flamethrower_model(target)
entity_set_int(id, EV_INT_weaponanim, 9)
}
client_cmd(target, "spk items/ammopickup2")
client_print(target, print_chat, "You have been given a flamethrower (press 3 to use)")
client_print(target, print_chat, "Admin: %s has given you a flamethrower", adminName)
}
return PLUGIN_HANDLED
}
public cmd_BuyFlamethrower(id)
{
if(!get_pcvar_num(g_client_buy))
return PLUGIN_CONTINUE
if(get_pcvar_num(g_fbuyzone))
{
if(!g_buyzone[id])
{
client_print(id, print_center, "You need to be in the buyzone")
return PLUGIN_HANDLED
}
}
if(get_pcvar_num(g_buytime))
{
new Float:fBuyTime = get_cvar_float("mp_buytime") * 60
if(!g_freezetime && (get_gametime() - g_starttime) > fBuyTime)
{
client_print(id, print_center, "%d seconds have passed.^nYou can't buy anything now!", floatround(fBuyTime))
return PLUGIN_HANDLED
}
}
new iMoney = zp_get_user_ammo_packs(id)
new iCost = get_pcvar_num(g_ft_cost)
if(!is_user_alive(id) && !zp_get_user_zombie(id))
client_print(id, print_center, "You cant buy when your dead!")
else if(g_hasFlamethrower[id])
client_print(id, print_center, "You already own that weapon.")
else if(iMoney < iCost)
client_print(id, print_center, "You don't have enough ammo packs! (%d)", iCost)
else
{
g_hasFlamethrower[id] = 1
g_FuelTank[id] = get_pcvar_num(g_fueltank)
new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1])
if(weaponID == CSW_KNIFE)
{
g_Activated[id] = true
set_flamethrower_model(id)
}
zp_set_user_ammo_packs(id, iMoney - iCost)
client_cmd(id, "spk items/ammopickup2")
client_print(id, print_chat, "You bought a flamethrower (press 3 to use)")
}
return PLUGIN_HANDLED
}
public Event_BuyZone(id)
{
g_buyzone[id] = read_data(1)
}
public Event_GameRestart()
{
g_restarted = 1
}
public Event_NewRound()
{
if(g_restarted)
{
new Players[32], iNum = 0
get_players(Players, iNum)
for(new i = 0; i < iNum; i++)
{
new id = Players[i]
g_FuelTank[id] = 1
g_Activated[id] = 1
g_hasFlamethrower[id] = 1
new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1])
if(weaponID == CSW_KNIFE) set_knife_model(id)
g_restarted = 0
}
}
new flamethrowers = -1
while((flamethrowers = find_ent_by_class(flamethrowers, "flamethrower")))
remove_entity(flamethrowers)
g_freezetime = 1
}
public LogEvent_RoundStart()
{
g_freezetime = 0
g_starttime = get_gametime()
}
public Event_WeaponDrop(id)
{
if(!is_user_alive(id) || !g_Activated[id])
return PLUGIN_CONTINUE
drop_flamethrower(id)
client_print(id, print_center, "")
return PLUGIN_HANDLED
}
public Event_DeathMsg()
{
new id = read_data(2)
if(!is_user_connected(id) || !g_hasFlamethrower[id] || !zp_get_user_zombie(id))
{
return PLUGIN_CONTINUE
}
drop_flamethrower(id)
return PLUGIN_CONTINUE
}
public Event_CurWeapon(id)
{
if(!is_user_alive(id) || !g_hasFlamethrower[id] || zp_get_user_zombie(id))
return PLUGIN_CONTINUE
new WeaponID = read_data(2)
switch(WeaponID)
{
case CSW_KNIFE:
{
set_task(0.3, "task_ActivateFlamethrower", id)
set_flamethrower_model(id)
entity_set_int(id, EV_INT_weaponanim, 9)
}
default: g_Activated[id] = 0
}
return PLUGIN_CONTINUE
}
public touch_Flamethrower(ent, id)
{
if(!is_valid_ent(ent) || !is_user_alive(id) || !zp_get_user_zombie(id))
return PLUGIN_CONTINUE
if(g_hasFlamethrower[id])
return PLUGIN_CONTINUE
if(has_shield(id))
return PLUGIN_CONTINUE
g_hasFlamethrower[id] = 1
client_cmd(id, "spk items/ammopickup2")
g_FuelTank[id] = entity_get_int(ent, EV_INT_iuser4)
show_fuel_percentage(id)
new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1])
if(weaponID == CSW_KNIFE)
{
g_Activated[id] = true
set_flamethrower_model(id)
entity_set_int(id, EV_INT_weaponanim, 9)
}
remove_entity(ent)
return PLUGIN_CONTINUE
}
public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
{
if(!g_hasFlamethrower[id] || !g_Activated[id])
return FMRES_IGNORED
set_cd(cd_handle, CD_ID, 0)
return FMRES_HANDLED
}
public fw_CmdStart(id, uc_handle, seed)
{
if(!g_hasFlamethrower[id] || !g_Activated[id])
return FMRES_IGNORED
new buttons = get_uc(uc_handle, UC_Buttons)
if(buttons & IN_ATTACK)
{
g_FireFlamethrower[id] = 1
buttons &= ~IN_ATTACK
set_uc(uc_handle, UC_Buttons, buttons)
} else
g_FireFlamethrower[id] = 0
if(buttons & IN_ATTACK2)
{
g_BuyFuel[id] = 1
buttons &= ~IN_ATTACK2
set_uc(uc_handle, UC_Buttons, buttons)
} else
g_BuyFuel[id] = 0
return FMRES_HANDLED
}
public fw_PlayerPostThink(id)
{
if(!is_user_connected(id) || !is_user_alive(id) || !zp_get_user_zombie(id))
return FMRES_IGNORED
if(!g_hasFlamethrower[id] || !g_Activated[id])
return FMRES_IGNORED
if(entity_get_int(id, EV_INT_waterlevel) > 1)
return FMRES_IGNORED
if(has_shield(id))
{
drop_flamethrower(id)
return FMRES_IGNORED
}
if(g_BuyFuel[id])
{
if((g_Delay[id] + 0.2) < get_gametime())
{
buy_fuel(id)
g_Delay[id] = get_gametime()
}
}
if(g_FireFlamethrower[id])
{
if(g_FuelTank[id] > 0)
{
if((g_Delay[id] + 0.2) < get_gametime())
{
g_FuelTank[id] -= 1
g_Delay[id] = get_gametime()
}
new Float:fOrigin[3], Float:fVelocity[3]
entity_get_vector(id,EV_VEC_origin, fOrigin)
VelocityByAim(id, 35, fVelocity)
new Float:fTemp[3], iFireOrigin[3]
xs_vec_add(fOrigin, fVelocity, fTemp)
FVecIVec(fTemp, iFireOrigin)
new Float:fFireVelocity[3], iFireVelocity[3]
VelocityByAim(id, get_pcvar_num(g_damage_dis), fFireVelocity)
FVecIVec(fFireVelocity, iFireVelocity)
create_flames_n_sounds(id, iFireOrigin, iFireVelocity)
new doDamage
switch(get_cvar_num("mp_friendlyfire"))
{
case 0: doDamage = 0
case 1: doDamage = 1
}
show_fuel_percentage(id)
direct_damage(id, doDamage)
indirect_damage(id, doDamage)
custom_weapon_shot(wpn_ft, id)
} else
client_print(id, print_center, "Out of Fuel")
}
return FMRES_IGNORED
}
public think_Flamethrower(ent)
{
if(is_valid_ent(ent) && entity_get_float(ent, EV_FL_health) < 950.0)
{
new Float:fOrigin[3], iOrigin[3]
entity_get_vector(ent, EV_VEC_origin, fOrigin)
FVecIVec(fOrigin, iOrigin)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(99)
write_short(ent)
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(3)
write_coord(iOrigin[0])
write_coord(iOrigin[1])
write_coord(iOrigin[2])
write_short(sprite_xplo)
write_byte(50)
write_byte(15)
write_byte(0)
message_end()
RadiusDamage(fOrigin, get_pcvar_num(g_xplode_dmg), entity_get_int(ent, EV_INT_iuser4))
remove_entity(ent)
}
if(is_valid_ent(ent)) entity_set_float(ent, EV_FL_nextthink, halflife_time() + 0.01)
}
public create_flames_n_sounds(id, origin[3], velocity[3])
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(120)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_coord(velocity[0])
write_coord(velocity[1])
write_coord(velocity[2] + 5)
write_short(sprite_fire)
write_byte(1)
write_byte(10)
write_byte(1)
write_byte(5)
message_end()
emit_sound(id, CHAN_WEAPON, "flamethrower.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
public direct_damage(id, doDamage)
{
new ent, body
get_user_aiming(id, ent, body, get_pcvar_num(g_damage_dis) + 500)
if(ent > 0 && is_user_alive(ent) && !zp_get_user_zombie(id))
{
if(!doDamage)
{
if(get_user_team(id) != get_user_team(ent))
{
damage_user(id, ent, get_pcvar_num(g_damage))
custom_weapon_dmg(wpn_ft, id, ent, get_pcvar_num(g_damage))
}
}
else
{
damage_user(id, ent, get_pcvar_num(g_damage))
custom_weapon_dmg(wpn_ft, id, ent, get_pcvar_num(g_damage))
}
}
}
public indirect_damage(id, doDamage)
{
new Players[32], iNum
get_players(Players, iNum, "a")
for(new i = 0; i < iNum; ++i) if(id != Players[i])
{
new target = Players[i]
new Float:fOrigin[3], Float:fOrigin2[3]
entity_get_vector(id,EV_VEC_origin, fOrigin)
entity_get_vector(target, EV_VEC_origin, fOrigin2)
new temp[3], Float:fAim[3]
get_user_origin(id, temp, 3)
IVecFVec(temp, fAim)
new Float:fDistance = get_pcvar_num(g_damage_dis) + 500.0
if(get_distance_f(fOrigin, fOrigin2) > fDistance)
continue
new iDistance = get_distance_to_line(fOrigin, fOrigin2, fAim)
if(iDistance > get_pcvar_num(g_splash_dis) || iDistance < 0 || !fm_is_ent_visible(id, target))
continue
if(!doDamage)
{
if(get_user_team(id) != get_user_team(target))
{
damage_user(id, target, get_pcvar_num(g_damage))
custom_weapon_dmg(wpn_ft, id, target, get_pcvar_num(g_damage))
}
}
else
{
damage_user(id, target, get_pcvar_num(g_damage) / 2)
custom_weapon_dmg(wpn_ft, id, target, get_pcvar_num(g_damage) / 2)
}
}
}
public buy_fuel(id)
{
if(get_pcvar_num(g_fbuyzone) && !g_buyzone[id])
return PLUGIN_CONTINUE
new Float:fBuyTime = get_cvar_float("mp_buytime") * 60
if(get_pcvar_num(g_buytime) && !g_freezetime
&& (get_gametime() - g_starttime) > fBuyTime)
return PLUGIN_CONTINUE
if(g_FuelTank[id] >= get_pcvar_num(g_fueltank))
return PLUGIN_CONTINUE
new iMoney = zp_get_user_ammo_packs(id)
new iCost = get_pcvar_num(g_fuelcost)
if(iMoney >= iCost)
{
g_FuelTank[id] += 1
show_fuel_percentage(id)
zp_set_user_ammo_packs(id, iMoney - iCost)
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public drop_flamethrower(id)
{
new Float:fVelocity[3], Float:fOrigin[3]
entity_get_vector(id, EV_VEC_origin, fOrigin)
VelocityByAim(id, 34, fVelocity)
fOrigin[0] += fVelocity[0]
fOrigin[1] += fVelocity[1]
VelocityByAim(id, 300, fVelocity)
new ent = create_entity("info_target")
if(is_valid_ent(ent))
{
entity_set_string(ent, EV_SZ_classname, "flamethrower")
entity_set_model(ent, "models/w_flamethrower.mdl")
entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
entity_set_vector(ent, EV_VEC_origin, fOrigin)
entity_set_vector(ent, EV_VEC_velocity, fVelocity)
entity_set_int(ent, EV_INT_iuser4, g_FuelTank[id])
entity_set_float(ent, EV_FL_takedamage, 1.0)
entity_set_float(ent, EV_FL_health, 1000.0)
entity_set_size(ent, Float:{-2.5, -2.5, -1.5}, Float:{2.5, 2.5, 1.5})
entity_set_float(ent, EV_FL_nextthink, halflife_time() + 0.01)
}
g_FuelTank[id] = 0
g_Activated[id] = 0
g_hasFlamethrower[id] = 0
if(has_shield(id))
set_shield_model(id)
else
set_knife_model(id)
return PLUGIN_CONTINUE
}
public task_ActivateFlamethrower(id)
{
if(!is_user_connected(id) || !is_user_alive(id) || !zp_get_user_zombie(id))
return PLUGIN_CONTINUE
new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1])
if(weaponID == CSW_KNIFE) g_Activated[id] = 1
return PLUGIN_CONTINUE
}
public show_fuel_percentage(id)
{
set_hudmessage(255, 170, 0, 0.91, 0.95, _, _, 1.0, _, _, 4)
show_hudmessage(id, "Fuel Tank: %d%%", get_percent(g_FuelTank[id], get_pcvar_num(g_fueltank)))
}
public set_flamethrower_model(id)
{
entity_set_string(id, EV_SZ_viewmodel, "models/v_flamethrower.mdl")
entity_set_string(id, EV_SZ_weaponmodel, "models/p_flamethrower.mdl")
}
public set_knife_model(id)
{
entity_set_string(id, EV_SZ_viewmodel, "models/v_knife.mdl")
entity_set_string(id, EV_SZ_weaponmodel, "models/p_knife.mdl")
}
public set_shield_model(id)
{
entity_set_string(id, EV_SZ_viewmodel, "models/shield/v_shield_knife.mdl")
entity_set_string(id, EV_SZ_weaponmodel, "models/shield/p_shield_knife.mdl")
}
stock damage_user(id, victim, damage)
{
new iHealth = get_user_health(victim)
if(iHealth > damage)
fakedamage(victim, "weapon_flamethrower", float(damage), DMG_BURN)
else
{
user_silentkill(victim)
make_deathmsg(id, victim, 0, "flamethrower")
new iOrigin[3]
get_user_origin(victim, iOrigin, 0)
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(17)
write_coord(iOrigin[0])
write_coord(iOrigin[1])
write_coord(iOrigin[2] + 10)
write_short(sprite_burn)
write_byte(30)
write_byte(40)
message_end()
if(get_user_team(id) != get_user_team(victim))
{
set_user_frags(id, get_user_frags(id) + 3)
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 15)
}
else
{
set_user_frags(id, get_user_frags(id) - 0)
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - 2)
}
message_begin(MSG_ALL, get_user_msgid("ScoreInfo"))
write_byte(id)
write_short(get_user_frags(id))
write_short(get_user_deaths(id))
write_short(0)
write_short(get_user_team(id))
message_end()
message_begin(MSG_ALL, get_user_msgid("ScoreInfo"))
write_byte(victim)
write_short(get_user_frags(victim))
write_short(get_user_deaths(victim))
write_short(0)
write_short(get_user_team(victim))
message_end()
}
}
stock get_percent(value, tvalue) {
return floatround(floatmul(float(value) / float(tvalue) , 100.0))
}
stock get_distance_to_line(Float:pos_start[3], Float:pos_end[3], Float:pos_object[3])
{
new Float:vec_start_end[3], Float:vec_start_object[3], Float:vec_end_object[3], Float:vec_end_start[3]
xs_vec_sub(pos_end, pos_start, vec_start_end) // vector from start to end
xs_vec_sub(pos_object, pos_start, vec_start_object) // vector from end to object
xs_vec_sub(pos_start, pos_end, vec_end_start) // vector from end to start
xs_vec_sub(pos_end, pos_object, vec_end_object) // vector object to end
new Float:len_start_object = getVecLen(vec_start_object)
new Float:angle_start = floatacos(xs_vec_dot(vec_start_end, vec_start_object) / (getVecLen(vec_start_end) * len_start_object), degrees)
new Float:angle_end = floatacos(xs_vec_dot(vec_end_start, vec_end_object) / (getVecLen(vec_end_start) * getVecLen(vec_end_object)), degrees)
if(angle_start <= 90.0 && angle_end <= 90.0)
return floatround(len_start_object * floatsin(angle_start, degrees))
return -1
}
stock Float:getVecLen(Float:Vec[3])
{
new Float:VecNull[3] = {0.0, 0.0, 0.0}
new Float:len = get_distance_f(Vec, VecNull)
return len
}
stock bool:fm_is_ent_visible(index, entity)
{
new Float:origin[3], Float:view_ofs[3], Float:eyespos[3]
pev(index, pev_origin, origin)
pev(index, pev_view_ofs, view_ofs)
xs_vec_add(origin, view_ofs, eyespos)
new Float:entpos[3]
pev(entity, pev_origin, entpos)
engfunc(EngFunc_TraceLine, eyespos, entpos, 0, index)
switch(pev(entity, pev_solid)) {
case SOLID_BBOX..SOLID_BSP: return global_get(glb_trace_ent) == entity
}
new Float:fraction
global_get(glb_trace_fraction, fraction)
if(fraction == 1.0)
return true
return false
}
stock bool:has_shield(id)
{
new modelName[32]
entity_get_string(id, EV_SZ_viewmodel, modelName, 31)
if(containi(modelName, "v_shield_") != -1)
return true
return false
}
Download: Clique Aqui
Compra um Lança Chamas, que pode ser comprado pelo Menu Extra, ou se preferir escrever no say: /bft
Créditos: Zombie-mod.ru