map doesnt change
#1

I don't know what part of the code to show but Ill show u the tutorial
https://sampforum.blast.hk/showthread.php?tid=269336


basically the map doesnt change.

(tell me what part i should show according from the tutorial)


heres the onplayerspawn though

Код:
public OnPlayerSpawn(playerid)
{
	switch( MapChange ) {
		case 0: {

		   new gMap1 = random( sizeof ( gMapSpawns1 ));
		   
		   SetPlayerPos(playerid, gMapSpawns1[gMap1][0], gMapSpawns1[gMap1][1], gMapSpawns1[gMap1][2]);
		   
		   SetPlayerFacingAngle(playerid, gMapSpawns1[gMap1][2]);
	   }
	   case 1: {
	   
	       new gMap2 = random( sizeof ( gMapSpawns2 ));

		   SetPlayerPos(playerid, gMapSpawns2[gMap2][0], gMapSpawns2[gMap2][1], gMapSpawns2[gMap2][2]);

		   SetPlayerFacingAngle(playerid, gMapSpawns2[gMap2][2]);
	  }
   }
    return 1;
}
and the random positions for each map

Код:
new Float:gMapSpawns1[][]= {
{2161.4529,-1639.9576,14.2731},
{2250.9717,-1650.3555,15.4772},
{2245.1152,-1704.1963,22.8594},
{2317.3740,-1748.8496,13.3822},
{2352.1912,-1673.8510,13.5314},
{2427.8057,-1612.1277,26.6325},
{2513.1516,-1659.7305,13.6431},
{2522.6194,-1752.0939,13.5469},
{2463.5796,-1794.1737,13.6728}
};

new Float:gMapSpawns2[][]= {
{2229.6516,-1141.5068,25.7969},
{2197.3640,-1082.5574,39.3104},
{2223.5845,-1051.4462,48.1517},
{2207.5991,-1008.9668,61.5210},
{2143.5073,-1004.4036,61.9231},
{2427.8057,-1612.1277,26.6325},
{2081.8887,-1049.0695,30.9284},
{2052.9575,-1105.6431,24.4322},
{2040.0748,-1217.9811,22.8408}
};
Reply
#2

Quote:
Originally Posted by ivndosos
Посмотреть сообщение
I don't know what part of the code to show but Ill show u the tutorial
https://sampforum.blast.hk/showthread.php?tid=269336


basically the map doesnt change.

(tell me what part i should show according from the tutorial)


heres the onplayerspawn though

Код:
public OnPlayerSpawn(playerid)
{
	switch( MapChange ) {
		case 0: {

		   new gMap1 = random( sizeof ( gMapSpawns1 ));
		   
		   SetPlayerPos(playerid, gMapSpawns1[gMap1][0], gMapSpawns1[gMap1][1], gMapSpawns1[gMap1][2]);
		   
		   SetPlayerFacingAngle(playerid, gMapSpawns1[gMap1][2]);
	   }
	   case 1: {
	   
	       new gMap2 = random( sizeof ( gMapSpawns2 ));

		   SetPlayerPos(playerid, gMapSpawns2[gMap2][0], gMapSpawns2[gMap2][1], gMapSpawns2[gMap2][2]);

		   SetPlayerFacingAngle(playerid, gMapSpawns2[gMap2][2]);
	  }
   }
    return 1;
}
and the random positions for each map

Код:
new Float:gMapSpawns1[][]= {
{2161.4529,-1639.9576,14.2731},
{2250.9717,-1650.3555,15.4772},
{2245.1152,-1704.1963,22.8594},
{2317.3740,-1748.8496,13.3822},
{2352.1912,-1673.8510,13.5314},
{2427.8057,-1612.1277,26.6325},
{2513.1516,-1659.7305,13.6431},
{2522.6194,-1752.0939,13.5469},
{2463.5796,-1794.1737,13.6728}
};

new Float:gMapSpawns2[][]= {
{2229.6516,-1141.5068,25.7969},
{2197.3640,-1082.5574,39.3104},
{2223.5845,-1051.4462,48.1517},
{2207.5991,-1008.9668,61.5210},
{2143.5073,-1004.4036,61.9231},
{2427.8057,-1612.1277,26.6325},
{2081.8887,-1049.0695,30.9284},
{2052.9575,-1105.6431,24.4322},
{2040.0748,-1217.9811,22.8408}
};
Код:
new Float:gMapSpawns1[9][3]= { 
{2161.4529,-1639.9576,14.2731},
{2250.9717,-1650.3555,15.4772},
{2245.1152,-1704.1963,22.8594},
{2317.3740,-1748.8496,13.3822},
{2352.1912,-1673.8510,13.5314},
{2427.8057,-1612.1277,26.6325},
{2513.1516,-1659.7305,13.6431},
{2522.6194,-1752.0939,13.5469},
{2463.5796,-1794.1737,13.6728}
};

