Jump to content

Vehicles cant be pushed by on foot.


overlocus

Recommended Posts

  • Moderators
Posted

I don't think that is possible by default.

 

    do
    	local vehicles = getElementsByType("vehicle")
    	for i=1, #vehicles do
    		local vehicle = vehicles[i]
    		setElementFrozen(vehicle, true)
    	end
    end

You can freeze the vehicles, but that also means you can't drive them any more.

https://wiki.multitheftauto.com/wiki/SetElementFrozen

 

 

Or you could make the vehicles more heavy, with: (recommend this one)

https://wiki.multitheftauto.com/wiki/SetModelHandling

 

Or you can remove the collision between the players and the vehicles:

https://wiki.multitheftauto.com/wiki/SetElementCollidableWith

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

try this

addEventHandler("onClientElementStreamIn", getRootElement(), function()
	if getElementType(source) == "vehicle" then
		#getVehicleOccupants(source) == 0 then
			setElementFrozen(source,true)
		end
	end
end)

addEventHandler("onClientVehicleEnter", getRootElement(),function()
	if #getVehicleOccupants(source) == 1 then -- not sure right here (check if car empty)
		setElementFrozen(source,false)
	end
end)

@overlocus

  • Like 1
Posted (edited)

You can find default .COL files on the net for all GTA vehicles, if I were you, I'd try loading the .COL to a trashcan object or something, then attach the trashcan to the car using attachElement, then make the trashcan invisible using .TXD or shaders, not sure if .COL created for vehicles will load to regular objects though..
If it crashes MTA you must create your own .COL file using 3DS Max or there's other programs that can create .COL as well, but harder to use in my opinion.

The code above will probably work also xD

Edited by JustinMTA

I can do 3D vehicle/object mods and basic scripts from scratch, contact me for free help!!
Skype/Discord/Telegram: [email protected] / Justin|X5|#0977 / @JustinX5
Xtreme 5 Gaming - COMING SOON!

I'd love it if more people in MTA utilized these amazing features, so please ask me anything related to 3D modeling/basic scripting/etc.
The expert knows more and more about less and less until they know everything about nothing.

  • 2 weeks later...
Posted

Freezing on exit should be enough to satisfact what you're asking for.

Unfreeze only when entering and there's a player on driver's seat

"El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más".

Att: -|TG|-Mister[Q]<.

Posted
On 18/08/2018 at 18:53, JustinMTA said:

You can find default .COL files on the net for all GTA vehicles, if I were you, I'd try loading the .COL to a trashcan object or something, then attach the trashcan to the car using attachElement, then make the trashcan invisible using .TXD or shaders, not sure if .COL created for vehicles will load to regular objects though..
If it crashes MTA you must create your own .COL file using 3DS Max or there's other programs that can create .COL as well, but harder to use in my opinion.

The code above will probably work also xD

No sense, but nvm.

  • Haha 2

"Keep making it simplex."

Posted
4 hours ago, Simple01 said:

No sense, but nvm.

Or maybe you don't have an imagination xD

  • Haha 1

I can do 3D vehicle/object mods and basic scripts from scratch, contact me for free help!!
Skype/Discord/Telegram: [email protected] / Justin|X5|#0977 / @JustinX5
Xtreme 5 Gaming - COMING SOON!

I'd love it if more people in MTA utilized these amazing features, so please ask me anything related to 3D modeling/basic scripting/etc.
The expert knows more and more about less and less until they know everything about nothing.

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