PDA

View Full Version : [Problem] OnUnoccupiedVehicleUpdate


KubiPL
12/02/2014, 12:35 PM
This is fixed.

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:
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:

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

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?p=2909205&postcount=1315)

Kyle
12/02/2014, 12:47 PM
There is a bug in the new call back and has officially been acknowledged by dugi with a patch is on the way.

dugi
12/02/2014, 01:50 PM
Update to RC5-2 client.

KubiPL
13/02/2014, 09:31 AM
Thread updated, please read new issue.

Kirollos
13/02/2014, 11:29 AM
Why would you use SetVehicleToRespawn with returning 0?

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

KubiPL
13/02/2014, 11:46 AM
I don't want to update position when cheater teleport car.

Zunno
14/02/2014, 01:48 PM
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.