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



[Problem] OnUnoccupiedVehicleUpdate - KubiPL - 12.02.2014

This is fixed.
Quote:

Why this callback isn't called, when there's no players around and one player pushes cars? In previous version this worked well, but now it's called when there is some players.
Also when player push car away from car old position, this isn't sent to server and when you get vehicle position server-side, it isn't changed. Look at video below.

Code:
Code:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z)
{
	static Float:x, Float:y, Float:z, str[32];
	GetVehiclePos(vehicleid, x, y, z);
	SendClientMessage(playerid, -1, "Veh update");
	if(VectorSize(x-new_x, y-new_y,z-new_z) > 1.0)
	{
	    format(str, 32, "Unocc: veh %d return 0", vehicleid); 
	    SendClientMessage(playerid, -1, str);
		return 0;
	}
	return 1;
}
Video:
http://www.youtube.com/watch?v=4C8trLQXplw
UPDATED
I think this callback isn't woking well, sometimes it's going to update position (checked with getvehiclepos) when it's actually returning 0 in script.
Please, look at video and code:

[ame]http://www.youtube.com/watch?v=xr_PHQN0f9Q[/ame]

CODE:
Code:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z)
{
	static Float:x, Float:y, Float:z;
	GetVehiclePos(vehicleid, x, y, z);
	if(VectorSize(x-new_x, y-new_y,z-new_z) > 0.4)
	{
		SetVehicleToRespawn(vehicleid);
		return 0;
	}
	return 1;
}
Vehicle isn't respawned when cheater with CLEO (fck this..) throws it in others cars and veh get stucked.

To dev team - please see also this suggestion (http://forum.sa-mp.com/showpost.php?...postcount=1315)


Re: [Problem] OnUnoccupiedVehicleUpdate - Kyle - 12.02.2014

There is a bug in the new call back and has officially been acknowledged by dugi with a patch is on the way.


Re: [Problem] OnUnoccupiedVehicleUpdate - dugi - 12.02.2014

Update to RC5-2 client.


Re: [Problem] OnUnoccupiedVehicleUpdate - KubiPL - 13.02.2014

Thread updated, please read new issue.


Re: [Problem] OnUnoccupiedVehicleUpdate - Kirollos - 13.02.2014

Why would you use SetVehicleToRespawn with returning 0?

I guess you should return 1 after SetVehicleToRespawn to apply the update + SetVehicleToRespawn


Re: [Problem] OnUnoccupiedVehicleUpdate - KubiPL - 13.02.2014

I don't want to update position when cheater teleport car.


Re: [Problem] OnUnoccupiedVehicleUpdate - Zunno - 14.02.2014

You see the vehicles, that you have teleportet, but if you go away that the vehicle is streaming out an in. The vehicle is at the old pos, because it is not synced on return 0.