Stop Players Driving Vehicles

Hi,

I was just wondering if there is anyway to stop people from being able to drive vehicles in your gmod server using a piece of code in your lua scripts?

If anyone knows please can they help me!

Thanks

Krunder

[lua]
timer.Create(“timer_vehicle”, 1, 0, function(ply)
if ply:IsInVehicle() then
ply:Kill()
end
end
[/lua]
something like that, i don’t know if IsInVehicle is a function, sorry

I don’t want it too kill them. I want the vehicle to just not move when they try and accelerate?

http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4270.html is this what you’re looking for?

not sure, sorry.
try a weld function?

Donkie, I want them to get in the vehicle, but not be able to move until I put another line of code which lets them move

-Snip- No support given to users using unlicensed game-modes.

-late-

I am basically working on GMR and on the countdown at the beginning of the race I want them to not be able to move

I can’t test at the moment but I assume you can mess with with MoveData in http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index66ef.html

No, that didnt work _Undefined

[editline]11th January 2013[/editline]

Thanks anyway :slight_smile:

try



function mySetupMove(ply, mv)
	if (ply:KeyDown(IN_WALK) and !ply:IsAdmin() and if (ply:InVehicle())) then
		return false
	else
		return true
	end
end
hook.Add("SetupMove", "mySetupMove", mySetupMove)


Maybe? :slight_smile: