[Problema] Cambio de map
#1

Bueno, tengo un problema en el sistema de map change, veamos:

- Cuando los kills del equipo uno son iguales que los kills del equipo dos (Team1Kills == Team2Kills), al acabar la cuenta atrбs el mapa se cambia correctamente.

El problema es cuando los kills de un equipo son mayor que los de otro. Ocurre que al cambiar de mapa el jugador se queda 'bugeado' en una posiciуn determinada y no pasa al siguiente mapa.

Aquн los codes:

Код:
public TimeChange()
    {
	new seconds = CountDownTime % 60;
	new minutes = (CountDownTime - seconds) / 60;
	
	if(CountDownTime > 0)
	{
	    new string[64];
	    format(string, sizeof(string), "~y~%02d : %02d", minutes, seconds);
	    TextDrawSetString(Countdown, string);
	    CountDownTime--;
	}
	
	else if(CountDownTime == 0)
	{
	    if(Team1Kills > Team2Kills)
		{
			for(new i=0;i<MAX_PLAYERS;i++)
			{
 				if(gTeam[i] == TEAM1)
   				{
		        	GameTextForPlayer(i, "~b~SWATS ~n~~w~WINS THE GAME", 4000, 3);
					GivePlayerMoney(i, 2000);
					SendClientMessage(i, -1, "You get 2000$ for winning the round.");
					ApplyAnimation(i,"DANCING","dnce_M_e",4.0,1,0,0,0,-1);
					ApplyAnimation(i,"DANCING","dnce_M_e",4.0,1,0,0,0,-1);
					SetTimer("NewMapTimer",6000, false);

				}
				else
				{
			    	GameTextForPlayer(i, "~r~YOU LOST ~n~THE GAME", 4000, 3);
			    	ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
			    	ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
			    	SetTimer("NewMapTimer",6000,false);

				}
			}
		}
		
		else if(Team2Kills > Team1Kills)
		{
			for(new i=0;i<MAX_PLAYERS;i++)
			{
		    	if(gTeam[i] == TEAM2)
		    	{
		        	GameTextForPlayer(i, "~r~TERRORISTS ~n~~w~WINS THE GAME", 4000, 3);
		        	GivePlayerMoney(i, 2000);
		        	SendClientMessage(i, -1, "You get 2000$ for winning the round.");
		        	ApplyAnimation(i,"DANCING","dnce_M_e",4.0,1,0,0,0,-1);
		        	ApplyAnimation(i,"DANCING","dnce_M_e",4.0,1,0,0,0,-1);
		        	SetTimer("NewMapTimer",6000, false);

				}
				else
				{
			    	GameTextForPlayer(i, "~r~YOU LOST ~n~THE GAME", 4000, 3);
			    	ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
			    	ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
			    	SetTimer("NewMapTimer",6000, false);

				}
			}
		}
		
		else if(Team1Kills == Team2Kills)
		{
			GameTextForAll("Round Draw", 4000, 3);
			SetTimer("NewMapTimer",6000, false);
		}
		
		TextDrawSetString(Countdown, "~y~00 : 00");
		SetTimer("RestartCDTimer", 4000, false);
	    KillTimer(CDChange);
	}
	return 1;
    }
Ese public llama a los siguientes public:

Код:
public NewMapTimer()
    {
    for(new i=0;i<MAX_PLAYERS;i++)
	{
	    TogglePlayerControllable(i, 0);
	}
	MapChange++;
    GameTextForAll("~b~Loading New Map. Prepare to new round.", 4000, 3);
	SetTimer("StartedNewRound", 2000, false);
    return 1;
    }
Код:
public RestartCDTimer()
    {
	CountDownTime = 300;
	Team1Kills = 0;
	Team2Kills = 0;
	CDChange = SetTimer("TimeChange", 1000, true);
	return 1;
    }
Y tambiйn en public 'NewMapTimer' llama a йste:

Код:
public StartedNewRound()
    {
	for(new i=0;i<MAX_PLAYERS;++i)
	{
	    SpawnPlayer(i);
	    TogglePlayerControllable(i, 0);
	    GameTextForAll("Loading Objects", 3000, 3);
	    SetTimer("Unfreeze", 3000, false);
	 }
	return 1;
    }
їAlguna idea de quй puede ser?
Reply
#2

Bump, їnadie?
Reply
#3

Prueba sin el TogglePlayerControllable(i, 0);
Reply
#4

Todos los timers deben de ir fuera de los for
Reply
#5

Quote:
Originally Posted by Daniel-92
Посмотреть сообщение
Todos los timers deben de ir fuera de los for
Millуn de gracias, ya se ha solucionado, llevaba intentando arreglar este p*to problema como dos semanas.
Reply
#6

Una ъltima cosa, їquй hay mal en йste comando?, porque siempre me sale a mн el SendClientMessage. Y aunque ponga la ID de un jugador no conectado me sale a mн el mensaje.

Код:
CMD:explode(playerid, params[])
{
	new Float:X, Float:Y, Float:Z, id;
	new targetid, string[64];
	if(pInfo[playerid][pAdmin] < 2) return SCM(playerid, COLOR_RED, "You are not admin.");
	if(sscanf(params, "u", id)) return SCM(playerid, -1, "{32CD32}Use:{FFFFFF} /explode (playerid).");
	if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected.");
	GetPlayerPos(id, X, Y, Z);
	CreateExplosion(X, Y, Z, 7, 10);
    format(string, sizeof(string), "Admin {00BFFF}%s (%d) {FFFFFF}has exploded you.", GetName(playerid), playerid);
    SendClientMessage(targetid, -1, string);
	return 1;
}
Reply
#7

pawn Код:
CMD:explode(playerid, params[])
{
    new string[64];
    if(pInfo[playerid][pAdmin] < 2) return SCM(playerid, COLOR_RED, "You are not admin.");
    if(sscanf(params, "i", params[0])) return SCM(playerid, -1, "{32CD32}Use:{FFFFFF} /explode (playerid).");
    if(!IsPlayerConnected(params[0])) return SCM(playerid, COLOR_RED, "Player is not connected.");
    new Float:X, Float:Y, Float:Z;
        GetPlayerPos(params[0], X, Y, Z);
    CreateExplosion(X, Y, Z, 7, 10);
    format(string, sizeof(string), "Admin {00BFFF}%s (%d) {FFFFFF}has exploded you.", GetName(playerid), playerid);
    SendClientMessage(params[0], -1, string);
    return 1;
}
Reply
#8

Muchas gracias bytytus.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)