Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GiveKeys when vehicle is spawned by admin menu. #70

Merged
merged 4 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
root = true
[*]
end_of_line = lf
insert_final_newline = false
indent_style = space
charset = utf-8
trim_trailing_whitespace = true
indent_size = 4
root = true

[*]
end_of_line = lf
insert_final_newline = false
indent_style = space
charset = utf-8
trim_trailing_whitespace = true
indent_size = 4
solareon marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 1 addition & 3 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,7 @@ lib.callback.register('qbx_admin:server:spawnVehicle', function(source, model)
warp = true,
})

local plate = qbx.getVehiclePlate(NetworkGetEntityFromNetworkId(netId))

exports.qbx_vehiclekeys:GiveKeys(source, plate)
exports.qbx_vehiclekeys:GiveKeys(source, NetworkGetEntityFromNetworkId(netId))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unneeded, I believe, as the spawnVehicle function returns both the entity and the netId if I remember correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I'm reviewing the code, a lot of it is still using old functions, I'm readapting it here. I just saw that a function is called to add a key to the client, but it wasn't working for some reason, the admin script itself is using a lot of functions internally (qb-*).

Copy link
Contributor

@solareon solareon Sep 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What he is referring to is that at line 292 that function returns both the netid and the entity number so you just need to take it from that function and pass it directly to the export.

return netId
end)

Expand Down