Skip to content

Commit bc3e7ec

Browse files
authored
Use QBCore string split function
1 parent e2a8e75 commit bc3e7ec

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

server/functions.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -598,11 +598,9 @@ function AddItem(identifier, item, amount, slot, info, reason, vehicleClass)
598598
local player = QBCore.Functions.GetPlayer(identifier)
599599

600600
local vehicle = nil
601-
for word in string.gmatch(identifier, "([^%-]+)") do
602-
if word == "trunk" or word == "glovebox" then
603-
vehicle = word
604-
break
605-
end
601+
local word = QBCore.Shared.SplitStr(item, '-')[1]
602+
if word == "trunk" or word == "glovebox" then
603+
vehicle = word
606604
end
607605
if player then
608606
inventory = player.PlayerData.items

0 commit comments

Comments
 (0)