Map Changing
#1

Hey guys. I created a Map Changing system using Kitten's tutorial. However after my last map (i have 3 map), the maps won't go from beginning again, but the fourth map begins, but i don't even have a fourth map. I spawn somewhere in a another dimension. I want it to go from beginning, how to do that?
Reply
#2

you will need to show some code ;X
i can't do my magic without looking at the code
Reply
#3

Код:
switch ( MapChange  )
 	{                      
        case 0:                                   
        {
			if(GetPlayerTeam(playerid) == TEAM_RED)
			{
				SetPlayerPos(playerid, 2214.69922, -1150.31177, 1025.79688);
            	SetPlayerInterior(playerid, 15);
			}
			else
			{
				SetPlayerPos(playerid, 2193.17065, -1146.97461, 1033.79688);
            	SetPlayerInterior(playerid, 15);
			}
        }
        case 1:                                 
        {
			if(GetPlayerTeam(playerid) == TEAM_RED)
			{
				SetPlayerPos(playerid, 238.60994, 138.90332, 1003.02344);
            	SetPlayerInterior(playerid, 3);
			}
			else
			{
				SetPlayerPos(playerid, 288.29379, 167.89377, 1007.17188);
            	SetPlayerInterior(playerid, 3);
			}
        }
        case 2:                                   
        {
			if(GetPlayerTeam(playerid) == TEAM_RED)
			{
				SetPlayerPos(playerid, 2233.98364, 1714.67981, 1012.38281);
            	SetPlayerInterior(playerid, 1);
			}
			else
			{
				SetPlayerPos(playerid, 2275.85327, 1562.63855, 1008.35938);
            	SetPlayerInterior(playerid, 1);
			}
        }
    }
If you need to see more, i'll PM you the rest, but i think this part is needed.
Reply
#4

Ok, but show where you change the MapChange
As this is just the Switch statment
edit
or you can do this
pawn Код:
switch ( MapChange  )
    {                      
        case 0:                                  
        {
            if(GetPlayerTeam(playerid) == TEAM_RED)
            {
                SetPlayerPos(playerid, 2214.69922, -1150.31177, 1025.79688);
                SetPlayerInterior(playerid, 15);
            }
            else
            {
                SetPlayerPos(playerid, 2193.17065, -1146.97461, 1033.79688);
                SetPlayerInterior(playerid, 15);
            }
        }
        case 1:                                
        {
        if(GetPlayerTeam(playerid) == TEAM_RED)
        {
            SetPlayerPos(playerid, 238.60994, 138.90332, 1003.02344);
                    SetPlayerInterior(playerid, 3);
        }
        else
        {
            SetPlayerPos(playerid, 288.29379, 167.89377, 1007.17188);
                    SetPlayerInterior(playerid, 3);
        }
        }
        case 2:                                  
        {
        if(GetPlayerTeam(playerid) == TEAM_RED)
        {
            SetPlayerPos(playerid, 2233.98364, 1714.67981, 1012.38281);
                    SetPlayerInterior(playerid, 1);
        }
        else
        {
            SetPlayerPos(playerid, 2275.85327, 1562.63855, 1008.35938);
                    SetPlayerInterior(playerid, 1);
        }
        MapChange=0;
    }
    }
But from what your saying the variable MapChange seems to be getting a +1(++) every map change<
So you will need to stop that as it might interfere with the current method.
Reply
#5

Top:
forward StartedNewRound(playerid);
new MapChange;
forward NewMapTimer(playerid);

OnGameModeInIt:
Код:
	SetTimer("NewMapTimer",10000,true);
	MapChange = 0;
End:
Код:
public StartedNewRound(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++) {        
        SpawnPlayer ( i ) ;                       
        switch ( MapChange ) {                   
            case 0:
            {
                ResetPlayerWeapons(playerid);
            }
            case 1:
            {
                ResetPlayerWeapons(playerid);
            }
            case 2:                             
            {
 			    ResetPlayerWeapons(playerid);
            }
        }
    }
    return 1;
}

public NewMapTimer(playerid)                     
{
    MapChange++;                               
                                                 
    GameTextForAll("--- LOADING NEW MAP ---",4000,3);
    SetTimer("StartedNewRound", 4000, false);
    return 1;
}
Reply
#6

like i said about the +1 variable
pawn Код:
public NewMapTimer(playerid)                    
{
    MapChange++;                              
    if(MapChange>3) MapChange=0;//if it goes over more then 3 bring it back to 0
    GameTextForAll("--- LOADING NEW MAP ---",4000,3);
    SetTimer("StartedNewRound", 4000, false);
    return 1;
}
Now that you have this you don't need to use what i showed you earlier.
Reply
#7

Thanks!

However you had a error:
[CODE]public NewMapTimer(playerid)
{
MapChange++;
if(MapChange>=3) MapChange=0;//Was missing '='
GameTextForAll("--- LOADING NEW MAP ---",4000,3);
SetTimer("StartedNewRound", 4000, false);
return 1;
}

One last question, am i able to disable the gaming machines in Caligula's?
Reply
#8

Thanks!

However you had a error:
[CODE]public NewMapTimer(playerid)
{
MapChange++;
if(MapChange>=3) MapChange=0;//Was missing '='
GameTextForAll("--- LOADING NEW MAP ---",4000,3);
SetTimer("StartedNewRound", 4000, false);
return 1;
}

One last question, am i able to disable the gaming machines in Caligula's?
Reply
#9

not really what you have done is change the if statement to pickup when the variable if it HITS 3 or over
which will now not make the 3rd map work
so use my method >3 which means if it goes over 3 !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)