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

Polymorph: Mod Manager


Post New Thread Reply   
 
Thread Tools Display Modes
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 01-10-2024 , 17:29   Re: Polymorph: Mod Manager
Reply With Quote #1091

It is better to say that one mode is selected from several modes
And that state can have different states
With a separate vote, it can be made more attractive so that I have more choice
__________________
amirwolf is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-10-2024 , 23:19   Re: Polymorph: Mod Manager
Reply With Quote #1092

Something like that would not be easily doable. It would require adding a bit of infrastructure if I'm thinking about it correctly (which I think I am). It's an interesting concept but not something I think I'd have time to implement. The best option you'd have is to add each combination as an independent mods:
  1. Basebuilder
  2. Zombie Run
  3. Zombie Match
  4. Zombie Nad
  5. Pub
  6. Fun

So, as it is now, that's the best you can do.
__________________
fysiks is offline
Siska1
Senior Member
Join Date: Feb 2020
Location: BedRock
Old 01-27-2024 , 02:01   Re: Polymorph: Mod Manager
Reply With Quote #1093

When there are two people in the server and only one votes to change the mod, then the other player leaves the server and only one remains, but when he again writes a command to change the mod, it says that it has already been voted on and it is not possible to change the mod, except , if I log out of the server and log back in. It says 0 players still need to vote for the mod to change. Now I noticed this thing.
__________________
Siska1 is offline
Send a message via Skype™ to Siska1
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-27-2024 , 17:11   Re: Polymorph: Mod Manager
Reply With Quote #1094

What plugin are you using to "vote to change the mod"?
__________________
fysiks is offline
Siska1
Senior Member
Join Date: Feb 2020
Location: BedRock
Old 01-27-2024 , 20:33   Re: Polymorph: Mod Manager
Reply With Quote #1095

i think that was the option
Code:
/*
 *	RockTheVote for Polymorph
 *	Requires Polymorph v0.8.2 or later
 *
 */

#include <amxmodx>
#include <amxmisc>
// #include <polymorph>

native polyn_votemod()

new bool:g_rockedVote[33], g_rockedVoteCnt
new bool:g_hasbeenrocked = false

// Cvars
new cvar_rtv_enabled
new cvar_rtv_ratio
new cvar_rtv_wait
new cvar_rtv_show

//Sound path

new const SOUND[] = "ambience/start.wav"

public plugin_init()
{
	register_plugin("Polymorph: RockTheVote", "1.0", "Fysiks")
	
	register_clcmd("amx_rtv","cmdAdminRTV", ADMIN_MAP, " Manually RockTheVote")
	register_clcmd("say /mod", "cmdSayRTV")
	
	// Cvars
	cvar_rtv_enabled = register_cvar("rtv_enable", "1")	// <0|1>
	cvar_rtv_ratio = register_cvar("rtv_ratio", "0.51")		// Use amx_votemap_ratio?
	cvar_rtv_wait = register_cvar("rtv_wait", "1")			// Minutes after mapstart you can rtv
	cvar_rtv_show = register_cvar("rtv_show", "1")		// Display how many more votes needed to rtv
}
public plugin_precache()
{
	precache_sound(SOUND);
}
public cmdAdminRTV(id, level, cid)
{
	if(!cmd_access(id,level,cid,1))
		return PLUGIN_HANDLED
	
	if(g_hasbeenrocked)
	{
		client_print(id,print_console,"[MG] Vote has already been rocked")
	}
	else
	{
		g_hasbeenrocked = true
		new admin_name[32]
		get_user_name(id, admin_name, 31)
		show_activity(id, admin_name, "has RockedTheVote")
		client_print(id,print_console, "[MG] You have a Mod change")
		set_task(6.2,"announce_vote")
		set_task(5.0,"startRockVote")
	}
	// Add functionality to cancel rocked vote.
	return PLUGIN_HANDLED
}

