SA-MP Forums Archive
[HELP] Help about OnUnoccupiedVehicleUpdate - 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: [HELP] Help about OnUnoccupiedVehicleUpdate (/showthread.php?tid=649615)



[HELP] Help about OnUnoccupiedVehicleUpdate - FelipeBlanco - 12.02.2018

Hi, my problem is when a passenger is pause and driver pulls the vehicle, OnUnoccupiedVehicleUpdate isn't called.
I want to make the vehicle stoped when driver pulls the vehicle, but this does not happen because the passenger is paused.
Код HTML:
new UNON = 1;
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z)
{
	if(UNON == 1)
	{
		new Float:PosX,Float:PosY,Float:PosZ,Float:PosA;
		GetVehiclePos(vehicleid, PosX, PosY, PosZ);
		GetVehicleZAngle(vehicleid, PosA);
		new Float:Distancia = GetDistanceBetweenPoints(new_x, Float:new_y, Float:new_z, PosX, PosY, PosZ);
		if(Distancia > 20.0)
		{
			SetVehiclePos(vehicleid, PosX, PosY, PosZ);
			SetVehicleZAngle(vehicleid, PosA);
			return ;
		}
	}
	else
	{
		static Float:distance,Float:pos_x,Float:pos_y,Float:pos_z,Float:angle;

		GetVehiclePos(vehicleid, pos_x, pos_y, pos_z);
		GetVehicleZAngle(vehicleid, angle);
		distance = VectorSize(pos_x - new_x, pos_y - new_y, pos_z - new_z);
		if(distance > 10 && pos_z > -70.0)
		{
			SetVehiclePos(vehicleid, pos_x, pos_y, pos_z);
			SetVehicleZAngle(vehicleid, angle);
		}
	}
}
My code

Sorry for my english, thanks


Re: [HELP] Help about OnUnoccupiedVehicleUpdate - RogueDrifter - 12.02.2018

Im confused as hell! You need to explain exactly what youre trying to achieve, what do you mean by vehicle stop when driver pulls???


Re: [HELP] Help about OnUnoccupiedVehicleUpdate - PepsiCola23 - 12.02.2018

"This callback is called when a player's client updates/syncs the position of a vehicle they're not driving. This can happen outside of the vehicle or when the player is a passenger of a vehicle that has no driver."

https://sampwiki.blast.hk/wiki/OnUnoccupiedVehicleUpdate


Re: [HELP] Help about OnUnoccupiedVehicleUpdate - Mugala - 12.02.2018

this callback will not be called, like PepsiCola23 said.
you can use variables for vehicle's position to be updated later.


Re: [HELP] Help about OnUnoccupiedVehicleUpdate - NaS - 12.02.2018

You could force the player out of the vehicle by respawning it and putting it back to where it was before (you can save the damage status and health as well). Important is to actually respawn it, RemovePlayerFromVehicle will not work if the player is paused.

This will make it unoccupied and the callback will work, but if the paused player returns he will not be in that vehicle anymore. You could place him back into it if the seat hasn't been taken by someone else.

It may look weird though for others, but it's worth a try I think.


Re: [HELP] Help about OnUnoccupiedVehicleUpdate - FelipeBlanco - 12.02.2018

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
Im confused as hell! You need to explain exactly what youre trying to achieve, what do you mean by vehicle stop when driver pulls
when the driver leaves the vehicle, the vehicle stops, but the callback isn`t called when passenger is paused


Re: [HELP] Help about OnUnoccupiedVehicleUpdate - PepsiCola23 - 12.02.2018

Quote:
Originally Posted by Mugala
Посмотреть сообщение
this callback will not be called like PepsiCola23 said.
you can use variables for vehicle's position to be updated later.
So you say samp wiki is wrong?


Re: [HELP] Help about OnUnoccupiedVehicleUpdate - Mugala - 12.02.2018

no I mean that u're right.


Re: [HELP] Help about OnUnoccupiedVehicleUpdate - PepsiCola23 - 12.02.2018

You just said “will NOT be called like PepsiCola23 said”


Re: [HELP] Help about OnUnoccupiedVehicleUpdate - Mugala - 12.02.2018

Quote:
Originally Posted by PepsiCola23
Посмотреть сообщение
You just said “will NOT be called like PepsiCola23 said”
"will NOT be called, like PepsiCola23 said"
I missed ,