Raised This Month: $23 Target: $400
 5% 

Req : change cvar + map when..


Post New Thread Reply   
 
Thread Tools Display Modes
Tote
Senior Member
Join Date: Jul 2023
Old 06-17-2024 , 01:34   Re: Req : change cvar + map when..
Reply With Quote #11

Quote:
Originally Posted by v120kaaimcfg View Post
What I meant is this:
Code:
#include <amxmodx>

new g_Under10, g_Over10, g_MapName[20], g_map

public plugin_init()
{
	register_plugin("", "", "")

	get_mapname(g_MapName, charsmax(g_MapName))

	set_task(4.5, "check_map")
	set_task(5.0, "check_players", .flags = "b")
}

public check_map()
{
	if(equali(g_MapName, "de_dust2"))
	{
		g_map = 1
		set_cvar_num("mp_timelimit", 25)
	}
	else if(equali(g_MapName, "fy_snow"))
	{
		g_map = 2
		set_cvar_num("mp_timelimit", 0)
	}
}

public check_players()
{
	if(get_playersnum() <= 10)
	{
		g_Under10++
		g_Over10 = 0
		if(g_Under10 > 4 && g_map != 2)
		{
			server_cmd("amx_map fy_snow")
		}
	}
	else
	{
		g_Under10 = 0
		g_Over10++
		if(g_Over10 > 4 && g_map != 1)
		{
			server_cmd("amx_map de_dust2")
		}
	}
}
Yeah, i said i understand. Its Kind of good idea.
But would be better if you actually check the players at round end would be More better. cuz gaining and losing players just in 1 round wont make any big difference. depends on if players stay more time or not [REMEMBER THIS IS ONLY IN CASE IF HE DOES NOT HAVE RESPAWN OR INFINITE ROUND SERVER]

still depends on what the guy who requested wants hh

And you don't need to remove the plugin author details no need to be a bravado, I don't care about this anyone can do this kind of stuff. Take the credits, you coded it.

Code:
#include <amxmodx>

new g_Under10, g_Over10, g_MapName[20], g_map

public plugin_init()
{
	register_plugin("", "", "")

	get_mapname(g_MapName, charsmax(g_MapName))

	set_task(4.5, "check_map")
	
	register_logevent("logevent_round_end", 2, "1=Round_End") 
}

public check_map()
{
	if(equali(g_MapName, "de_dust2"))
	{
		g_map = 1
		set_cvar_num("mp_timelimit", 25)
	}
	else if(equali(g_MapName, "fy_snow"))
	{
		g_map = 2
		set_cvar_num("mp_timelimit", 0)
	}
}

public logevent_round_end()
{
	if(get_playersnum() <= 10)
	{
		g_Under10++
		g_Over10 = 0
		client_print_color(0, 0, "^4[AMXX] The above 10 players warning has been removed as the players are under 10")
		if(g_Under10 == 4)
		{
			set_task(3.0, "display_warning2")
		}
		if(g_Under10 > 4 && g_map != 2)
		{
			server_cmd("changelevel fy_snow")
		}
	}
	else
	{
		g_Under10 = 0
		g_Over10++
		client_print_color(0, 0, "^4[AMXX] The 10, or below 10 players warning has been removed as the players are above 10")
		if(g_Over10 == 3)
		{
			set_task(3.0, "display_warning")
		}
		if(g_Over10 > 4 && g_map != 1)
		{
			server_cmd("changelevel de_dust2")
		}
	}
}

public display_warning()
{
	client_print_color(0, 0, "^4[AMXX] This is the last round, if players stay above 10, the map will be changed to de_dust2")
}
public display_warning2()
{
	client_print_color(0, 0, "^4[AMXX] This is the last round, if the players stay 10 or below 10, the map will be changed to fy_snow")
}
Now it's up to him whether he wants like this or like yours

Last edited by Tote; 06-17-2024 at 01:47.
Tote is offline
Old 06-17-2024, 07:43
v120kaaimcfg
This message has been deleted by v120kaaimcfg.
Reply


Thread Tools
Display Modes

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 13:57.


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