public client_connect(id)
{
	g_rockedVote[id] = false
}

public client_disconnected(id)
{
	if(g_rockedVote[id])
	{
		g_rockedVote[id] = false
		g_rockedVoteCnt--
	}
}

public cmdSayRTV(id)
{
	if(!get_pcvar_num(cvar_rtv_enabled))
		return PLUGIN_CONTINUE // PLUGIN_HANDLED
	
	if(g_hasbeenrocked)
	{
		client_print(id, print_chat, "[MG] Vote has already been started.")
		return PLUGIN_HANDLED
	}
	
	if(g_rockedVote[id])
	{
		client_print(id, print_chat, "[MG] You already voted.")
		rtv_remind()
		return PLUGIN_CONTINUE  // PLUGIN_HANDLED for blind?
	}
	
	new Float:vote_wait = get_pcvar_float(cvar_rtv_wait)
	new Float:time_elapsed = get_cvar_float("mp_timelimit") - (float( get_timeleft() ) / 60.0) // Use get_gametime
	
	if( time_elapsed < vote_wait )
	{
		// Can replace all this content with "You cannot change Mod yet."
		// which would require no if statement or calculations.
		
		new Float:time_til_votebegin =  vote_wait - time_elapsed
		if(time_til_votebegin > 1.0)
		{
			new min_to_vote = clamp(floatround(time_til_votebegin),1,floatround(vote_wait))
			client_print(id, print_chat, "[MG] You cannot change Mod for %d more minute%s.", min_to_vote, min_to_vote > 1 ? "s" : "" )
		}
		else // time_til_votebegin <= 1 minute
		{
			client_print(id, print_chat, "[MG] You cannot change Mod for %d more seconds.", floatround(time_til_votebegin * 60) )
		}
		
		return PLUGIN_HANDLED
	}
	
	if(get_timeleft() < 120 ) // don't allow rtv 2 minutes before map ends
	{
		client_print(id, print_chat, "[MG] Too Late to change Mod.")
		return PLUGIN_HANDLED
	}
	
	// You (id) just voted to rock.
	g_rockedVote[id] = true
	g_rockedVoteCnt++
	client_print(id,print_chat, "[MG] You chose to change Mod")
	
	if( g_rockedVoteCnt >= get_RocksNeeded() ) 	// Decide if we rock the vote
	{
		g_hasbeenrocked = true
		client_print(0,print_chat, "[MG] The Vote has been started!")
		set_task(6.2,"announce_vote")
		set_task(5.0,"startRockVote")
	}
	else
	{
		rtv_remind()
	}
	
	return PLUGIN_CONTINUE
}

public startRockVote()
{
	polyn_votemod()
}

get_RocksNeeded()
{
	return floatround(get_pcvar_float(cvar_rtv_ratio) * float(get_realplayersnum()), floatround_ceil);
}

stock get_realplayersnum()
{
	new players[32], playerCnt;
	get_players(players, playerCnt, "ch");
	
	return playerCnt;
}

rtv_remind()
{
	if(get_pcvar_num(cvar_rtv_show))
	{  // Not tested yet.
		client_print(0,print_chat, "[MG] Need %d more players to change Mod.", get_RocksNeeded() - g_rockedVoteCnt)
	}
}

public announce_vote()
{
	emit_sound(0, CHAN_AUTO, SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}
__________________
Siska1 is offline
Send a message via Skype™ to Siska1
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-27-2024 , 21:55   Re: Polymorph: Mod Manager
Reply With Quote #1096

Ok, so I think you just want to re-evaluate the RTV condition when players leave. So, I would probably make these changes (this is the diff file of the changes):

PHP Code:
@@ -75,+75,@@ public client_disconnected(id)
         
g_rockedVote[id] = false
         g_rockedVoteCnt
--
     }
+
+    
check_rock_the_vote()
 }
 
 public 
