SA-MP Forums Archive
[Ajuda] Morrer em Gangzone - 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] Morrer em Gangzone (/showthread.php?tid=587085)



Morrer em Gangzone - BartWhite - 27.08.2015

Eae galera, eu criei uma gangzone que serб o local de dm, e gostaria que quando o player morresse dentro dessa бrea ele desse respawn nessa бrea msm, o meu code:

Код:
new SpawnBloqueado;

public OnPlayerSpawn(playerid)
{
	if(SpawnBloqueado == 1)
	{
    	        new Random = random(sizeof(RandomSpawns));
                SetPlayerInterior(playerid, 0);
		SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1],RandomSpawns[Random][2]);
    	        SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerInDM(playerid))
    {
        SpawnBloqueado[playerid] = 1;
    }
	return 1;
}

IsPlayerInDM(playerid)
{
	new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid, x, y, z);
    if(x >= -484.7343 && y >= 2301.6531 && x <= -313.4499&& y <= 2176.6023) return 1;
    else return 0;
}



Re: Morrer em Gangzone - iTakelot - 27.08.2015

Vocк pode fazer assim:

Код:
new bool:PlayerDM[MAX_PLAYERS]; //no topo

public OnPlayerDeath(playerid, killerid, reason)
{
    if (IsPlayerInRangeOfPoint(playerid, range, X, Y, Z)){PlayerDM[playerid] = true;}
    return 1;
}

public OnPlayerSpawn(playerid)
{
	if(PlayerDM[playerid] == true)
	{
        new Random = random(sizeof(RandomSpawns));
        SetPlayerInterior(playerid, 0);
		SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1],RandomSpawns[Random][2]);
        SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
        PlayerDM[playerid] = false;
	}
	return 1;
}



Respuesta: Morrer em Gangzone - BartWhite - 27.08.2015

Obrigado pela ajuda iTakelot, mas estб dando esse Warning:

warning 213: tag mismatch

Linha:

PlayerDM[playerid] = 1;


Re: Morrer em Gangzone - iTakelot - 27.08.2015

PlayerDM[playerid] = true;


Respuesta: Morrer em Gangzone - BartWhite - 27.08.2015

iTakelot, funcionou, obrigado mano +rep