[Release][UNMAINTAINED] LockSystem 3.1 (Updated the 07/16/2018) [BETA]

@SofaKingToxic I’ve found ! Sorry i’m so noob :wink:

Replace line 6 at 8 on server.lua

TriggerEvent("es:getPlayerFromId", source, function(user)
    playerIdentifier = user.identifier
end)

by

local playerIdentifier = GetPlayerIdentifiers(source)[1]

It should work! Sorry for the inconvenience :wink:

1 Like

thank you based coder :smiley: will test

1 Like

oh yes i realized that once I implemented it. However I found a bug. Sometimes script breaks (a lot) and the system won’t work if you buy a car. But it will work perfectly on stolen cars.

1 Like

I don’t communicate with any database. So if you enter in your vehicle after bought it and press your key this should work :wink:

Send me a confirmation please :slight_smile:

Deed, You should impliment this into your code, It locks all NPC vehicles (to a point) but needs to be worked upon :slight_smile:

That way we can one, Only get keys to vehicles we have either spawned or purchased

two, It adds for some realism :smiley:

Citizen.CreateThread(function() 
    while true do              
        if DoesEntityExist(GetVehiclePedIsTryingToEnter(PlayerPedId())) then
            local veh = GetVehiclePedIsTryingToEnter(PlayerPedId())
            local lock = GetVehicleDoorLockStatus(veh)

            if lock == 7 then
                SetVehicleDoorsLocked(veh, 2)
            end
                 
            local pedd = GetPedInVehicleSeat(veh, -1)

            if pedd then                   
                SetPedCanBeDraggedOut(pedd, false)
            end             
        end   
        Citizen.Wait(0)	    							
    end
end)

is it possible to edit this that you only can’t enter cop vehicles? ^^

for that code curt_lee would it be possible to have a percent rate to steal the vehicle?

please leave an option to disable this if you do integrate theft chance , thanks :smiley:

1 Like

very possible :slight_smile: :smiley: 20 CHAR

just realized that your not using interact sounds PlayWithinDistance setting to have everyone in the local area hear the lock , could you possibly make your next version use that method so everyone in the area can hear the locks? (will help when people are trying to get into a car and you have to tell them wait im unlocking it , theyl just hear it and know like in irl ) much thanks as always

1 Like

I made a mistake in the script for random messages. I’m not here on the weekend so I’ll correct that when I come back. :confused:

I think adding PlayWithinDistance is a good idea but for other suggestions it should not be forgotten that it is a public script for lock / unlock. I can possibly do another version of the script for those who want the NPC cars to lock but that’s all.

If I limit the script too much by a percentage of steal or forbidding police cars then this may displease a lot of people. I hope you understand. For this you will have to code it yourself :stuck_out_tongue:

For those who want to fix the bug that sometimes prevents the player from having the keys. Replace the randomMsg function in server.lua with :

function RandomMsg()
	random = math.random(1, 5)
	if random == 1 then randomMsg = "You have found the keys on the sun-shield." end
	if random == 2 then randomMsg = "You found the keys in the glove box." end
	if random == 3 then randomMsg = "You found the keys on the passenger seat." end
	if random == 4 then randomMsg = "You found the keys on the floor." end
	if random == 5 then randomMsg = "The keys were already on the contact, you took them." end
	return randomMsg
end

OUTDATED SINCE THE NEW VERSIONS

@KingAlmond

i have done this, i will let you know once my friends test it, thanks :slight_smile: @Deediezi

1 Like

btw i tested this change and it works to remove the requirement , thanks again :smiley:

2 Likes

I’ve tested some situation for this plugin.
I’ve tried to spawn a vehicule take the keys, drive a little bit, go out and lock the car.
Then, i’ve spawned a second car and done the same actions.

I have the key for the two car so, i can lock/unlock them, but engine doesnt turn on.

If you can fix this it should be amazing :slight_smile:

2 Likes

I have the same problem. I can get out and get back in and it starts right back up but if i get out, lock the car, unlock the car, and then get back in it won’t start. I have tried it with several different vehicles and it’s always the same results.

1 Like

I have fixed this today. I’m not here this weekends so the update will come like Monday

1 Like

ok. Thanks.I appreciate it.

1 Like

@rob63082 @Guig2z

Update here ! :wink:

1 Like

Thanks dude :wink:
Glad to help to find some bugs :wink:

1 Like