AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   Save Map - Restore map after server crashed or restarted (https://forums.alliedmods.net/showthread.php?t=175074)

brian201049 12-29-2011 16:33

Save Map - Restore map after server crashed or restarted
 
3 Attachment(s)
Save Map
Version: 1.0 (30/12/2011 Updated)

This plugin can save the map name when the map loaded and it can change to the saved map after the server crashed or restart.

It is useful with Serverdoc or HL Server Monitor for Windows server.

This plugin used FValut system. http://forums.alliedmods.net/showthread.php?t=76453

Cvar:
defaultmap <map name> - Default map if the map record isn't exist or unreadable (Default: de_dust)

Credits:
Exolent[jNr] - His FVault system

How to compile:
1. Download fvault.inc and place it in scripting/include folder
2. Download savemap.sma (Click Get Source) and place it in scripting folder
3. Drag savemap.sma into compiler.exe
4. Go to scripting/compiled find savemap.amxx

You MUST place server.bsp into maps folder and change your startup parameter to +map server (YOU DON'T NEED TO UPLOAD THIS MAP ON YOUR FASTDL SERVER)

The web compiler cannot compile this plugin. Please download the source and compile it locally.:mrgreen:

kramesa 12-29-2011 16:35

Re: Save Map - Restore map after server crashed or restarted
 
Cool

fysiks 12-29-2011 17:18

Re: Save Map - Restore map after server crashed or restarted
 
there is a much simpler way to do this without fvault (or any vault) and without a new bsp.

Also, the client_connect() function is not needed. Just remove it.

pacheco 12-29-2011 19:24

Re: Save Map - Restore map after server crashed or restarted
 
Interesting! Simple, but good.

brian201049 12-30-2011 00:53

Re: Save Map - Restore map after server crashed or restarted
 
I just deleted the client_connect() function and the g_NoPlayers global variable.
Thank you. Could u tell me your saving method without vault?:oops:

m0skVi4a 12-30-2011 03:39

Re: Save Map - Restore map after server crashed or restarted
 
Nice :)

OxfordL 12-30-2011 03:51

Re: Save Map - Restore map after server crashed or restarted
 
Good :)

fysiks 12-30-2011 04:29

Re: Save Map - Restore map after server crashed or restarted
 
I'm pretty sure this plugin has been made before. This is probably how I would do it:

PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
    new 
szFilepath[128]
    
get_configsdir(szFilepathcharsmax(szFilepath))
    
add(szFilepathcharsmax(szFilepath), "/lastmap.ini")
    
    new 
szStoredInfo[3]
    
get_localinfo("asdf"szStoredInfocharsmax(szStoredInfo))
    
set_localinfo("asdf""2")
    
    if( 
str_to_num(szStoredInfo) == )
    {
        new 
szMapName[32]; get_mapname(szMapNamecharsmax(szMapName));
        new 
fopen(szFilepath"w")
        if(
f)
        {
            
fputs(fszMapName)
            
fclose(f)
        }
    }
    else
    {
        new 
fopen(szFilepath"r")
        if(
f)
        {
            new 
data[32]
            
fgets(fdatacharsmax(data))
            
trim(data)
            
server_cmd("changelevel %s"data)
            
fclose(f)
        }
    }



wickedd 12-30-2011 05:18

Re: Save Map - Restore map after server crashed or restarted
 
Mapcycle State Restorer

jackas 01-01-2012 07:33

Re: Save Map - Restore map after server crashed or restarted
 
Excellent :wink:


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

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