SA-MP Forums Archive
[Tutorial] Map Change System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Map Change System (/showthread.php?tid=269336)

Pages: 1 2


Map Change System - Kitten - 16.07.2011

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 Код:
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 Код:
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 Код:
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 Код:
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 Код:
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 Код:
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.



Re: Map Change System - AgentZero - 16.07.2011

this is way easier then the other tutorial on here thanks


Re: Map Change System - System64 - 16.07.2011

well done mate


Re: Map Change System - Lorenc_ - 16.07.2011

This is a static map changing system and you cannot create other maps without modifying your gamemode to add extra lines of code, if you have a dynamic one, you wouldn't need as much code stated here, but anyway. Cool tutorial kitten, great for beginners

Tutorials are for explaining things aswell, this sorta reveals false information, mind editing some lines of code?
The indentation is disgusting! fix it up!!!


Re: Map Change System - vassilis - 17.01.2012

hey i follow the way and made it but its not setting player position to the next map why?


Respuesta: Map Change System - [Nikk] - 19.01.2012

The topic says here how:
pawn Код:
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



Re: Map Change System - Ballu Miaa - 04.02.2012

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Tutorials are for explaining things aswell, this sorta reveals false information, mind editing some lines of code? The indentation is disgusting! fix it up!!!
This tutorial tells us how to create a Map Changing system but doesnt explain that why are we using a particular function or why have we defined anything or incremented any variable. Please explain it more for beginner's.

- Ballu Miaa


Re: Map Change System - Jochemd - 07.05.2012

It's a good tutorial but your identation is terrible (in my opinion)


Re: Map Change System - Rudy_ - 19.06.2012

Nice, it help'd me Alot
+Rep


Re: Map Change System - .Wicked - 25.06.2012

Quote:
Originally Posted by vassilis
Посмотреть сообщение
hey i follow the way and made it but its not setting player position to the next map why?
pawn Код:
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);        // You have to set the cordinates where the player should spawn on the next map.
            SetPlayerFacingAngle(playerid,0.0);   // Facing Angle of the first map
        }
        case 1:                                   // MapChange2 same settings on top
        {
            SetPlayerPos(playerid, X,Y,Z); // You have to set the cordinates where the player should spawn on the next map.
            SetPlayerFacingAngle(playerid,0.0);
        }
        case 2:                                   // blah blah next MapChangestuff here
        {

        }
    }
    return 1;
}



Re: Map Change System - BlackForBoy - 11.08.2012

so awesome sir


Re: Map Change System - Cocolini - 09.10.2013

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:


Respuesta: Map Change System - DanDRT - 09.10.2013

Nice tutorial


Respuesta: Map Change System - cleme - 01.12.2013

Hi I need players when entering a round already started spectating to stay that are within the map and when the round ends and they can join can you help me? thanks


Re: Map Change System - ReD_DeVi - 01.12.2013

Good work


Re: Map Change System - Voxel - 26.12.2013

Thanks for this kitten! I'm using it for my next project :P


Re: Map Change System - ThickShake1994 - 26.12.2013

Well done it very simple and easy to follow


Re: Map Change System - LeGGGeNNdA - 26.12.2013

Thanks for the tutorial Kitten, its very good


Re: Map Change System - J4mmyHD - 26.12.2013

Thanks, Helped alot!


Re: Map Change System - satafinix - 16.05.2014

Well thats -Nice-