SA-MP Forums Archive
HELP WITH PLAyertopoint while in a car - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: HELP WITH PLAyertopoint while in a car (/showthread.php?tid=78308)



HELP WITH PLAyertopoint while in a car - mike_bisko - 18.05.2009

i hav this so far i neeed it to work while a player is in a car

Code:
if (PlayerToPoint(5.0, playerid, MatsDeliver[i][Matsx], MatsDeliver[i][Matsy], MatsDeliver[i][Matsz]))
 		{
		  if(MatsHolding[playerid] > 0)
		  {
		  	new payout = (50)*(MatsHolding[playerid]);
		    format(string, sizeof(string), "* The Factory Gave You %d Materials from your %d Packages.", payout, MatsHolding[playerid]);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
		    PlayerInfo[playerid][pMats] += payout;
		    MatsHolding[playerid] = 0;
		  }
	  	}



Re: HELP WITH PLAyertopoint while in a car - Backwardsman97 - 19.05.2009

pawn Code:
stock IsPlayerVehicleInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
{   // Created by Y_Less

    new
        Float:px,
        Float:py,
        Float:pz;
    GetVehiclePos(GetPlayerVehicleID(playerid), px, py, pz);
    px -= x;
    py -= y;
    pz -= z;
    return ((px * px) + (py * py) + (pz * pz)) < (range * range);
}
Very simple. And you need to swap your first two parameters around to make it fit this.


Re: HELP WITH PLAyertopoint while in a car - mike_bisko - 19.05.2009

Thank you for helping out i will try this as well i did get it to work by making a new command checkfordrivingpoint using playertopointstripped it checks to see if your in a car and that worked for the most part....undertimer i made this command
Code:
			if (GetPlayerState(i) == 2) CheckForDrivingTeleport(i);



Re: HELP WITH PLAyertopoint while in a car - Joe Staff - 19.05.2009

It shouldn't really matter, player position will be (near) the same as the player's vehicle position. Only the VehicleZAngle and PlayerFacingAngle are different, (PlayerFacingAngle doesn't update when player is in a vehicle)