AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Set an additional server cvar in mapchooser.sma (https://forums.alliedmods.net/showthread.php?t=11152)

Sparky911 03-11-2005 01:50

Set an additional server cvar in mapchooser.sma
 
I am editing mapchooser.sma so that on my server after a "next Map Vote" has completed it not only sets the cvar amx_nextmap but also sets a mod specific cvar "agnextmap". Im not sure how to go about this. I tried a few things but was unsuccessful and too new yet. I think this is the area I should be in though...

Code:
public checkVotes() {   new b = 0   for (new a = 0; a < g_mapVoteNum; ++a)     if (g_voteCount[b] < g_voteCount[a])        b = a   if ( g_voteCount[SELECTMAPS] > g_voteCount[b] ) {     new mapname[32]     get_mapname(mapname,31)     new Float:steptime = get_cvar_float("amx_extendmap_step")     set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime )     client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_EXT", steptime )     log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes",       mapname , steptime )     return   }   if ( g_voteCount[b] && g_voteCount[SELECTMAPS+1] <= g_voteCount[b] )       set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]] )   new smap[32]   get_cvar_string("amx_nextmap",smap,31)   client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_NEXT", smap )   log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap) }

XxAvalanchexX 03-11-2005 20:55

Near the bottom of the code:

Code:
set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]] )

Add another set_cvar_string below it, so it will look like this:

Code:
set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]] ) set_cvar_string("agnextmap", g_mapName[g_nextName[b]] )

Sparky911 03-11-2005 21:40

Yea I tried that but after the vote is over it still doesn't set "agnextmap" to the same as amx_nextmap. Plus I get a warning when compiling.

Code:

//AMXXSC compile.exe
// by the AMX Mod X Dev Team


//// agmapchooser.sma
// ...\AMX ModX Scripting\mapchooser.sma(97) : warning 217: loose indentation
// ...\AMX ModX Scripting\agmapchooser.sma(98) : warning 217: loose indentation
//
// 2 Warnings.
// Done.
//
// Compilation Time: 0.59 sec
// ----------------------------------------

Press enter to exit ...


XxAvalanchexX 03-12-2005 00:27

Loose indentations aren't anything to worry about, it just means your text isn't lined up. It doesn't effect the plugin at all, the compiler just nitpicks at you like that. Perhaps, since it is a mod-specific cvar, the mod is overriding it at some point?

Sparky911 03-12-2005 11:57

Its wierd. I managed to get nextmap.sma to work properly with this mod but can't seem to get mapchooser.sma to. I like AMX Mod X for the ease of kicking and baning so thats the main reason why I use it. I also like the death match mod I am playing. I am hoping to make the 2 work with each other instead of against each other. The mod has its own voting system and nextmap but I don't want to use it I would rather use AMX's.

I got rid of the loose identifier by using { and }. Same results though. It seems to be setting the cvar but to amx's current map not the next one.

Sparky911 03-12-2005 13:43

I don't think it is the mod overiding it because the modifications I made in nextmap.sma work. When the map loads it sets agnextmap to amx_nextmap. I just can't seem to get mapchooser.sma to do it.

This is what I have tried so far...

Code:
public checkVotes() {   new b = 0   for (new a = 0; a < g_mapVoteNum; ++a)     if (g_voteCount[b] < g_voteCount[a])        b = a   if ( g_voteCount[SELECTMAPS] > g_voteCount[b] ) {     new mapname[32]     get_mapname(mapname,31)     new Float:steptime = get_cvar_float("amx_extendmap_step")     set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime )     client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_EXT", steptime )     log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes",       mapname , steptime )     return   }   if ( g_voteCount[b] && g_voteCount[SELECTMAPS+1] <= g_voteCount[b] )       set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]] )       set_cvar_string("agnextmap", g_mapName[g_nextName[b]] )   new smap[32]   get_cvar_string("amx_nextmap",smap,31)   set_cvar_string("agnextmap",smap,31)   client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_NEXT", smap )   log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap) }

Sparky911 03-17-2005 20:28

Still not working :(

Sparky911 03-20-2005 18:24

**BUMP**

v3x 03-20-2005 18:32

Quadruple post, nice.. :roll:

Sparky911 03-20-2005 19:22

Um ok...

I keep replying to this so it doesn't get forgotten like everyone seems to be trying to do. Im stuck and am still trying things on this subject everyday. Occasionally I come back in hopes that someone has another helpful tip in solving my problem here. Im sure its such a simple solution here but I am most likey too blind to see it. All I am asking for if for someone to point out what I am doing wrong. I'm sure its not a problem with the mod. You can set the cvar "agnextmap" manually in the console so Im certain amx can set it after a next map vote passes at the end of the map. Thats all I ask. Too much?


All times are GMT -4. The time now is 14:01.

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