i take my hat off to you Mr.Peanut sir
here's a working solution using your trigger codition that dosnt need a script
make a bar gate named "gate1"
make 2 triggers:
1st trigger
condition:true
onact: gate1 animate ["Bargate", 1];
2nd trigger
rectangle
axis a:30
axis b:5
activation: anyone present repeatedly
condition: ({_x isKindOf "LandVehicle"} count thisList) > 0
on act.: gate1 animate ["Bargate", 0];
on dea.: gate1 animate ["Bargate", 1];
the 1st trigger closes the gate at the start of the mission so its shut to begin with.
the 2nd trigger should be placed as a rectangle with dimensions of about 30 x 5 on the road where the gate is so that any vehicle in the area will open the gate.