text
stringlengths 0
692
|
---|
get_weaponname(weapon, ent_class, sizeof ent_class - 1) |
} |
new ent_weap = fm_find_ent_by_owner(-1, ent_class, index) |
if (!ent_weap) |
return false |
engclient_cmd(index, "drop", ent_class) |
new ent_box = pev(ent_weap, pev_owner) |
if (!ent_box || ent_box == index) |
return false |
dllfunc(DLLFunc_Think, ent_box) |
return true |
} |
// only weapon index or its name can be passed, if neither is passed then the current gun will be transferred |
stock bool:fm_transfer_user_gun(index1, index2, wid = 0, const wname[] = "") { |
new ent_class[32] |
if (!wid && wname[0]) |
copy(ent_class, sizeof ent_class - 1, wname) |
else { |
new weapon = wid, clip, ammo |
if (!weapon && !(weapon = get_user_weapon(index1, clip, ammo))) |
return false |
get_weaponname(weapon, ent_class, sizeof ent_class - 1) |
} |
new ent_weap = fm_find_ent_by_owner(-1, ent_class, index1) |
if (!ent_weap) |
return false |
engclient_cmd(index1, "drop", ent_class) |
new ent_box = pev(ent_weap, pev_owner) |
if (!ent_box || ent_box == index1) |
return false |
set_pev(ent_box, pev_flags, pev(ent_box, pev_flags) | FL_ONGROUND) |
dllfunc(DLLFunc_Touch, ent_box, index2) |
if (pev(ent_weap, pev_owner) != index2) |
return false |
return true |
} |
stock bool:fm_is_ent_visible(index, entity, ignoremonsters = 0) { |
new Float:start[3], Float:dest[3] |
pev(index, pev_origin, start) |
pev(index, pev_view_ofs, dest) |
xs_vec_add(start, dest, start) |
pev(entity, pev_origin, dest) |
engfunc(EngFunc_TraceLine, start, dest, ignoremonsters, index, 0) |
new Float:fraction |
get_tr2(0, TR_flFraction, fraction) |
if (fraction == 1.0 || get_tr2(0, TR_pHit) == entity) |
return true |
return false |
} |
// ported from AMXX's core get_user_origin(..., 3) (suggested by Greenberet) |
stock fm_get_aim_origin(index, Float:origin[3]) { |
new Float:start[3], Float:view_ofs[3] |
pev(index, pev_origin, start) |
pev(index, pev_view_ofs, view_ofs) |
xs_vec_add(start, view_ofs, start) |
new Float:dest[3] |
pev(index, pev_v_angle, dest) |
engfunc(EngFunc_MakeVectors, dest) |
global_get(glb_v_forward, dest) |
xs_vec_mul_scalar(dest, 9999.0, dest) |
xs_vec_add(start, dest, dest) |
engfunc(EngFunc_TraceLine, start, dest, 0, index, 0) |
get_tr2(0, TR_vecEndPos, origin) |
return 1 |
} |
stock bool:fm_get_user_longjump(index) { |
new value[2] |
engfunc(EngFunc_GetPhysicsKeyValue, index, "slj", value, 1) |
switch (value[0]) { |
case '1': return true |
} |
return false |
} |
stock fm_set_user_longjump(index, bool:longjump = true, bool:tempicon = true) { |
if (longjump == fm_get_user_longjump(index)) |
return |