SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 12/02/2014, 12:35 PM   #1
KubiPL
Big Clucker
 
KubiPL's Avatar
 
Join Date: Feb 2012
Posts: 157
Reputation: 18
Default [Problem] OnUnoccupiedVehicleUpdate

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)

Last edited by KubiPL; 13/02/2014 at 09:31 AM.
KubiPL is offline   Reply With Quote
Old 12/02/2014, 12:47 PM   #2
Kyle
High-roller
 
Join Date: Mar 2009
Location: United Kingdom
Posts: 2,260
Reputation: 333
Default Re: [Problem] OnUnoccupiedVehicleUpdate

There is a bug in the new call back and has officially been acknowledged by dugi with a patch is on the way.
__________________
Kyle is offline   Reply With Quote
Old 12/02/2014, 01:50 PM   #3
dugi
Beta Tester
 
Join Date: Jun 2007
Location: Poland
Posts: 2,350
Reputation: 862
Default Re: [Problem] OnUnoccupiedVehicleUpdate

Update to RC5-2 client.
__________________
dugi is offline   Reply With Quote
Old 13/02/2014, 09:31 AM   #4
KubiPL
Big Clucker
 
KubiPL's Avatar
 
Join Date: Feb 2012
Posts: 157
Reputation: 18
Default Re: [Problem] OnUnoccupiedVehicleUpdate

Thread updated, please read new issue.
KubiPL is offline   Reply With Quote
Old 13/02/2014, 11:29 AM   #5
Kirollos
Gangsta
 
Kirollos's Avatar
 
Join Date: Jun 2010
Location: Cairo, Egypt
Posts: 566
Reputation: 83
Default Re: [Problem] OnUnoccupiedVehicleUpdate

Why would you use SetVehicleToRespawn with returning 0?

I guess you should return 1 after SetVehicleToRespawn to apply the update + SetVehicleToRespawn
__________________
My github profile: https://github.com/Kirollos/

( ͡° ͜ʖ ͡°)
Kirollos is offline   Reply With Quote
Old 13/02/2014, 11:46 AM   #6
KubiPL
Big Clucker
 
KubiPL's Avatar
 
Join Date: Feb 2012
Posts: 157
Reputation: 18
Default Re: [Problem] OnUnoccupiedVehicleUpdate

I don't want to update position when cheater teleport car.
KubiPL is offline   Reply With Quote
Old 14/02/2014, 01:48 PM   #7
Zunno
Big Clucker
 
Zunno's Avatar
 
Join Date: Dec 2009
Location: Germany
Posts: 49
Reputation: 7
Default Re: [Problem] OnUnoccupiedVehicleUpdate

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.
__________________
Sorry for my bad english..

German Special Forces Reallife
Zunno is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get OnUnoccupiedVehicleUpdate called without a player's help? kristo Scripting Help 1 27/10/2013 09:57 AM
Можно туториал по public OnUnoccupiedVehicleUpdate safari Русский/Russian 3 13/03/2012 03:58 PM
HELP, OnUnoccupiedVehicleUpdate - read please OFirst Scripting Help 0 02/02/2012 03:45 AM
[SOLVED] 3 problem's! (1 problem still unsolved, but stopped solving.) Mechscape Help Archive 9 24/12/2009 08:47 PM


All times are GMT. The time now is 08:12 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.