Raised This Month: $ Target: $400
 0% 

Own Mapchooser


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 10-30-2013 , 10:26   Own Mapchooser
Reply With Quote #1

Hello.
GoldSrc (CS) (without AMXX) have own mapcycle system ("mapcycle.txt"), and it works even works AMXX Mapchooser system.

Default Mapchooser system of AMXX works via two plugins:
Code:
nextmap.amxx        ; displays next map in mapcycle
mapchooser.amxx        ; allows to vote for next map
And we can see this "hack" in "nextmap.sma":
PHP Code:
public changeMap()
{
    new 
string[32]
    new 
Float:chattime get_cvar_float("mp_chattime")
    
    
set_cvar_float("mp_chattime"chattime 2.0)        // make sure mp_chattime is long
    
new len getNextMapName(string31) + 1
    set_task
(chattime"delayedChange"0stringlen)    // change with 1.5 sec. delay

For example, I want create my own mapchooser (mapcycle) system.
And I do not want to use this "hack". What are the options?
Can I set default nextmap (not amx_nextmap, like from "mapcycle.txt") for server via AMXX?

Last edited by Phant; 10-30-2013 at 10:31.
Phant is offline
Send a message via ICQ to Phant
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-30-2013 , 12:27   Re: Own Mapchooser
Reply With Quote #2

That is the only way. I've looked for another way before but didn't find anything.

What is wrong with using it?
__________________

Last edited by fysiks; 10-30-2013 at 12:28.
fysiks is online now
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-30-2013 , 13:50   Re: Own Mapchooser
Reply With Quote #3

You want to change the map picked by game ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 10-30-2013 , 14:27   Re: Own Mapchooser
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
You want to change the map picked by game ?
No. Ideally I want replace next map picked by game to any map what I want.
Or find way to disable original mapcycle system (like "mapcycle.txt" not exist, forever intermission).
Phant is offline
Send a message via ICQ to Phant
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-30-2013 , 18:12   Re: Own Mapchooser
Reply With Quote #5

Quote:
Originally Posted by Phant View Post
No. Ideally I want replace next map picked by game to any map what I want.
Or find way to disable original mapcycle system (like "mapcycle.txt" not exist, forever intermission).
Have you tried deleting or just emptying mapcycle.txt?
__________________
fysiks is online now
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-31-2013 , 01:58   Re: Own Mapchooser
Reply With Quote #6

Change cvar mapcyclefile on each map and write 1 map in it should force the game to reload mapcycle and to use that map.

PHP Code:
#include < amxmodx >

#pragma semicolon 1

#define PLUGIN ""
#define VERSION "0.0.1"

#define cm(%0)    ( sizeof(%0) - 1 )

new const SERVERINFO_MAPCYCLEFILE[] = "ourmapcyclefile";

// use 2 files : amx_nextmap1.txt and amx_nextmap2.txt, so the 11th char change in the name
new g_szMapCycleFile[] = "amx_nextmap1.txt";

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    
// better to do that here rather than in intermission callback
    
ChangeMapCycleFile();

    
register_event("30""Event_SVC_INTERMISSION""a");
}

ChangeMapCycleFile()
{
    
get_localinfo(SERVERINFO_MAPCYCLEFILEg_szMapCycleFilecharsmax(g_szMapCycleFile));
    if( 
g_szMapCycleFile[11] == '1' )
    {
        
g_szMapCycleFile[2] = '2';
    }
    else
    {
        
g_szMapCycleFile[2] = '1';
    }
    
set_cvar_string("mapcyclefile"g_szMapCycleFile);
}

public 
Event_SVC_INTERMISSION()
{
    new 
szNextMap[32];
    
// write here some code to choose your next map
    // when it is done, write its name in the .txt file.
    // GetNextMap(szNextMap, charsmax(szNextMap));
    
    
new fp fopen(g_szMapCycleFile"wt");
    
fprintf(fp"%s^n"szNextMap);
    
fclose(fp);

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 10-31-2013 at 02:03.
ConnorMcLeod is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 10-31-2013 , 04:50   Re: Own Mapchooser
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
Have you tried deleting or just emptying mapcycle.txt?
Yes.

ConnorMcLeod, thanks you for example! I did not know about "mapcyclefile" cvar.

Also, for disabling default mapcycle system and got "forever intermission" we can do this:
Code:
mapcyclefile ""
Without files manipulations.
Phant is offline
Send a message via ICQ to Phant
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 23:19.


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