Quote:
Originally Posted by Natsheh
PHP Code:
while (iKnife < iMaxKnife)
{
// Choose random guy
id = GetRandomAlive(random_num(1, alive_count))
// Already a survivor or nemesis?
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id))
continue;
// If not, turn him into one
zp_class_knifer_set(id)
iKnife++
// Apply Knife health multiplier
set_user_health(id, floatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_kni_hp_multi)))
}
try to think abit about the logic of this loop and how it will end ?
|
I did it following the way the plugin had already done like the others so I don't understand why the others that were already not crashing like the ones I add.
For example, this one that works without crashing
PHP Code:
// Turn specified amount of players into Snipers
new iSnipers, iMaxSnipers = sniper_count
while (iSnipers < iMaxSnipers)
{
// Choose random guy
id = GetRandomAlive(random_num(1, alive_count))
// Already a survivor or nemesis?
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) )
continue;
// If not, turn him into one
zp_class_sniper_set(id)
iSnipers++
// Apply sniper health multiplier
set_user_health(id, floatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_sniper_hp_multi)))
}
But you may have to make these changes to make it work.