cmdSayRTV(id)
@@ -
128,+130,13 @@ public cmdSayRTV(id)
     
g_rockedVoteCnt++
     
client_print(id,print_chat"[MG] You chose to change Mod")
     
+    
check_rock_the_vote()
+
+    return 
PLUGIN_CONTINUE
+}
+
+
check_rock_the_vote()
+{
     if( 
g_rockedVoteCnt >= get_RocksNeeded() )     // Decide if we rock the vote
     
{
         
g_hasbeenrocked true
@@ -139,+148,@@ public cmdSayRTV(id)
     {
         
rtv_remind()
     }
-    
-    return 
PLUGIN_CONTINUE
 
}
 
 public 
startRockVote() 
__________________
fysiks is offline
Siska1
Senior Member
Join Date: Feb 2020
Location: BedRock
Old 01-28-2024 , 07:02   Re: Polymorph: Mod Manager
Reply With Quote #1097

The mods started to change by themselves, despite the fact that there are two people in the server, it says that 4 are needed, and yet the mod changes by itself at the beginning of each map
__________________
Siska1 is offline
Send a message via Skype™ to Siska1
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-28-2024 , 22:52   Re: Polymorph: Mod Manager
Reply With Quote #1098

This plugin doesn't change the mod, it just starts the vote. It might be that there needs to be additional checks moved into the new function to make sure it accounts for some of the other conditions that are taken care of sooner in the original RTV function. Maybe something like:

Code:
check_rock_the_vote()
{
	if( g_rockedVoteCnt >= get_RocksNeeded() && !(get_timeleft() < 120) && get_pcvar_num(cvar_rtv_enabled) && ~g_hasbeenrocked ) 	// Decide if we rock the vote
I wonder if it might also need something to prevent it from running toward the beginning of the map. I haven't really had time to test these so I can't guarantee that it won't have bugs.
__________________

Last edited by fysiks; 01-28-2024 at 22:55.
fysiks is offline
Siska1
Senior Member
Join Date: Feb 2020
Location: BedRock
Old 01-29-2024 , 07:15   Re: Polymorph: Mod Manager
Reply With Quote #1099

It continues to draw a vote and change without anyone pressing anything.
This is what I did take a look if you get a chance :
Code:
#include <amxmodx>
#include <amxmisc>
// #include <polymorph>

native polyn_votemod()

new bool:g_rockedVote[33], g_rockedVoteCnt
new bool:g_hasbeenrocked = false

// Cvars
new cvar_rtv_enabled
new cvar_rtv_ratio
new cvar_rtv_wait
new cvar_rtv_show

//Sound path

new const SOUND[] = "ambience/start.wav"

public plugin_init()
{
	register_plugin("Polymorph: RockTheVote", "1.0", "Fysiks")
	
	register_clcmd("amx_rtv","cmdAdminRTV", ADMIN_MAP, " Manually RockTheVote")
	register_clcmd("say /mod", "cmdSayRTV")
	
	// Cvars
	cvar_rtv_enabled = register_cvar("rtv_enable", "1")	// <0|1>
	cvar_rtv_ratio = register_cvar("rtv_ratio", "0.51")		// Use amx_votemap_ratio?
	cvar_rtv_wait = register_cvar("rtv_wait", "1")			// Minutes after mapstart you can rtv
	cvar_rtv_show = register_cvar("rtv_show", "1")		// Display how many more votes needed to rtv
}
public plugin_precache()
{
	precache_sound(SOUND);
}
public cmdAdminRTV(id, level, cid)
{
	if(!cmd_access(id,level,cid,1))
		return PLUGIN_HANDLED
	
	if(g_hasbeenrocked)
	{
		client_print(id,print_console,"[MG] Vote has already been rocked")
	}
	else
	{
		g_hasbeenrocked = true
		new admin_name[32]
		get_user_name(id, admin_name, 31)
		show_activity(id, admin_name, "has RockedTheVote")
		client_print(id,print_console, "[MG] You have a Mod change")
		set_task(6.2,"announce_vote")
		set_task(5.0,"startRockVote")
	}
	// Add functionality to cancel rocked vote.
	return PLUGIN_HANDLED
}

public client_connect(id)
{
	g_rockedVote[id] = false
}

public client_disconnected(id)
{
	if(g_rockedVote[id])
	{
		g_rockedVote[id] = false
		g_rockedVoteCnt--
	}
	
	check_rock_the_vote();
}

public cmdSayRTV(id)
{
	if(!get_pcvar_num(cvar_rtv_enabled))
		return PLUGIN_CONTINUE // PLUGIN_HANDLED
	
	if(g_hasbeenrocked)
	{
		client_print(id, print_chat, "[MG] Vote has already been started.")
		return PLUGIN_HANDLED
	}
	
	if(g_rockedVote[id])
	{
		client_print(id, print_chat, "[MG] You already voted.")
		rtv_remind()
		return PLUGIN_CONTINUE  // PLUGIN_HANDLED for blind?
	}
	
	new Float:vote_wait = get_pcvar_float(cvar_rtv_wait)
	new Float:time_elapsed = get_cvar_float("mp_timelimit") - (float( get_timeleft() ) / 60.0) // Use get_gametime
	
	if( time_elapsed < vote_wait )
	{
		// Can replace all this content with "You cannot change Mod yet."
		// which would require no if statement or calculations.
		
		new Float:time_til_votebegin =  vote_wait - time_elapsed
		if(time_til_votebegin > 1.0)
		{
			new min_to_vote = clamp(floatround(time_til_votebegin),1,floatround(vote_wait))
			client_print(id, print_chat, "[MG] You cannot change Mod for %d more minute%s.", min_to_vote, min_to_vote > 1 ? "s" : "" )
		}
		else // time_til_votebegin <= 1 minute
		{
			client_print(id, print_chat, "[MG] You cannot change Mod for %d more seconds.", floatround(time_til_votebegin * 60) )
		}
		
		return PLUGIN_HANDLED
	}
	
	if(get_timeleft() < 120 ) // don't allow rtv 2 minutes before map ends
	{
		client_print(id, print_chat, "[MG] Too Late to change Mod.")
		return PLUGIN_HANDLED
	}
	
	// You (id) just voted to rock.
	g_rockedVote[id] = true
	g_rockedVoteCnt++
	client_print(id,print_chat, "[MG] You chose to change Mod")
	
	check_rock_the_vote();
	
	return PLUGIN_CONTINUE
}

public startRockVote()
{
	polyn_votemod()
}

get_RocksNeeded()
{
	return floatround(get_pcvar_float(cvar_rtv_ratio) * float(get_realplayersnum()), floatround_ceil);
}

stock get_realplayersnum()
{
	new players[32], playerCnt;
	get_players(players, playerCnt, "ch");
	
	return playerCnt;
}

rtv_remind()
{
	if(get_pcvar_num(cvar_rtv_show))
	{  // Not tested yet.
		client_print(0,print_chat, "[MG] Need %d more players to change Mod.", get_RocksNeeded() - g_rockedVoteCnt)
	}
}

public announce_vote()
{
	emit_sound(0, CHAN_AUTO, SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}

check_rock_the_vote()
{
	if( g_rockedVoteCnt >= get_RocksNeeded() && !(get_timeleft() < 120) && get_pcvar_num(cvar_rtv_enabled) && !g_hasbeenrocked ) 	// Decide if we rock the vote
	{
		g_hasbeenrocked = true
		client_print(0,print_chat, "[MG] The Vote has been started!")
		set_task(6.2,"announce_vote")
		set_task(5.0,"startRockVote")
	}
	else
	{
		rtv_remind()
	}
}
__________________
Siska1 is offline
Send a message via Skype™ to Siska1
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 07:44.


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