[Release] [Stand-alone] aCarLock 1.2 [LUA]

aCarLock


Summary

A stand-alone car locking script, which can be used with any other script.

Implementation

You can use the following events to use this resource with your other scripts.

Config

Client -> Server

  • TriggerServerEvent("aCarLock:AddKey", playersServerId
  • , vehiclePlate) Used to give someone access to the plate
  • TriggerServerEvent("aCarLock:RemoveKey", playersServerId, vehiclePlate) Used to revoke someones access to the plate
  • Server -> Client

  • TriggerClientEvent("aCarLock:AddKey", playerId) Called when player is given a key
  • TriggerClientEvent("aCarLock:RemoveKey", playerId) Called when player's key is removed
  • TriggerClientEvent("aCarLock:NoKey", source) Called when player doesn't have key

  • Extras

  • Post bugs below
  • Provide suggestions to add to the script
  • Give suggestions on any new script you would like to see

  • Direct Download
    Beatiful source code
    5 Likes

    Downloaded, put in resource, added in the server.cfg, didnt work. used capslock as it says in the file.

    Yea I accidentally changed it to up arrow

    So if i use up arrow it should work?

    Awesome! Works perfectly!

    Future idea; would be cool with some notification that “You locked your car”

    1 Like

    Yea I purposely left this out so that server owners could use the events listed to exactly that! Thank you for the idea though!

    Ah, gotcha. Do you know why my car is like 50/50, half the times it locks, and half the times it doesnt. Super weird.

    with this script?

    Yeah, is there any way to increase the sensitivity/radius of the key? I have to stand exactly at the right place for this script in order to lock the door.

    You need to look at the vehicle for it to work

    Does it work with custom addon vehicles \ emergency vehicles \ job vehicles?

    All vehicles should work with this

    Is there a /givekey or something similar to pass keys to another person?

    Just use the event TriggerServerEvent("aCarLock:AddKey", playersServerId , vehiclePlate) or TriggerEvent("aCarLock:AddKey", playersServerId , vehiclePlate) on a server sided script

    1 Like

    Thank you for this script.
    When adding server convars which is the right way in this case, i mean the format.
    Something like this?
    set temp_convar “aCarLock_ToggleLock”

    You can just do set aCarLock_Toggle 171

    1 Like

    Mind me asking where you do the convar? Thanks in advance.

    How do you “register” a vehicle so you can lock/unlock it? When I press capslock, nothing happens and the vehicle doesn’t get locked. I tried adding a print message just to make sure it registered the keypress and it did, just doesn’t interact with the vehicle at all.

    Thanks in advance!

    Please read the post. You use the events

    You set it in your server config

    1 Like