Making map change instantly instead of restarting the server
#1

How could i make my gamemode just change maps instead of setting a timer to restart the server and change gamemode/map,

atm i'v just got a timer that after 10 mins it changes the map which somtimes causes the server to freeze when alot of players are online.
theres different spawn points for each map so everytime it restarted would have to make it so you only spawn at certain spawn points
Thanks in advance
Reply
#2

Freeze all players destroy the old map. Create new map. Change the spawns to the new ones. Allow players to be spawned.
Reply
#3

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
Freeze all players destroy the old map. Create new map. Change the spawns to the new ones. Allow players to be spawned.
ahh i see, could you make a little example on what steps i would take?
Reply
#4

pawn Код:
#include <foreach>
new objects[256];

#define MAX_GM_OBJECTS 265

forward changeGameModes();
public changeGameModes()
{
    new tmpGM = random ( 5 ) ;
    SendClientMessageToAll(0xFFFFFFAA, " Gamemodes are currently changing. Please wait for 10 seconds. " );
    for ( new o; o < MAX_GM_OBJECTS; o++)
    {
        DestroyObject(objects[o]);
    }
    foreach(Player, i )
    {
        TogglePlayerControllable ( i, false );
    }
    switch ( tmpGM )
    {
        case 1:
        {
            objects[1] = CreateObject( 1337, 1337.0, 1337.0, 1337.0, 0.0, 0.0, 0.0, 1337.0 );
            objects[2] = CreateObject( 1337, 1337.0, 1337.0, 1337.0, 0.0, 0.0, 0.0, 1337.0 );
            objects[3] = CreateObject( 1337, 1337.0, 1337.0, 1337.0, 0.0, 0.0, 0.0, 1337.0 );
            objects[4] = CreateObject( 1337, 1337.0, 1337.0, 1337.0, 0.0, 0.0, 0.0, 1337.0 );
            objects[5] = CreateObject( 1337, 1337.0, 1337.0, 1337.0, 0.0, 0.0, 0.0, 1337.0 );
            objects[6] = CreateObject( 1337, 1337.0, 1337.0, 1337.0, 0.0, 0.0, 0.0, 1337.0 );
            objects[7] = CreateObject( 1337, 1337.0, 1337.0, 1337.0, 0.0, 0.0, 0.0, 1337.0 );
            objects[8] = CreateObject( 1337, 1337.0, 1337.0, 1337.0, 0.0, 0.0, 0.0, 1337.0 );
            foreach(Player, i )
            {
                SetSpawnInfo( i, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
            }
        }
        case 2:
        {
            //Blahblah.
        }
    }
    foreach(Player, i )
    {
        TogglePlayerControllable ( i, true );
        ForceClassSelection ( i );
    }
    SendClientMessageToAll ( 0xFFFFFFAA, "Gamemode change has completed. " );
    return 1;
}
Reply
#5

cheers thanks alot, do i have to add the "objects[6]""objects[7]" at the start, or is that just for show.
Reply
#6

Nope the 'case 1:' is for the random gamemode id. The objects[1][2][3][.....] are to store the objectid and to destroy upon change GM. So you have to do that on every object in a gamemode.
Reply
#7

ahh shit, so i have to do objects[1][2] etc up to around a 250?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)