Help Find map change system
#1

hi , i want a Map change system/tutorial i hope you help me to found it ...(i have found but kitten's one doesn't work)

Thank you .
Reply
#2

EDITED better idea

what you mean like after a curtain time a different map is selected ?

if so
then i would say put all you maps in different locations then just use like
pawn Код:
//run a timer like 20 mins or after what time you want to change the map and just do
SetTimerEx("NextMap", 20000, false, "i", 2);//this will change it to 3rd map (case 2)

forward NextMap(maps);
public NextMap(maps)
{
switch(maps)
{
case 0:{SetPlayerPos(.....}
case 1:{SetPlayerPos(.....}
//so on just changin the pos to another map
/with the case.
}
}
Reply
#3

i mean , why members can't make the Map change system in a FS or something ..
BTW : i loved your mReg system .
Reply
#4

Quote:
Originally Posted by ServerScripter
Посмотреть сообщение
i mean , why members can't make the Map change system in a FS or something ..
BTW : i loved your mReg system .
thnaks,
well it will need to be an include becouse the script wouldnt know where your map is placed but it doesnt need a whole system for this, the code i showed you is simple and does the same job
edit
if you dont get it tell me and i will try to explain it more
Reply
#5

thank u ! can u add the new + all what i must have to run my map ? please?
Reply
#6

edit
i removed the other code because this is more simpler

pawn Код:
//add this at the top
new Cmaps;

//you only need the timer once !
//put it "OnPlayerConnect" or wherever you want! but if using it like OnPlayerSpawn you will need to kill the timer //so i will suggest you dont use it there.
SetTimerEx("NextMap", 20000, true, "i", 10);//not the number "10" at the end is for the maximum maps you will have !


forward NextMap(maps);
public NextMap(maps)
{
Cmaps++;
if(maps>= Cmaps) Cmaps=0;
switch(maps)
{
     case 0:{
          for(new playerid; playerid<GetMaxPlayers(); playerid++)//this will loop through all you players
          {
               SetPlayerPos(playerid,X,Y,Z);//this is the 1st MAP
          }
     }
     case 1:{
          for(new playerid; playerid<GetMaxPlayers(); playerid++)
          {
               SetPlayerPos(playerid,X,Y,Z);//this is the 2st MAP
          }
     case 2:{
          for(new playerid; playerid<GetMaxPlayers(); playerid++)
          {
               SetPlayerPos(playerid,X,Y,Z);//this is the 3st MAP
          }
//and you just continue like that..
     }
}
}
Reply
#7

I'd advise using State Automaton if you intend to create multiple gamemodes within a single file. ****** did a great tutorial on that. Here's a really brief example of what you can do:
pawn Код:
main()
{
    state CurrentMap:Map001;
}

entry() <CurrentMap:Map001>
{
    // This acts like OnGameModeInit and is called everytime the script switches to this state
    SetGameModeText("Map 001");
}

entry() <CurrentMap:Map002>
{
    SetGameModeText("Map 002");
}

public OnPlayerSpawn(playerid) <CurrentMap:Map001>
{
    // Do stuff for map 1
    return 1;
}

public OnPlayerSpawn(playerid) <CurrentMap:Map002>
{
    // Do stuff for map 2
    return 1;
}
Reply
#8

thank u both ! i will test right now!
Reply
#9

doesn't work
pawn Код:
forward NextMap(maps);
public NextMap(maps)
{
Cmaps++;
if(maps>= Cmaps) Cmaps=0;
switch(maps)
{
     case 0:{
          for(new playerid; playerid<GetMaxPlayers(); playerid++)//this will loop through all you players
          {
               SetPlayerPos(playerid,2533.8667,2753.3320,10.8203);
               SetPlayerFacingAngle(playerid,90.5278);//this is the 1st MAP
          }
     }
     case 1:{
          for(new playerid; playerid<GetMaxPlayers(); playerid++)
          {
               SetPlayerPos(playerid,2666.7036,2797.8311,17.6896);//this is the 2st MAP
          }
//and you just continue like that..
     }
}
}
NB : i have two teams so i want give pos to each team in each map how to do it ? thanks
Reply
#10

I done a mistake
Where the switch is
Change I to this
switch(Cmaps)
Becouse it will not rotate the map

And for the teams do a check if player is in team = 1
The. If he is jus set his pos
there you go
pawn Код:
forward NextMap(maps);
public NextMap(maps)
{
Cmaps++;
if(Cmaps>= maps) Cmaps=0;
switch(Cmaps)
{
     case 0:{
          for(new playerid; playerid<GetMaxPlayers(); playerid++)
          {
               if(GetPlayerTeam(playerid) == 1) SetPlayerPos(playerid,2533.8667,2753.3320,10.8203);
               if(GetPlayerTeam(playerid) == 1) SetPlayerFacingAngle(playerid,90.5278);
               if(GetPlayerTeam(playerid) == 2) SetPlayerPos(playerid,x,y,z);//change to the team2 pos
               if(GetPlayerTeam(playerid) == 2) SetPlayerFacingAngle(playerid,90.5278);
          }
     }
     case 1:{
          for(new playerid; playerid<GetMaxPlayers(); playerid++)
          {
               if(GetPlayerTeam(playerid) == 1) SetPlayerPos(playerid,2666.7036,2797.8311,17.6896);
               if(GetPlayerTeam(playerid) == 2) SetPlayerPos(playerid,x,y,z);//change to the team2 pos
          }
     }
}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)