ok, need this quick. if i connect a lever up to a floodgate and open them, then remove the lever and then connect up a sensor trap:
when the sensor trap is activated will the flood gates close?
By sensor trap, I assume you mean pressure plate.
When a pressure plate is triggered, it sends an 'open' signal to whatever it's connected to. If it is connected to a floodgate, and that floodgate is already opened, nothing will happen. Sending an 'open' signal to something that is already open has no effect.
100 cycles after the pressure plate is no longer triggered (the creature on it has left) the pressure plate will send a 'close' command to the floodgate. Floodgates have a 100 cycle delay on opening or closing, so 200 cycles after the creature steps off the pressure plate, the floodgate will close.
also how does it work if you have a lever and a sensor connected to the same thing? if the sensor trap has lets say opened a hatch, can i force it closed with he lever? and then what happens when the sensor trap is no longer active, will it open again?
When you have multiple triggers connected to the same target, the target will generally obey the last signal it receives. Pressure plates send 'open' commands when triggered, and 'close' commands 100 cycles after being un-triggered. They only send these commands once, not continuously. Levers send 'open' commands when flipped from one position to the other, and 'close' commands when flipped back the other way - again, only sending a single command the moment they're triggered.
What makes things a little trickier is that many triggerable buildings have delay times between when they get a trigger and when they activate, and any commands received during this time is ignored. For example, if you have a pressure plate linked to a floodgate, then when something steps on the pressure plate it will send an 'open' command to the floodgate. The floodgate will wait 100 cycles, then open. If during this time a dwarf throws a lever connected to the floodgate to the 'off' position, it will send a close command to the floodgate, but the floodgate will ignore this command because it is already acting on a command. This can cause trigger-able buildings to get out of sync with pressure plates or levers, and it's why you always want to have backup manual control levers on every pressure plate controlled system.