Posts: 1,534
	Threads: 179
	Joined: Apr 2009
	
	
 
	
	
		Hey i have proxdetector
pawn Код:
if(ProxDetectorS(8.0, playerid, clickedplayerid))
    {
 
but the problem is, if the player is in his own vehicle, and i in another then it will show that i am not near enough, or if he is on foot and i am in a vehicle it will also show that i am not near him
	
 
	
	
	
		
	
 
 
	
	
	
		
	Posts: 559
	Threads: 10
	Joined: Mar 2012
	
Reputation: 
0
	 
 
	
	
		If you are in vehicle you should use GetVehiclePos
	
	
	
	
		
	
 
 
	
	
	
		
	Posts: 559
	Threads: 10
	Joined: Mar 2012
	
Reputation: 
0
	 
 
	
	
		Show me the script where you have that with player distance.
With GetVehiclePos is just like this
new Float:X, Float:Y, Float:Z;
GetVehiclePos(vehicleid, X, Y, Z);
And X Y Z is the coordinates.
	
	
	
	
		
	
 
 
	
	
	
		
	Posts: 1,534
	Threads: 179
	Joined: Apr 2009
	
	
 
	
	
		
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    if(!IsACop(playerid))
    {
        SendClientMessage(playerid, COLOR_CRVENA, "You're not a cop");
        return 1;
    }
    if(ProxDetectorS(8.0, playerid, clickedplayerid))
    {
        if(Belt[clickedplayerid] == 0)
        {
            SendClientMessage(playerid, COLOR_CRVENA, "This player doesn't have the seatbelt on !");
        }
        else
        {
            SendClientMessage(playerid, COLOR_PLAVA1, "This player has the seatbelt on !");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "This player is not in your range !");
    }
    return 1;
}
 
pawn Код:
public ProxDetectorS(Float:radi, playerid, targetid)
{
    if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        //radi = 2.0; //Trigger Radius
        GetPlayerPos(targetid, posx, posy, posz);
        tempposx = (oldposx -posx);
        tempposy = (oldposy -posy);
        tempposz = (oldposz -posz);
        //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}
 
	 
	
	
	
		
	
 
 
	
	
	
		
	Posts: 1,534
	Threads: 179
	Joined: Apr 2009
	
	
 
	
	
		
Quote:
					Originally Posted by  Viniborn
 
 
Make an adaptation in ProxDetectorS 
pawn Код: 
if(IsPlayerInAnyVehicle(playerid))     GetPlayerPos(playerid, oldposx, oldposy, oldposz); else     GetVehiclePos(playerid, oldposx, oldposy, oldposz);
  if(IsPlayerInAnyVehicle(targetid))     GetPlayerPos(targetid, posx, posy, posz); else     GetVehiclePos(targetid, posx, posy, posz);  
  
 | 
 thanks+rep
	
 
	
	
	
		
	
 
 
	
	
	
		
	Posts: 2,938
	Threads: 162
	Joined: May 2010
	
	
 
	
	
		
Quote:
					Originally Posted by  Viniborn
 
 
Make an adaptation in ProxDetectorS 
pawn Код: 
if(IsPlayerInAnyVehicle(playerid))     GetPlayerPos(playerid, oldposx, oldposy, oldposz); else     GetVehiclePos(playerid, oldposx, oldposy, oldposz);
  if(IsPlayerInAnyVehicle(targetid))     GetPlayerPos(targetid, posx, posy, posz); else     GetVehiclePos(targetid, posx, posy, posz);  
  
 | 
 
Quote:
					Originally Posted by  Dripac
 
 
thanks+rep 
 | 
 
Make it the other way around lol..
pawn Код:
if(!IsPlayerInAnyVehicle(playerid))
{
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
}
else
{
    GetVehiclePos(playerid, oldposx, oldposy, oldposz);
}
if(!IsPlayerInAnyVehicle(targetid))
{
    GetPlayerPos(targetid, posx, posy, posz);
}
else
{
    GetVehiclePos(targetid, posx, posy, posz);
}
 
Also, what's wrong with GetPlayerDistanceFromPoint?
	
 
	
	
	
		
	
 
 
	
	
	
		
	Posts: 1,534
	Threads: 179
	Joined: Apr 2009
	
	
 
	
	
		
Quote:
					Originally Posted by  Viniborn
 
 
This really worked?    oO 
Is true ...
 
pawn Код: 
if(!IsPlayerInAnyVehicle(playerid))     GetPlayerPos(playerid, oldposx, oldposy, oldposz); else     GetVehiclePos(playerid, oldposx, oldposy, oldposz);
  if(!IsPlayerInAnyVehicle(targetid))     GetPlayerPos(targetid, posx, posy, posz); else     GetVehiclePos(targetid, posx, posy, posz);  
  
 | 
 i dont know dude it compiled without errors i hope it works !