[HELP] Help about OnUnoccupiedVehicleUpdate
#1

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

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

"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
Reply
#4

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

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

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

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?
Reply
#8

no I mean that u're right.
Reply
#9

You just said “will NOT be called like PepsiCola23 said”
Reply
#10

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


Forum Jump:


Users browsing this thread: 4 Guest(s)