Jump to content

C stack overflow


Recommended Posts

I think the problem is the way you are trying to get the matching model id.

In my opinion this would be a much simpler solution for this problem:

local vehicleModelIDs = {
  	[596] = true,
  	[523] = true,
  }

addEventHandler ("onVehicleExit", getRootElement (),
	function (thePlayer)
		if vehicleModelIDs[getElementModel(source)] then
			local passenger = getVehicleOccupant (source, 1)
			if passenger then
				removePedFromVehicle(passenger)
			end
		end
	end
)

This way adding and removing vehicle ids in the future will be easier. Let me know if it works or not.

Edited by Dzsozi (h03)
Link to comment
  • Moderators

 

if passenger and passenger ~= thePlayer then

Stack overflows are mostly happening when you created an infinity loop of function calls. A player leaves the vehicle triggering the event, which will remove a player, which will trigger the event, which will remove a player, which will trigger the event, which will remove a player, which will trigger the event, which will remove a player... ?

Note: The player is still inside of the vehicle when the event is triggered.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...