[Ajuda] IsPlayerInRangeOfPoint
#8

O que F1NAL apresentou й um dos mйtodos, mas acho que hб maneiras melhores de nгo se utilizar tanto processamento...
PHP код:
static 
    
bool:spawned[MAX_PLAYERS],
    
bool:playerInPlace[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
spawned[playerid] = false;
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    if(!
spawned[playerid])
    {
        
spawned[playerid] = true;
        
playerInPlace[playerid] = false;
        
SetTimerEx("CheckPlayerInPlace"2000false"i"playerid);
    }
    return 
1;
}
forward CheckPlayerInPlace(playerid);
public 
CheckPlayerInPlace(playerid)
{
    if(
IsPlayerInRangeOfPoint(playerid7.00.00.00.0))
    {
        if(!
playerInPlace[playerid])
        {
            
playerInPlace[playerid] = true;
            
//Mostra o TD
        
}
    }
    else if(
playerInPlace[playerid])
    {
        
playerInPlace[playerid] = false;
        
//Oculta TD
    
}

Na lуgica acima, verificarб de 2 em 2 segundos se o jogador estб no local indicado, logo, caso esteja, a TextDraw serб mostrada apenas uma vez, e quando sair, a TextDraw serб ocultada tambйm uma ъnica vez.

Altere o intervalo do timer a seu gosto, mas creio que 2 segundos seja suficiente.
Reply


Messages In This Thread
IsPlayerInRangeOfPoint - by TheBob - 06.09.2016, 20:56
Re: IsPlayerInRangeOfPoint - by LockedLucas - 06.09.2016, 20:57
Re: IsPlayerInRangeOfPoint - by F1N4L - 06.09.2016, 20:58
Re: IsPlayerInRangeOfPoint - by TheBob - 06.09.2016, 21:06
Re: IsPlayerInRangeOfPoint - by LockedLucas - 06.09.2016, 21:11
Re: IsPlayerInRangeOfPoint - by F1N4L - 06.09.2016, 23:50
Re: IsPlayerInRangeOfPoint - by TheBob - 07.09.2016, 18:15
Re: IsPlayerInRangeOfPoint - by Bruno13 - 07.09.2016, 18:45
Re: IsPlayerInRangeOfPoint - by RiqueP - 07.09.2016, 19:10
Re: IsPlayerInRangeOfPoint - by TheBob - 07.09.2016, 19:13

Forum Jump:


Users browsing this thread: 2 Guest(s)