text
stringlengths 0
692
|
---|
return speed |
} |
stock fm_set_user_gravity(index, Float:gravity = 1.0) { |
set_pev(index, pev_gravity, gravity) |
return 1 |
} |
stock Float:fm_get_user_gravity(index) { |
new Float:gravity |
pev(index, pev_gravity, gravity) |
return gravity |
} |
/* interferes with FM_Spawn enum, just use fm_DispatchSpawn |
stock fm_spawn(entity) { |
return dllfunc(DLLFunc_Spawn, entity) |
} |
*/ |
stock fm_set_user_noclip(index, noclip = 0) { |
set_pev(index, pev_movetype, noclip == 1 ? MOVETYPE_NOCLIP : MOVETYPE_WALK) |
return 1 |
} |
#define fm_get_user_noclip(%1) (pev(%1, pev_movetype) == MOVETYPE_NOCLIP) |
/* stock fm_get_user_noclip(index) |
return (pev(index, pev_movetype) == MOVETYPE_NOCLIP) */ |
// note: get_user_weapon will still return former weapon index |
stock fm_strip_user_weapons(index) { |
new ent = fm_create_entity("player_weaponstrip") |
if (!pev_valid(ent)) |
return 0 |
dllfunc(DLLFunc_Spawn, ent) |
dllfunc(DLLFunc_Use, ent, index) |
engfunc(EngFunc_RemoveEntity, ent) |
return 1 |
} |
stock fm_set_user_frags(index, frags) { |
set_pev(index, pev_frags, float(frags)) |
return 1 |
} |
/* Cstrike functions */ |
stock fm_cs_user_spawn(index) { |
set_pev(index, pev_deadflag, DEAD_RESPAWNABLE) |
dllfunc(DLLFunc_Spawn, index) |
set_pev(index, pev_iuser1, 0) |
return 1 |
} |
/* Custom functions */ |
// based on Basic-Master's set_keyvalue, upgraded version accepts an optional classname (a bit more efficient if it is passed) |
stock fm_set_kvd(entity, const key[], const value[], const classname[] = "") { |
if (classname[0]) |
set_kvd(0, KV_ClassName, classname) |
else { |
new class[32] |
pev(entity, pev_classname, class, sizeof class - 1) |
set_kvd(0, KV_ClassName, class) |
} |
set_kvd(0, KV_KeyName, key) |
set_kvd(0, KV_Value, value) |
set_kvd(0, KV_fHandled, 0) |
return dllfunc(DLLFunc_KeyValue, entity, 0) |
} |
stock fm_find_ent_by_integer(index, pev_field, value) { |
static maxents |
if (!maxents) |
maxents = global_get(glb_maxEntities) |
for (new i = index + 1; i < maxents; ++i) { |
if (pev_valid(i) && pev(i, pev_field) == value) |
return i |
} |
return 0 |
} |
stock fm_find_ent_by_flags(index, pev_field, flags) { |
static maxents |
if (!maxents) |
maxents = global_get(glb_maxEntities) |