004F: create thread @Engine_Toggle

:Engine_Toggle
03A4: name_thread "On/Off"

:Switch  
0001: wait  50 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump if false @Switch
00D6: if  0
00E0:   player $PLAYER_CHAR driving
004D: jump if false @Switch
03C1: 0@ = player $PLAYER_CHAR car
0006:  1@ =  0 // integer values

:Engine
0001: wait  50 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump if false @Remove_Reference
00D6: if  0
00E0:   player $PLAYER_CHAR driving
004D: jump if false @Remove_Reference
00D6: if  2
01C1:   car  0@ stopped
00E1:   key_pressed  0  6 // Handbrak key
00E1:   key_pressed  0  18// Horn key
004D: jump if false @Engine

:Off
00D6: if  0
0039:    1@ ==  0 // integer values
004D: jump if false @On
0006:  1@ =  1 // integer values
02D4: unknown turn off car 0@ engine
0002: jump @Loop

:On
0006:  1@ =  0 // integer values
0369: put player $PLAYER_CHAR in car 0@
                 
:Loop
0001: wait  20 ms
00D6: if  1
00E1:   key_pressed  0  6 // Handbrak key
00E1:   key_pressed  0  18// Horn key
004D: jump if false @Engine
0002: jump @Loop
                 
:Remove_Reference
01C3: remove references to car 0@
0002: jump @Switch