Page 1 of 1

OnCharacterExitVehicle?

Posted: Sat May 30, 2009 5:29 pm
by RepSharpshooter
I tried using this function but it came up as a "null value" meaning it doesn't exist.

Code: Select all

mudkip = OnCharacterExitVehicle(
		function(player, vehicle)
			print(">>>OnExitVehicle<<<")
		end
	)

Is there any way to know when a character exits a vehicle? I'm currently working a hackish work-around with regions, but if there was a better way to grab the event as it happens that would be great.

EDIT: or is there at least a way to tell if the player is in a vehicle?

Re: OnCharacterExitVehicle?

Posted: Sat May 30, 2009 11:37 pm
by Frisbeetarian
GetCharacterVehicle should deliver a null result if the character is not in a vehicle.

Re: OnCharacterExitVehicle?

Posted: Sun Jun 07, 2009 2:10 am
by [RDH]Zerted
The best we can do is set a repeating timer to check to see if all the players are still in their vehicles.

You shouldn't just guess new functions. All the possible functions (yes, event callbacks are just functions, look at their format...) are accessible from Lua's global variables. The FakeConsole's Print Nested Globals (named something like that) will dump out all that info into the debug log. Look through that if you want to see if a function exists.

Re: OnCharacterExitVehicle?

Posted: Sun Jun 07, 2009 9:08 am
by RepSharpshooter
[RDH]Zerted wrote:You shouldn't just guess new functions. All the possible functions (yes, event callbacks are just functions, look at their format...) are accessible from Lua's global variables. The FakeConsole's Print Nested Globals (named something like that) will dump out all that info into the debug log. Look through that if you want to see if a function exists.
I usually don't just guess functions. Coding random code never leads to anything. It just seemed so obvious that if there was an EnterVehicle() and an ExitVehicle() and there was an OnEnterVehicle() that there would be an OnExitVehicle(). Obviously they just didn't get around to that one.

EDIT: In any case, I've decided to just use a work around. At first I was going to use the repeating timer to check if they were still in it, but in the end I just went with a button for simplicity.

Re: OnCharacterExitVehicle?

Posted: Mon Jun 08, 2009 4:41 pm
by [RDH]Zerted
A button? How is that supposed to work?

Re: OnCharacterExitVehicle?

Posted: Mon Jun 08, 2009 4:52 pm
by Maveritchell
[RDH]Zerted wrote:A button? How is that supposed to work?
I'm sure it's not a literal button, but something manual the user does ingame (like shooting a modeled button).