AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Help / Support After choosing the class zm only takes effect when reborn (https://forums.alliedmods.net/showthread.php?t=346788)

Noah BR 03-17-2024 13:26

After choosing the class zm only takes effect when reborn
 
So I'm having a problem on my server, I want when the player chooses the zombie class it only comes into effect after his death as a zombie

I want to let him make his first choice after being infected, but the moment he opens the menu again, his selection will only take effect only when he revives


***CODE BELOW***
Spoiler

Noah BR 03-19-2024 11:47

Re: Zombie class selection for next round
 
Someone to help me?

amirwolf 03-19-2024 12:08

Re: Zombie class selection for next round
 
https://forums.alliedmods.net/showpo...04&postcount=7

Noah BR 03-19-2024 17:44

Re: Zombie class selection for next round
 
Quote:

Originally Posted by amirwolf (Post 2819779)


I edited the post, my order was wrong, I want to say sorry

amirwolf 03-20-2024 05:06

Re: After choosing the class zm only takes effect when reborn
 
Just add respawn instead of new round
HTML Code:

RegisterHam(Ham_Spawn, "player", "playerspawn", 1)

Noah BR 03-20-2024 06:39

Re: After choosing the class zm only takes effect when reborn
 
Quote:

Originally Posted by amirwolf (Post 2819799)
Just add respawn instead of new round
HTML Code:

RegisterHam(Ham_Spawn, "player", "playerspawn", 1)

I need the menu to open at any time during the match, however I want players to make their first class choice when infected as the default, but the moment it opens again to choose another class, I want that class to take effect only when this player is reborn, understand?

amirwolf 03-20-2024 07:42

Re: After choosing the class zm only takes effect when reborn
 
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

amirwolf 03-20-2024 07:49

Re: After choosing the class zm only takes effect when reborn
 
Maybe if I say more correctly
The menu will only open when he has become a zombie
Applying the class property after each respawn is there by default

Noah BR 03-20-2024 07:54

Re: After choosing the class zm only takes effect when reborn
 
Quote:

Originally Posted by amirwolf (Post 2819802)
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
}



All times are GMT -4. The time now is 00:25.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.