SA-MP Forums Archive
[Ajuda] !IsPlayerInPlace - 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] !IsPlayerInPlace (/showthread.php?tid=665108)



!IsPlayerInPlace - iAplle - 22.03.2019

Eai galera!!
Entгo estou com um problema no IsPlayerInPlace.
Mais precisamente no comando /carregar da profissгo piloto.
Seguinte, o cara digita /carregar mas diz que ele nгo estб na area, segue o codigo:


PHP Code:
if(strcmp("/carregar", cmdtext, true, 10) == 0)
    {
        if(!
IsPlayerInPlace(playerid, 1950.638, -2636.443, 1915.860, -2612.534)) {
            
SendClientMessage(playerid, COR_ERRO, "| ERRO | Vocк nгo esta no local de carregamento.");
            return 
1;
        }
        if(
PlayerLeo[playerid][Profissao] != PILOTO) {
            
SendClientMessage(playerid, COR_ERRO, "| ERRO | Voce nгo e um piloto!");
            return 
1;
        }
        if(
GetVehicleModel(GetPlayerVehicleID(playerid)) != 593)
        {
            
SendClientMessage(playerid, COR_ERRO, "| ERRO | Vocк nгo esta em um aviгo.");
            return 
1;
        }
        
CCP[playerid] = 1;
        
SetPlayerRaceCheckpoint(playerid, 0, 1322.6554, 1354.3180, 10.8203, 306.5969,2519.2402,16.6951, 3.0); //aero lv
        
SendClientMessage(playerid, -1, "| AEROPORTO | Vocк pegou 3 pacotes entregue-os no {FF0000}checkpoint {FFFFFF}marcado em seu mapa");
        return 
1;
    } 
Final do GM:

PHP Code:
stock IsPlayerInPlace(playerid, Float:XMin, Float:YMin, Float:XMax, Float:YMax)
{
    new
        
RetValue = 0,
        
Float:aX,
        
Float:aY,
        
Float:aZ
    
;
    
GetPlayerPos(playerid, aX, aY, aZ);
    if(
aX >= XMin && aY >= YMin && aX < XMax && aY < YMax)
    {
        
RetValue = 1;
    }
    return 
RetValue;
} 



Re: !IsPlayerInPlace - ipsLuan - 22.03.2019

Use IsPlayerInRangeOfPoint.


Re: !IsPlayerInPlace - JeffSantos2 - 23.03.2019

O que o Luan falou й uma soluзгo, mas caso realmente queira usar o IsPlayerInPlace, faзa o seguinte.

Essa й o padrгo da funзгo que vocк postou, XMin = X Minimo, YMin = Y Minimo, XMax = X Maximo e YMax = Y Maximo, e assim por diante.
Code:
stock IsPlayerInPlace(playerid, Float:XMin, Float:YMin, Float:XMax, Float:YMax)
E vocк estб chamando a funзгo da seguinte maneira:
Code:
if(!IsPlayerInPlace(playerid, 1950.638, -2636.443, 1915.860, -2612.534))
Logo temos: XMin = 1950.638, YMin = -2636.443, XMax = 1915.860, YMax = -2612.534
Porйm, 1950.638 e й maior que 1915.860, logo a posiзгo deve ser invertida para:

Code:
if(!IsPlayerInPlace(playerid,  1915.860, -2636.443, 1950.638, -2612.534))
As coordenadas Y estгo corretas, sу inverter as coordenadas X e sucesso.


Re: !IsPlayerInPlace - iAplle - 23.03.2019

Quote:
Originally Posted by ipsLuan
View Post
Use IsPlayerInRangeOfPoint.
Consegui usar o IsPlayerInPlace msm, obrigado! Erб sу inverter as coordenadas.



Re: !IsPlayerInPlace - iAplle - 23.03.2019

Quote:
Originally Posted by JeffSantos2
View Post
O que o Luan falou й uma soluзгo, mas caso realmente queira usar o IsPlayerInPlace, faзa o seguinte.

Essa й o padrгo da funзгo que vocк postou, XMin = X Minimo, YMin = Y Minimo, XMax = X Maximo e YMax = Y Maximo, e assim por diante.
Code:
stock IsPlayerInPlace(playerid, Float:XMin, Float:YMin, Float:XMax, Float:YMax)
E vocк estб chamando a funзгo da seguinte maneira:
Code:
if(!IsPlayerInPlace(playerid, 1950.638, -2636.443, 1915.860, -2612.534))
Logo temos: XMin = 1950.638, YMin = -2636.443, XMax = 1915.860, YMax = -2612.534
Porйm, 1950.638 e й maior que 1915.860, logo a posiзгo deve ser invertida para:

Code:
if(!IsPlayerInPlace(playerid,  1915.860, -2636.443, 1950.638, -2612.534))
As coordenadas Y estгo corretas, sу inverter as coordenadas X e sucesso.
Obrigado, me ajudou muito!!