16.07.2011, 04:57
(
Последний раз редактировалось Kitten; 07.05.2012 в 17:54.
)
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
-Setting Up variables
-Setting Up timers || First Variable Use for MapChange
-Must be OnGameModeInit
OnPlayerSpawn Callback Setup for MapChangechange
-This part is basically from the timer ongamemodeinit we added once that timer is over this changes the MapChangethrough this callback
- This part is for the StartedNewRound Callback as the timer bring it here in NewMapTimer Callback
Congratulation you are all done if need any help please PM me do not post it in here thanks.
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
pawn Код:
new MapChange; // What this variable does you will need this for the MapChangechange part further in the tutorial
-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
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;
}
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;
}
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;
}