Turning On Vehicle Lights with L key | Helathien

[KM]Helathien

  • Newbie
  • Posts: 21
Turning On Vehicle Lights with L key | Helathien
«  »Last edited
Using Keys to turn on vehicle Lights!

Hi there!
This is a easy tutorial, if you find any problems or bugs in this snippet feel free to PM me or Reply in the comments below :D.

First of all paste this onScriptLoad()
Code: [Select]
function onScriptLoad ( )
{
L <- BindKey(true, 0x4C, 0, 0);
print( "BindKey Loaded. Key by [KM]Helathien." )
}

After That Find This Function In your server function onKeyDown( player, key )
And Paste This here:
Code: [Select]
function onKeyDown( player, key )
{
if ( key == L )
{
if ( !player.Vehicle ) return 0;
else
{
local v = player.Vehicle;
if ( v.Lights == true )
{
v.Lights = false;
MessagePlayer( "[#00ff00][LIGHTS] [#ffffff]Vehicle lights turned off." , player )
}
else if ( v.Lights == false )
{
v.Lights = true;
MessagePlayer( "[#00ff00][LIGHTS] [#ffffff]Vehicle lights turned on." , player )
}
}
}
}

And there you go!
Just sit in any vehicle and press the "L" key and the lights will turn on!
Hope it helps.
Feel free to PM.
This idea came from this script request: https://forum.vc-mp.org/?topic=5273.0
Feel free to PM me for any help.
If I am not available on the forum come to VKs Official Server I am usually there.

rww

  • VC:MP Beta Tester
  • LU-DM Team
  • Posts: 346