[Ajuda] Verificar quando o jogador entrar em uma бrea.
#2

Refactorizei um bocado. Veja se funciona agora:

pawn Код:
new bool:inArea[MAX_PLAYERS];

AvisoAreaRestritaSF(playerid) {
    if(isPlayerInPlace(playerid, -2956.8369, -1438.3058, -765.9012, 1587.6742)) {
        new stringAviso[250];

        if(!inArea[playerid]) {
            inArea[playerid] = true;

            SetTimer("EntrarAreaRestritaSF", 1000, true);
       
            format(stringAviso, sizeof(stringAviso), "(ATENЗВO!) Vocк acabou de entrar no espaзo aйreo de San Fierro, peзa autorizaзгo para efetuar o pouso, ou sua aeronave serб interceptada por mнsseis.");
            SendClientMessage(playerid, COR_VERMELHO, stringAviso);
        }
        else {
            inArea[playerid] = false;
            SetTimer("SairAreaRestritaSF", 1000, false);
            format(stringAviso, sizeof(stringAviso), "(ATENЗВO!) Vocк acabou de sair do espaзo aйreo de San Fierro. Sua aeronave nгo serб interceptada.");
            SendClientMessage(playerid, COR_VERMELHO, stringAviso);
        }
    }

    return 1;
}


isPlayerInPlace(playerid, Float:XMin, Float:YMin, Float:XMax, Float:YMax)
{
    new Float:pos[3];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);

    if(pos[0] >= XMin && pos[2] >= YMin && pos[0] <= XMax && pos[2] <= YMax)
    {
        return 1;
    }

    return 0;
}
Reply


Messages In This Thread
Verificar quando o jogador entrar em uma бrea. - by CypherInsano - 01.08.2018, 17:09
Re: Verificar quando o jogador entrar em uma бrea. - by GRiMMREAPER - 01.08.2018, 19:28
Re: Verificar quando o jogador entrar em uma бrea. - by CypherInsano - 01.08.2018, 19:51
Re: Verificar quando o jogador entrar em uma бrea. - by GRiMMREAPER - 01.08.2018, 19:54
Re: Verificar quando o jogador entrar em uma бrea. - by rjjj - 01.08.2018, 20:05

Forum Jump:


Users browsing this thread: 1 Guest(s)