lua is case sensitive so make sure function names match your file name - currently you have car and CAR
Quote: "function CAR_main(e)"
Quote: "function car_init(e)"
change whichever one doesn't match your file (i.e. car.lua or CAR.lua)
also you're missing a final 'end' to close the main(e) function
inCar = 0
speed = 0
maxspeed = 1000.0
turnspeed = 250
waitForKeyRelease = 0
function car_init(e)
end
function car_main(e)
if GetPlayerDistance(e) < 150 and incar == 0 and waitForKeyRelease == 0 then
Prompt ( "Press E to Enter")
if g_keypressE == 1 then
inCar = 1
waitForKeyRelease = 1
end
end
if inCar == 1 then
TransporttoIfUsed(e)
Collisionoff(e)
if g_keypressW == 1 then
speed = speed + 10
else
speed = speed -5
end
if g_keypressA == 1 then
RotateY(e,turnspeed)
end
if g_keypressD == 1 then
RotateY(e,turnspeed)
end
if g_keypressS == 1 then
speed = speed - 10
end
if speed > maxspeed then
speed + maxspeed
end
MoveForward( e ,speed)
if g_keypressE == 1 and waitForKeyRelease == 0 then
inCar = 0
waitForKeyRelease = 1
end
if g_keypressE == 0 then
waitForKeyRelease = 0
end
end
end