SA-MP Forums Archive
GetVehiclePos - 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)
+--- Thread: GetVehiclePos (/showthread.php?tid=349520)



GetVehiclePos - Ectazy - 09.06.2012

Hi all, I have a problem with GetVehicle Pos. This is my script:

Код:
if(pickupid == pickups[0][car])
	{
	    new Float:cpo[3];
		GetVehiclePos(523,cpo[0],cpo[1],cpo[2]);

		if(!PlayerToPoint(7,playerid,cpo[0],cpo[1],cpo[2]))
		{
			SendClientMessage(playerid,RED,"* The car is too far.");
   	        return 1;
		}
		
		GivePlayerMoney(playerid, 500);
		return 1;
}
When i arrive with this car and get on pickup, it say The car is too far, but money not give to me. What is the problem?..


Re: GetVehiclePos - MP2 - 09.06.2012

Why are you even checking the distance? Surely if they enter a pickup they're at the pickup's coordinates..?


Re: GetVehiclePos - Ectazy - 09.06.2012

But when I delete this, it doesn't work, and say the car is too far..


Re: GetVehiclePos - Sandiel - 09.06.2012

The problem is, the function OnVehiclePos loops through all the spawned vehicles of type 523 and gets their pos
So, what you need to do is to specify that vehicle's ID, such as storing it in a variable.


Re: GetVehiclePos - MadeMan - 09.06.2012

pawn Код:
if(pickupid == pickups[0][car])
    {
        GivePlayerMoney(playerid, 500);
        return 1;
    }