Raised This Month: $51 Target: $400
 12% 

Help / Support After choosing the class zm only takes effect when reborn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Noah BR
Junior Member
Join Date: Mar 2024
Old 03-17-2024 , 13:26   After choosing the class zm only takes effect when reborn
Reply With Quote #1

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

Last edited by Noah BR; 03-19-2024 at 17:42.
Noah BR is offline
Noah BR
Junior Member
Join Date: Mar 2024
Old 03-19-2024 , 11:47   Re: Zombie class selection for next round
Reply With Quote #2

Someone to help me?
Noah BR is offline
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 03-19-2024 , 12:08   Re: Zombie class selection for next round
Reply With Quote #3

https://forums.alliedmods.net/showpo...04&postcount=7
__________________
amirwolf is offline
Noah BR
Junior Member
Join Date: Mar 2024
Old 03-19-2024 , 17:44   Re: Zombie class selection for next round
Reply With Quote #4

Quote:
Originally Posted by amirwolf View Post

I edited the post, my order was wrong, I want to say sorry
Noah BR is offline
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 03-20-2024 , 05:06   Re: After choosing the class zm only takes effect when reborn
Reply With Quote #5

Just add respawn instead of new round
HTML Code:
RegisterHam(Ham_Spawn, "player", "playerspawn", 1)
__________________
amirwolf is offline
Noah BR
Junior Member
Join Date: Mar 2024
Old 03-20-2024 , 06:39   Re: After choosing the class zm only takes effect when reborn
Reply With Quote #6

Quote:
Originally Posted by amirwolf View Post
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?
Noah BR is offline
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 03-20-2024 , 07:42   Re: After choosing the class zm only takes effect when reborn
Reply With Quote #7

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 is offline
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 03-20-2024 , 07:49   Re: After choosing the class zm only takes effect when reborn
Reply With Quote #8

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
__________________
amirwolf is offline
Noah BR
Junior Member
Join Date: Mar 2024
Old 03-20-2024 , 07:54   Re: After choosing the class zm only takes effect when reborn
Reply With Quote #9

Quote:
Originally Posted by amirwolf View Post
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
}
Noah BR is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:16.


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