GetVehiclePos
#1

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?..
Reply
#2

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)