Quote:
Originally Posted by amirwolf
I don't know much about this mod
But I'm sure what you want is the default in this mode
I mean the class selection menu is always open and only applies when you respawn
|
It only appears when it is infected, that is, once per round, right?
so I created this command here
Say /class
Code:
register_clcmd("say /class", "show_menu_class_zombie")
right when the player types /class the menu opens, but then it's the same thing as when the player is infected, the player chooses the class and another zm is instantly generated with 100% health, and this is wrong, because if the player is almost dying he will do this infinitely, thus making him immortal
I don't know what's wrong, maybe I need to create another script, what comes in the mod is this one, take a look
Make Zombie Random
Code:
// Make Zombie Random
public make_random_zombie()
{
// Give Team player
give_team_player()
// check total player
static total_players
total_players = GetTotalPlayer(0, 1)
if (!total_players) return;
// Ramdom zombie
static total_zombie, zombie_random, num_a, size_zb = 8
num_a = total_players % size_zb
total_zombie = (total_players-num_a)/size_zb
if (num_a) total_zombie += 1
if (!total_zombie) total_zombie = 1
// get damage for zombie random
new humans = total_players - total_zombie
new zombie_random_dmg = (humans*1000)/total_zombie
if (zombie_random_dmg < MIN_HEALTH_ZOMBIE_RANDOM) zombie_random_dmg = MIN_HEALTH_ZOMBIE_RANDOM
else if (zombie_random_dmg > MAX_HEALTH_ZOMBIE_RANDOM) zombie_random_dmg = MAX_HEALTH_ZOMBIE_RANDOM
// make random
new zombies_name[64]
for (new i = 1; i <= total_zombie; i++)
{
// get id zombie random
zombie_random = fnGetRandomPlayer()
//zombie_random = 1
// set star health armor od random zombie
g_level[zombie_random] = LEVEL_ZOMBIE_RANDOM
// make zombie
g_zombieclass[zombie_random] = random(class_count)
make_zombie(zombie_random)
// show menu class zombie
show_menu_class_zombie(zombie_random)
// give health
g_start_health[zombie_random] = zombie_random_dmg
g_star_armor[zombie_random] = zombie_random_dmg/2
fm_set_user_health(zombie_random, g_start_health[zombie_random])
fm_set_user_armor(zombie_random, g_star_armor[zombie_random])
// play sound human death
new sound[64], sex
sex = nst_get_user_sex(zombie_random)
if (sex == 2) ArrayGetString(sound_female_death, random(ArraySize(sound_female_death)), sound, charsmax(sound))
else ArrayGetString(sound_human_death, random(ArraySize(sound_human_death)), sound, charsmax(sound))
PlayEmitSound(zombie_random, CHAN_VOICE, sound)
// play sound zombie coming
ArrayGetString(sound_zombie_coming, random(ArraySize(sound_zombie_coming)), sound, charsmax(sound))
PlaySound(0, sound)
// Post user infect forward
ExecuteForward(g_fwUserInfected, g_fwDummyResult, zombie_random, 0)
// get hud msg zombies
new zombie_name[32]
get_user_name(zombie_random, zombie_name, 31)
if (i==1) format(zombies_name, charsmax(zombies_name), "%s", zombie_name)
else format(zombies_name, charsmax(zombies_name), "%s - %s", zombies_name, zombie_name)
}
menu class zombie
Code:
// menu class zombie
public show_menu_class_zombie(id)
{
if (!g_zombie[id]) return PLUGIN_HANDLED
// create menu wpn
new menuwpn_title[64]
format(menuwpn_title, 63, "[NST Zombie] %L:", LANG_PLAYER, "ZB3_MENU_CLASSZOMBIE_TITLE")
new mHandleID = menu_create(menuwpn_title, "select_class_zombie")
new class_name[32], class_id[32]
for (new i = 0; i < class_count; i++)
{
ArrayGetString(zombie_name, i, class_name, charsmax(class_name))
formatex(class_id, charsmax(class_name), "%i", i)
menu_additem(mHandleID, class_name, class_id, 0)
}
menu_display(id, mHandleID, 0)
return PLUGIN_HANDLED
}
public select_class_zombie(id, menu, item)
{
if (!g_zombie[id]) return PLUGIN_HANDLED
if (item == MENU_EXIT)
{
menu_destroy(menu)
give_zombiebom(id)
return PLUGIN_HANDLED
}
new idclass[32], name[32], access
menu_item_getinfo(menu, item, access, idclass, 31, name, 31, access)
// set class zombie
g_zombieclass[id] = str_to_num(idclass)
make_zombie(id)
give_zombiebom(id)
menu_destroy(menu)
//client_print(id, print_chat, "item: %i - id: %s", name, idclass)
return PLUGIN_HANDLED
}