[Ajuda] !IsPlayerInPlace
#1

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"cmdtexttrue10) == 0)
    {
        if(!
IsPlayerInPlace(playerid1950.638, -2636.4431915.860, -2612.534)) {
            
SendClientMessage(playeridCOR_ERRO"| ERRO | Vocк nгo esta no local de carregamento.");
            return 
1;
        }
        if(
PlayerLeo[playerid][Profissao] != PILOTO) {
            
SendClientMessage(playeridCOR_ERRO"| ERRO | Voce nгo e um piloto!");
            return 
1;
        }
        if(
GetVehicleModel(GetPlayerVehicleID(playerid)) != 593)
        {
            
SendClientMessage(playeridCOR_ERRO"| ERRO | Vocк nгo esta em um aviгo.");
            return 
1;
        }
        
CCP[playerid] = 1;
        
SetPlayerRaceCheckpoint(playerid01322.65541354.318010.8203306.5969,2519.2402,16.69513.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(playeridFloat:XMinFloat:YMinFloat:XMaxFloat:YMax)
{
    new
        
RetValue 0,
        
Float:aX,
        
Float:aY,
        
Float:aZ
    
;
    
GetPlayerPos(playeridaXaYaZ);
    if(
aX >= XMin && aY >= YMin && aX XMax && aY YMax)
    {
        
RetValue 1;
    }
    return 
RetValue;

Reply
#2

Use IsPlayerInRangeOfPoint.
Reply
#3

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.
Reply
#4

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

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!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)