text
stringlengths 0
692
|
---|
if (longjump) { |
engfunc(EngFunc_SetPhysicsKeyValue, index, "slj", "1") |
if (tempicon) { |
static msgid_itempickup |
if (!msgid_itempickup) |
msgid_itempickup = get_user_msgid("ItemPickup") |
message_begin(MSG_ONE, msgid_itempickup, _, index) |
write_string("item_longjump") |
message_end() |
} |
} |
else |
engfunc(EngFunc_SetPhysicsKeyValue, index, "slj", "0") |
} |
#define WEAPON_SUIT 31 |
stock bool:fm_get_user_suit(index) { |
return bool:(!(!(pev(index, pev_weapons) & (1<<WEAPON_SUIT)))) // i'm not insane, this is a trick! |
} |
stock fm_set_user_suit(index, bool:suit = true, bool:sound = true) { |
new weapons = pev(index, pev_weapons) |
if (!suit) |
set_pev(index, pev_weapons, weapons & ~(1<<WEAPON_SUIT)) |
else if (!(weapons & (1<<WEAPON_SUIT))) { |
set_pev(index, pev_weapons, weapons | (1<<WEAPON_SUIT)) |
if (sound) |
emit_sound(index, CHAN_VOICE, "items/tr_kevlar.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) |
} |
} |
#define FEV_RELIABLE (1<<1) |
#define FEV_GLOBAL (1<<2) |
// removes all created decals and players' corpses from the world |
// set a specific index to remove decals only for the given client |
stock fm_cs_remove_decals(index = 0) { |
static eventindex_decal_reset |
if (!eventindex_decal_reset) |
eventindex_decal_reset = engfunc(EngFunc_PrecacheEvent, 1, "events/decal_reset.sc") |
new flags = FEV_RELIABLE |
if (!index) |
flags |= FEV_GLOBAL |
engfunc(EngFunc_PlaybackEvent, flags, index, eventindex_decal_reset, 0.0, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0}, 0.0, 0.0, 0, 0, 0, 0) |
} |
// checks whether the entity's classname is equal to the passed classname |
stock bool:fm_is_ent_classname(index, const classname[]) { |
if (!pev_valid(index)) |
return false |
new class[32] |
pev(index, pev_classname, class, sizeof class - 1) |
if (equal(class, classname)) |
return true |
return false |
} |
// the same as AMXX's core user_kill but fixes the issue when the scoreboard doesn't update immediately if flag is set to 1 |
stock fm_user_kill(index, flag = 0) { |
if (flag) { |
new Float:frags |
pev(index, pev_frags, frags) |
set_pev(index, pev_frags, ++frags) |
} |
dllfunc(DLLFunc_ClientKill, index) |
return 1 |
} |
// returns a degree angle between player-to-point and player's view vectors |
stock Float:fm_get_view_angle_diff(index, const Float:point[3]) { |
new Float:vec[3], Float:ofs[3], Float:aim[3] |
pev(index, pev_origin, vec) |
pev(index, pev_view_ofs, ofs) |
xs_vec_add(vec, ofs, vec) |
xs_vec_sub(point, vec, vec) |
xs_vec_normalize(vec, vec) |
pev(index, pev_v_angle, aim) |
engfunc(EngFunc_MakeVectors, aim) |
global_get(glb_v_forward, aim) |
return xs_vec_angle(vec, aim) |
} |
// gets a weapon type of the linked to weaponbox weapon_* entity |
stock fm_get_weaponbox_type(entity) { |
static max_clients, max_entities |
if (!max_clients) |
max_clients = global_get(glb_maxClients) |
if (!max_entities) |
max_entities = global_get(glb_maxEntities) |