SA-MP Forums Archive
[Ajuda] Random nгo estб funcionando ??? '-' - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Random nгo estб funcionando ??? '-' (/showthread.php?tid=657200)



Random nгo estб funcionando ??? '-' - FullStarS - 03.08.2018

Boa noite pessoas do forum, estou com um problema em meu code e nгo consigo identificar, eis aqui o code..

Код:
public OnPlayerEnterCheckpoint(playerid)
{
	if(CarregarSprunk[0][playerid] == 1) {
		CarregarSprunk[0][playerid] = 0;
		if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498) {
			TogglePlayerControllable(playerid, false);
			RandomSprunks = random(3);
			switch(RandomSprunks)
			{
				case 0: CarregarSprunk[1][playerid] = SetPlayerCheckpoint(playerid, 1659.506958, 1721.457031, 10.828111, 1.0);
				case 1: CarregarSprunk[2][playerid] = SetPlayerCheckpoint(playerid, -1455.217651, 2593.229248, 55.835937, 1.0);
				case 2: CarregarSprunk[3][playerid] = SetPlayerCheckpoint(playerid, -14.815089, 1176.700927, 19.563381, 1.0);
			}
		}
	}
	DisablePlayerCheckpoint(playerid);
    return  true;
}
o problema й o seguinte, quando o player entra no checkpoint CarregarSprunk[0][playerid] ele congela o player normal, mas nгo seta o outro checkpoint ...


Re: Random nгo estб funcionando ??? '-' - FerrariL - 03.08.2018

Faзa um debug e veja se o valor da variбvel RandomSprunks estб assumindo algum valor dos cases.


Re: Random nгo estб funcionando ??? '-' - FullStarS - 03.08.2018

Quote:
Originally Posted by FerrariL
Посмотреть сообщение
Faзa um debug e veja se o valor da variбvel RandomSprunks estб assumindo algum valor dos cases.
Bom, pesquisei sobre debug, executei um e estб havendo o seguinte:

Код:
linha if(CarregarSprunk[0]... == 1, id de jogador: 0  posicao X obtida quando digitou: 1340.215087
linha do freezeplayer, id de jogador: 0  posicao X obtida quando digitou: 1340.215087
case 1, id de jogador: 0  posicao X obtida quando digitou: 1340.215087
linha if(CarregarSprunk[0]... == 1, id de jogador: 0  posicao X obtida quando digitou: 1341.641479
linha do freezeplayer, id de jogador: 0  posicao X obtida quando digitou: 1341.641479



Re: Random nгo estб funcionando ??? '-' - ForT - 03.08.2018

O problema estб na linha DisablePlayerCheckpoint(playerid). Vocк estб setando o checkpoint e em seguida removendo o mesmo.


Re: Random nгo estб funcionando ??? '-' - FullStarS - 03.08.2018

Quote:
Originally Posted by ForT
Посмотреть сообщение
O problema estб na linha DisablePlayerCheckpoint(playerid). Vocк estб setando o checkpoint e em seguida removendo o mesmo.
Era Exatamente isso.
Obrigado aos 2 pela ajuda,
1 me ajudou a descobrir mais uma coisa, o Debug.
Outro me ajudou a ver o problema que por sinal muito besta, kkkkk.
+Rep.