From a38b5041bf6847e2edfb57d051215204792f5281 Mon Sep 17 00:00:00 2001 From: Joew Alabel Date: Sat, 29 Feb 2020 14:31:13 -0300 Subject: [PATCH 1/3] Only working cops can open/closes doors at prison and police stations. Can config doors on the file: s_police_doors.lua --- package.json | 1 + police/s_police_doors.lua | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 police/s_police_doors.lua diff --git a/package.json b/package.json index ccfbf296..dd06a2bb 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "whitelist/server.lua", "animation/server.lua", "police/s_police.lua", + "police/s_police_doors.lua", "stylist/server.lua", "idcard/server.lua", "licenses/server.lua", diff --git a/police/s_police_doors.lua b/police/s_police_doors.lua new file mode 100644 index 00000000..7e1591ba --- /dev/null +++ b/police/s_police_doors.lua @@ -0,0 +1,32 @@ +local modelsPrison = { + {model = 5}, + {model = 7}, + {model = 10}, + {model = 11}, + {model = 12}, + {model = 13}, + {model = 14}, + {model = 15}, + {model = 16}, + {model = 39} +} + +AddEvent("OnPlayerInteractDoor", function(player, door) + for k, v in pairs(modelsPrison) do + if GetDoorModel(door) == v.model then + if PlayerData[player].job == 'police' then + if IsDoorOpen(door) then + SetDoorOpen(door, true) + else + SetDoorOpen(door, false) + end + else + if IsDoorOpen(door) then + SetDoorOpen(door, false) + else + SetDoorOpen(door, true) + end + end + end + end +end) \ No newline at end of file From aa3ee87b33511b8ef94a64e382aa46a1bd010c9b Mon Sep 17 00:00:00 2001 From: Joew Alabel Date: Tue, 3 Mar 2020 22:38:10 -0300 Subject: [PATCH 2/3] Improvised the code. --- police/s_police_doors.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/police/s_police_doors.lua b/police/s_police_doors.lua index 7e1591ba..4da2296b 100644 --- a/police/s_police_doors.lua +++ b/police/s_police_doors.lua @@ -24,7 +24,7 @@ AddEvent("OnPlayerInteractDoor", function(player, door) if IsDoorOpen(door) then SetDoorOpen(door, false) else - SetDoorOpen(door, true) + --SetDoorOpen(door, true) end end end From aa02d87abb2c05c4819e7e2a8e55542ab5a43152 Mon Sep 17 00:00:00 2001 From: Joew Alabel Date: Tue, 3 Mar 2020 22:42:11 -0300 Subject: [PATCH 3/3] Improvised the code. --- police/s_police_doors.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/police/s_police_doors.lua b/police/s_police_doors.lua index 7e1591ba..0ee011c0 100644 --- a/police/s_police_doors.lua +++ b/police/s_police_doors.lua @@ -15,17 +15,9 @@ AddEvent("OnPlayerInteractDoor", function(player, door) for k, v in pairs(modelsPrison) do if GetDoorModel(door) == v.model then if PlayerData[player].job == 'police' then - if IsDoorOpen(door) then - SetDoorOpen(door, true) - else - SetDoorOpen(door, false) - end + SetDoorOpen(door, IsDoorOpen(door)) else - if IsDoorOpen(door) then - SetDoorOpen(door, false) - else - SetDoorOpen(door, true) - end + SetDoorOpen(door, not IsDoorOpen(door)) end end end