[Tutorial] Map Change System
#12

Quote:
Originally Posted by Kitten
View Post
Map Change System By [Kitten]

Well i had many PM's and friends requesting how to make a MapChangechange system without making a new gamemode.

Basically this tutorial will help you with have more than 20+ Maps in 1 gamemode with only some timers and callbacks

Lets get started?.

You will need these callbacks to forward just to get you started first

pawn Code:
forward StartedNewRound();                        // On top of your script.
forward NewMapTimer(playerid);                    // On top of your script also these are basically the forwards the callback like Public Callback
-Setting Up variables
pawn Code:
new MapChange;                                    // What this variable does you will need this for the MapChangechange part further in the tutorial
-Setting Up timers || First Variable Use for MapChange
-Must be OnGameModeInit
pawn Code:
SetTimer("NewMapTimer",180000,true);              // this is 2 min timer for MapChangechange basically has to be on true for it to change the other MapChangewhen timer is over OnPlayerSpawn Further in the tutorial you will know why
MapChange= 0;                                     // This will make it first MapChangeon the list onplayerspawn callback further in the tutorial you will know
OnPlayerSpawn Callback Setup for MapChangechange

pawn Code:
public OnPlayerSpawn(playerid)                    // OnPlayerSpawn Callback
{
    switch ( MapChange  ) {                       // you must have a case for the mapchange to get the list going
        case 0:                                   // MapChange1 this is the part for MapChange = 0; Which basically starts of the first MapChangein the list
        {
            SetPlayerPos(playerid, X,Y,Z);        // XYZ Co-rds of the first map
            SetPlayerFacingAngle(playerid,0.0);   // Facing Angle of the first map
        }
        case 1:                                   // MapChange2 same settings on top
        {
            SetPlayerPos(playerid, X,Y,Z);
            SetPlayerFacingAngle(playerid,0.0);
        }
        case 2:                                   // blah blah next MapChangestuff here
        {

        }
    }
    return 1;
}
-This part is basically from the timer ongamemodeinit we added once that timer is over this changes the MapChangethrough this callback

pawn Code:
public NewMapTimer(playerid)                      // The callback we forwarded on the beginning of the tutorial
{
    MapChange++;                                  // this makes it to go to the second MapChange++ part basically does it
                                                  // Sends everyone in server a gametext
    GameTextForAll("~b~ Loading new ~w~MAP",4000,3);
    SetTimer("StartedNewRound",4000,false);       // Starts a new timer for the MapChangechange 4 seconds this basically starts the new MapChangeand always must be in false
    return 1;
}
- This part is for the StartedNewRound Callback as the timer bring it here in NewMapTimer Callback

pawn Code:
public StartedNewRound()                          // The callback we forwarded in the beginning of this tutorial
{
    for(new i = 0; i < MAX_PLAYERS; i++) {        // this loops everyone in the server also you can use foreach include for this part
        SpawnPlayer ( i ) ;                       // Re Spawns everyone in the server which then gets OnPlayerSpawn Callback called
        switch ( MapChange ) {                    // This part is basically for your new MapChangesettings like giving them weapons
            case 0:
            {
                SendClientMessage(i,COLOR,"New MapChangeLoad");
            }
            case 1:
            {
                SendClientMessage(i,COLOR,"New MapChangeLoad");
            }
            case 2:                               // Next Spawn Settings
            {

            }
        }
    }
    return 1;
}
Congratulation you are all done if need any help please PM me do not post it in here thanks.
When all maps finish... start agin or i need restart server? D:
Reply


Messages In This Thread
Map Change System - by Kitten - 16.07.2011, 04:57
Re: Map Change System - by AgentZero - 16.07.2011, 04:58
Re: Map Change System - by System64 - 16.07.2011, 06:39
Re: Map Change System - by Lorenc_ - 16.07.2011, 07:16
Re: Map Change System - by vassilis - 17.01.2012, 10:21
Respuesta: Map Change System - by [Nikk] - 19.01.2012, 10:23
Re: Map Change System - by Ballu Miaa - 04.02.2012, 13:39
Re: Map Change System - by Jochemd - 07.05.2012, 17:50
Re: Map Change System - by Rudy_ - 19.06.2012, 14:00
Re: Map Change System - by .Wicked - 25.06.2012, 10:14
Re: Map Change System - by BlackForBoy - 11.08.2012, 08:04
Re: Map Change System - by Cocolini - 09.10.2013, 21:40
Respuesta: Map Change System - by DanDRT - 09.10.2013, 23:18
Respuesta: Map Change System - by cleme - 01.12.2013, 20:43
Re: Map Change System - by ReD_DeVi - 01.12.2013, 21:25
Re: Map Change System - by Voxel - 26.12.2013, 11:38
Re: Map Change System - by ThickShake1994 - 26.12.2013, 12:18
Re: Map Change System - by LeGGGeNNdA - 26.12.2013, 14:00
Re: Map Change System - by J4mmyHD - 26.12.2013, 16:29
Re: Map Change System - by satafinix - 16.05.2014, 10:58
Re: Map Change System - by Rissam - 11.01.2015, 11:47
Re: Map Change System - by Rissam - 15.01.2015, 13:28
Re: Map Change System - by TheRaGeLord - 15.01.2015, 14:00
Re: Map Change System - by FeniX70 - 30.03.2015, 02:41
Re: Map Change System - by ivndosos - 27.03.2018, 12:37

Forum Jump:


Users browsing this thread: 2 Guest(s)