new Float:gMapSpawns2[9][3]= {
{2229.6516,-1141.5068,25.7969},
{2197.3640,-1082.5574,39.3104},
{2223.5845,-1051.4462,48.1517},
{2207.5991,-1008.9668,61.5210},
{2143.5073,-1004.4036,61.9231},
{2427.8057,-1612.1277,26.6325},
{2081.8887,-1049.0695,30.9284},
{2052.9575,-1105.6431,24.4322},
{2040.0748,-1217.9811,22.8408}
Reply
#3

doesnt work
Reply
#4

Quote:
Originally Posted by ivndosos
Посмотреть сообщение
doesnt work
Код:
public OnPlayerSpawn(playerid)
{
	switch( MapChange ) {// русскии попробуи так
	case 0: {

			switch(random(9)){
			case 0: SetPlayerPos(playerid, 2161.4529,-1639.9576,14.2731);
			case 1: SetPlayerPos(playerid, 2250.9717,-1650.3555,15.4772);
			case 2: SetPlayerPos(playerid, 2245.1152,-1704.1963,22.8594);
			case 3: SetPlayerPos(playerid, 2317.3740,-1748.8496,13.3822);
			case 4: SetPlayerPos(playerid, 2352.1912,-1673.8510,13.5314);
			case 5: SetPlayerPos(playerid, 2427.8057,-1612.1277,26.6325);
			case 6: SetPlayerPos(playerid, 2513.1516,-1659.7305,13.6431);
			case 7: SetPlayerPos(playerid, 2522.6194,-1752.0939,13.5469);
			case 8: SetPlayerPos(playerid, 2463.5796,-1794.1737,13.6728);
			}

			SetPlayerFacingAngle(playerid, gMapSpawns1[gMap1][2]);
		}
	case 1: {
			switch(random(9)){
			case 0: SetPlayerPos(playerid, 2229.6516,-1141.5068,25.7969);
			case 1: SetPlayerPos(playerid, 2197.3640,-1082.5574,39.3104);
			case 2: SetPlayerPos(playerid, 2223.5845,-1051.4462,48.1517);
			case 3: SetPlayerPos(playerid, 2207.5991,-1008.9668,61.5210);
			case 4: SetPlayerPos(playerid, 2143.5073,-1004.4036,61.9231);
			case 5: SetPlayerPos(playerid, 2427.8057,-1612.1277,26.6325);
			case 6: SetPlayerPos(playerid, 2081.8887,-1049.0695,30.9284);
			case 7: SetPlayerPos(playerid, 2052.9575,-1105.6431,24.4322);
			case 8: SetPlayerPos(playerid, 2040.0748,-1217.9811,22.8408);
                        }
			
                        SetPlayerFacingAngle(playerid, gMapSpawns2[gMap2][2]);
		}
	}
	return true;
}
Reply
#5

doesn't work
Reply
#6

Try this

PHP код:
enum MapInfo
{
        
Float:XPOS,
        
Float:YPOS,
        
Float:ZPOS
};
new 
Float:gMapSpawns1[][MapInfo] =
{
        
//Coords                   
        
{2161.4529,-1639.9576,14.2731},
        {
2250.9717,-1650.3555,15.4772},
        {
2245.1152,-1704.1963,22.8594},
        {
2317.3740,-1748.8496,13.3822},
        {
2352.1912,-1673.8510,13.5314},
        {
2427.8057,-1612.1277,26.6325},
        {
2513.1516,-1659.7305,13.6431},
        {
2522.6194,-1752.0939,13.5469},
        {
2463.5796,-1794.1737,13.6728}
};
public 
OnPlayerSpawn(playerid)
{
    switch( 
MapChange )
    {
        case 
0:
        {
           new 
gMap1 randomsizeof gMapSpawns1 ));
           
SetPlayerPos(playeridgMapSpawns1[gMap1][XPOS], gMapSpawns1[gMap1][YPOS], gMapSpawns1[gMap1][ZPOS]);
           
SetPlayerFacingAngle(playeridgMapSpawns1[randombag][ZPOS]);
        }
   }
   return 
1;

Reply
#7

What do you mean the map doesn't change?

Like, it says the map is changing but you spawn inside the same map? Or it doesn't even change the map after x amount of minutes and doesn't say anything? Or does it work for a couple of maps and then stops working?

If you did it like in the tutorial, show us your MapTimer and NewRound timers.
Reply
#8

Код:
new MapChange;

forward MapTimer(playerid);

	}
	SetTimer("ChangeMap", 5000, true);
	
	MapChange = 0;

	return 1;
}

public MapTimer(playerid)
{
   MapChange ++;
   
   GameTextForAll("~y~LOADING NEW MAP", 4000, 6);
   
   SetTimer("StartingNewMap", 4000, false);

   return 1;
}

public StartNewMap()
{

   for(new i = 0; i < MAX_PLAYERS; i++) {
		SpawnPlayer(i);
		
		   switch( MapChange ) {

				  case 0: {

					   SendClientMessage(i, -1, "{FF0000}[SERVER]: The map has been changed, You can start playing now.");
				  }
				  case 1: {

					   SendClientMessage(i, -1, "{FF0000}[SERVER]: The map has been changed, You can start playing now.");
				  }
		  }
  }
  return 1;
}
Reply
#9

Your code should be causing lots of compilation errors.
See if this works.

Place this at the top of your gamemode
PHP код:
#define MapCount 2 //change this number to the amount of maps you have in your gamemode
static MapChange 0
This will be used to determine if you have reached the end of your maps and if you should start from the beginning again.

Here are the timers:
PHP код:
forward MapTimer();
public 
MapTimer()
{
    
MapChange++;
    if ( 
MapChange == MapCount )
        
MapChange 0;
    
    
GameTextForAll("~y~LOADING NEW MAP"40006);
    
SetTimer("StartNewMap"4000false);
    return 
1;
}
forward StartNewMap();
public 
StartNewMap()
{
   for(new 
0MAX_PLAYERSi++) 
   {
        
SpawnPlayer(i);
        
SendClientMessage(i, -1"{FF0000}[SERVER]: The map has been changed, You can start playing now.");
  }
  return 
1;

Place this in OnGameModeInit()
PHP код:
SetTimer("MapTimer",180000,true); 
Keep the OnPlayerSpawn() code like you did in your initial post.
Reply
#10

works thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)