Raised This Month: $ Target: $400
 0% 

Own Mapchooser


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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