Enable/disable Thrusters, Wheels, etc.?

How could I make a server script which would prevent Thrusters and Wheels (and, ideally, other things like Hydraulics and other means of adding movement to a contraption) from working? Basically, I want to disable all means of motion which haven’t been linked to a special SEnt. And then I want that SEnt to control whether or not they can move.

I would prefer a method which doesn’t involve disabling the motion of things. I’d also prefer if it didn’t require a special Gamemode.

**[Gamemode.CanTool

http://imgur.com/eJ2Yc.png](wiki.garrysmod.com/?title=Gamemode.CanTool)**

Erm… Okay, that’d prevent someone from making them. Which isn’t what I want.

After some testing, I’ve had some success with this:
[lua]
– Disable all un-Engined motivators.
function PreventMotivators()
for i, e in ipairs(ents.FindByClass(“gmod_thruster”)) do
if e.force ~= 0 then
e.RDAforce = e.force
e.force = 0
end
end
for i, e in ipairs(ents.FindByClass(“gmod_wheel”)) do
if e.TorqueScale ~= 0 then
e.RDATorqueScale = e.TorqueScale
e.TorqueScale = 0
end
end
end
timer.Create( “RDAPreventMotivators”, GetConVarNumber(“RDA_Option_ThinkDelay”)*4, 0, PreventMotivators )
[/lua]
Is there a better way?

How can you have them without making them?

He wants them to stop working, as if an EMP hit them or something.

Exactly. In this case, I want to make thrusters, etc., not work unless they’re receiving energy.

… But that EMP idea is pretty hot. I’d sure love to see an EMP rocket launcher SWep…

Yeah, you’re right. .force is the thruster variable.

I’ve found a problem with changing a Thrusters .force to 0: If someone holds down the thrust button, then .force gets set to 0, the Thruster will just keep on flying. It doesn’t seem to update until the button is let go. So, any ideas on how I can update it immediately?

gmod_thruster:Switch(false) turns the thruster off, as said in http://luabin.foszor.com/code/gamemodes/sandbox/entities/entities/gmod_thruster/init.lua

Ah, nice. Thank you. I don’t suppose there’s something like that for Wheels, too?

:SetToggle(true or false)