Raised This Month: $ Target: $400
 0% 

Map management plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
e12harry
Member
Join Date: Apr 2010
Old 07-16-2011 , 07:05   Map management plugin
Reply With Quote #1

Hello.
I have beed writing map management plugin. The plugin concept is to store maps settings in vault file. Each map has its minimum and maximum players num.
The plugin is almost finished (base functions) but i was reported some problems.
1. In some cases plugin displays votemap menu 2 times.
2. When there is no players on serwer map does not change when it should.
3. Votes arent always couted right.

Can anyone check this plugin and eliminate these bugs?
Maybe any sugestions on optimizing plugin?

In attahement there is :
.sma file
mm_maps.ini - maps configuration (place in configs directory)
mapmanagement.txt - language file (en & pl at the moment) (place in data/lang directory)

Is anyone interested in participating in this plugin?

To do:
- optimizing,
- votes count in menu while voting,
- managing maps settings through menu, without refreshing all maps
Attached Files
File Type: sma Get Plugin or Get Source (amx_mapmanagement.sma - 650 views - 38.6 KB)
File Type: txt mapmanagement.txt (6.2 KB, 192 views)
File Type: ini mm_maps.ini (878 Bytes, 129 views)
e12harry is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-16-2011 , 16:22   Re: Map management plugin
Reply With Quote #2

Optimization: Use pcvars.

I'm quite sure that set_task(get_timeleft() + 5.0, "changeMap", TASK_CHANGE_MAP); means that the function is set to run after the map has already changed.

You have it coded to vote twice under certain conditions.

What do you mean votes aren't counted correctly?

I can't find where you do anything about changing the map when there are zero players.
__________________
fysiks is offline
e12harry
Member
Join Date: Apr 2010
Old 07-16-2011 , 17:17   Re: Map management plugin
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
Optimization: Use pcvars.
I am using pcvars almost everwhere. Can I normaly use pcvar with mp_timelimit? and mp_roundtime?


Quote:
Originally Posted by fysiks View Post
You have it coded to vote twice under certain conditions.
Yes. If in first vote no map got more than 60% votes (cvar specified) There will be second vote with 2 most popular maps. In second vote wins map with more voices or first map if they have the same number of voices. Unfortunetly second vote sometimes is displayed twice.

Quote:
Originally Posted by fysiks View Post
What do you mean votes aren't counted correctly?
It is set that map wins in first vote if it gets 60% voices.
If there was 4 players and 3 voted fore aim_map it should win, but there was a second vote.

Quote:
Originally Posted by fysiks View Post
I can't find where you do anything about changing the map when there are zero players.
If there is no players then first map from random maps should win thw vote.

Map is changed after round start. If the map is fy, aim or awp round doesn't end unles both teams have players. That is why I use this:
set_task(get_timeleft() + 5.0, "changeMap", TASK_CHANGE_MAP);
I do not hava any other plugins connected with maps (galileo, nextmap, votemap)

Last edited by e12harry; 07-16-2011 at 17:27.
e12harry is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-16-2011 , 17:48   Re: Map management plugin
Reply With Quote #4

To use pcvars with existing cvars (mp_roundtime, ...) you'll have to use get_cvar_pointer();

Example:
PHP Code:
new cMpRoundtime;

public 
plugin_init()
    
cMpRoundtime get_cvar_pointer("mp_roundtime");


get_pcvar_num(cMpRoundtime); 
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-16-2011 , 17:58   Re: Map management plugin
Reply With Quote #5

Quote:
Originally Posted by e12harry View Post
Can I normaly use pcvar with mp_timelimit? and mp_roundtime?
(refering to drekes example) I personally, use get_cvar_pointer() in plugin_cfg().


Quote:
Originally Posted by e12harry View Post
Yes. If in first vote no map got more than 60% votes (cvar specified) There will be second vote with 2 most popular maps. In second vote wins map with more voices or first map if they have the same number of voices. Unfortunetly second vote sometimes is displayed twice.
I would probably separate the first and second votes (one set of function for each). I would also take the count down out of the vote function then just call the vote function when the count down is done. Trying to do different things in a single function can make things harder for you IMO.

Quote:
Originally Posted by e12harry View Post
It is set that map wins in first vote if it gets 60% voices.
If there was 4 players and 3 voted fore aim_map it should win, but there was a second vote.
I can't see anything wrong in the code so you need to get the value of all relevant variable involved to see if they are what you expect.

Quote:
Originally Posted by e12harry View Post
If there is no players then first map from random maps should win thw vote.
That should happen naturally.

Quote:
Originally Posted by e12harry View Post
set_task(get_timeleft() + 5.0, "changeMap", TASK_CHANGE_MAP);
If there is 30 seconds left in the map and you set a task for 35 seconds then it will never execute because the map will have changed already.
__________________

Last edited by fysiks; 07-16-2011 at 18:05.
fysiks is offline
e12harry
Member
Join Date: Apr 2010
Old 07-18-2011 , 03:03   Re: Map management plugin
Reply With Quote #6

Thanks for help.
Can someone explain how to make menu with vote count next to menu items?
Something like:


Normal menu:
Votemap menu:
1. de_dust
2. de_nuke
3. awp_india

after some players gives his vote for de_dust:
Votemap menu:
1. de_dust [1]
2. de_nuke [0]
3. awp_india [0]
e12harry is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-18-2011 , 03:56   Re: Map management plugin
Reply With Quote #7

cancel the menu on all players, rebuild the menu with the new numbers, reshow the menu to those who haven't voted yet. That's basically how you would do it.
__________________
fysiks is offline
e12harry
Member
Join Date: Apr 2010
Old 07-18-2011 , 04:14   Re: Map management plugin
Reply With Quote #8

if I create menu:
gTIME_VOTE_MENU = menu_create(title, "handleTimeVote");

will handleTimeVote be called on menu_cancel(id) ?
e12harry is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-18-2011 , 05:28   Re: Map management plugin
Reply With Quote #9

See newmenus.inc
__________________
fysiks 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 00:47.


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