Vehicle Locking [v1.2]

Poll

Should I make a seperate model/color for the car key?

Yes
23 (85.2%)
No
4 (14.8%)

Total Members Voted: 27

Author Topic: Vehicle Locking [v1.2]  (Read 6544 times)

    Vehicle Locking
    Requires Item_Key (default)

    Are you tired of newbies stealing your jeep? Now, you can just use a Car Key or type /togglelock to ensure that nobody can take it. (except for Super Admins..)

    Features
    • You can spawn a Car Key item with a brick to use on planes or cars that you own.
    • To claim ownership of a vehicle, just jump inside of it for the first time. It's that simple. From then on, you can use Car Keys or..
    • /togglelock! Looking at a vehicle you own and typing /togglelock will lock or unlock it (depending on what it was) without the need of a Car Key.
      • There are now two preferences, whether admins are allowed to unlock any car and what level an admin has to be at (Admin/SuperAdmin/Host) to be able to do it.

    Notes
    Unfortunately, the Car Key doesn't work on vehicles like cannons or tank turrets that you can move around just by looking. (Another example are Filipe's Bikes)
    This is because they are technically classified as AIPlayers, meaning if I added functionality for them you would be able to lock and unlock bots, zombies, and other AIPlayers which is sort of weird. If enough people request it I can try to make something work exclusively for those vehicles though.

    Video Demo

    Download! [v1.2] (Dropbox, Justfilehosting is down)

    Old Versions
    v1: download
    v1.1: download[/list]
    « Last Edit: June 23, 2016, 12:22:21 PM by ZombieDude »

    this'll be great for CityRPGs...

    Amazing! This will be very useful!

    Is there a pref or something where it allows admins to enter locked cars or not, and select the admin power level of allowance?

    this'll be great for CityRPGs...
    that's mostly what i made this for yes
    Amazing! This will be very useful!

    Is there a pref or something where it allows admins to enter locked cars or not, and select the admin power level of allowance?
    no, but i can add it.
    by admin power level do you mean like admin/superadmin/host?

    no, but i can add it.
    by admin power level do you mean like admin/superadmin/host?
    Yeah

    Yeah

    Version 1.1

    • There are now two preferences! (for RTB and Blockland Glass, or editable in server.cs)
    • 1. Admin Allowance: Whether admins are allowed to unlock any car or not
    • 2. Admin Level: What level (Admin/SuperAdmin/Host) an admin must be at to unlock any car
    Download
    « Last Edit: June 21, 2016, 08:33:26 PM by ZombieDude »


    for bot vehicles you can check if they're ridable. though locking a horse seems weird, its weird in a quirky blocklandy way so it might be okay

    otherwise you could check if the uiname/datablockname includes the string "bike" or "boat"with strpos

    It'd be cool if you could add people to a whitelist for it, and if that's too complicated then just make it so that people with full trust could enter your car

    It'd be cool if you could add people to a whitelist for it, and if that's too complicated then just make it so that people with full trust could enter your car
    by enter do you mean while its locked or do you mean be able to unlock it and enter?
    i can do both pretty easily but the former i would have to make people able to enter while its locked which isnt that difficult
    for bot vehicles you can check if they're ridable. though locking a horse seems weird, its weird in a quirky blocklandy way so it might be okay

    otherwise you could check if the uiname/datablockname includes the string "bike" or "boat"with strpos
    yeah i was thinking checking if it was ridable or not which would actually work, but i'm not sure how to do that
    « Last Edit: June 21, 2016, 07:44:07 PM by ZombieDude »

    by enter do you mean while its locked or do you mean be able to unlock it and enter?
    i can do both pretty easily but the former i would have to make people able to enter while its locked which isnt that difficultyeah i was thinking checking if it was ridable or not which would actually work, but i'm not sure how to do that
    sorry for not clarifying, the former as you said is what I meant

    sorry for not clarifying, the former as you said is what I meant
    currently nobody is able to enter it if its locked
    i'd have to change it so the owner of the vehicle could get in which i guess is ok

    yeah i was thinking checking if it was ridable or not which would actually work, but i'm not sure how to do that
    %obj.getDatablock().canRide

    or maybe even %obj.canRide, if that attribute is passed down to the %obj. I forget.

    %obj.getDatablock().canRide

    or maybe even %obj.canRide, if that attribute is passed down to the %obj. I forget.
    that's nifty
    im working on v2 which will have that and drydess' request

    just found a kinda big bug with prefs, please re-download from the link if you downloaded it before