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

feat(onesync/natives): add GetVehicleHornType #2697

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

ahcenezdh
Copy link
Contributor

@ahcenezdh ahcenezdh commented Aug 7, 2024

Goal of this PR

Adding a server side getter to the client side native START_VEHICLE_HORN

How is this PR achieving the goal

by reading the HornTypeHash bit in the CVehicleAppearance data node.

This PR applies to the following area(s)

FXServer/FiveM

Successfully tested on

Game builds: 3095

Platforms: Window

Was tested by using StartVehicleHorn client side, then getting the hornType value server side.

-- Client side
RegisterCommand("setHorn", function()
  local veh = GetVehiclePedIsIn(PlayerPedId(), false)
  StartVehicleHorn(veh, 1000000, GetHashKey("HELDDOWN"), false)
end)

-- Server Side
RegisterCommand("hornType", function(source, args)
    local playerPed = GetPlayerPed(source)
    local veh = GetVehiclePedIsIn(playerPed, false)
   if GetVehicleHornType(veh) == GetHashKey("HELDDOWN") then
        print("yes")
   end
end)

To test it, use this snippet, use the setHorn command, then the hornType command

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

@github-actions github-actions bot added the triage Needs a preliminary assessment to determine the urgency and required action label Aug 7, 2024
@FabianTerhorst FabianTerhorst self-requested a review August 15, 2024 16:52
ext/native-decls/GetVehicleHornType.md Outdated Show resolved Hide resolved
ext/native-decls/GetVehicleHornType.md Show resolved Hide resolved
ext/native-decls/GetVehicleHornType.md Outdated Show resolved Hide resolved
@ahcenezdh
Copy link
Contributor Author

Should be good @AvarianKnight, thanks

@github-actions github-actions bot added invalid Requires changes before it's considered valid and can be (re)triaged and removed triage Needs a preliminary assessment to determine the urgency and required action labels Aug 15, 2024
@FabianTerhorst FabianTerhorst self-assigned this Aug 15, 2024
@FabianTerhorst FabianTerhorst added ready-to-merge This PR is enqueued for merging and removed invalid Requires changes before it's considered valid and can be (re)triaged labels Aug 15, 2024
@FabianTerhorst
Copy link
Contributor

Can you update your commit messages? Otherwise we can do that as well.

@github-actions github-actions bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Aug 15, 2024
@ahcenezdh ahcenezdh changed the title feat(server/natives): add GET_VEHICLE_HORN_TYPE feat(onesync/natives): add GetVehicleHornType Aug 15, 2024
@ahcenezdh
Copy link
Contributor Author

Can you update your commit messages? Otherwise we can do that as well.

Should be good

@github-actions github-actions bot added triage Needs a preliminary assessment to determine the urgency and required action and removed invalid Requires changes before it's considered valid and can be (re)triaged labels Aug 15, 2024
@FabianTerhorst
Copy link
Contributor

Can you update your commit messages? Otherwise we can do that as well.

Should be good

Thanks 👍

@FabianTerhorst FabianTerhorst removed the triage Needs a preliminary assessment to determine the urgency and required action label Aug 16, 2024
@github-actions github-actions bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Aug 17, 2024
@FabianTerhorst
Copy link
Contributor

the master branch merge was not required, because there was no conflict. Now you need to get that commit await.

@ahcenezdh
Copy link
Contributor Author

the master branch merge was not required, because there was no conflict. Now you need to get that commit await.

Should be good but looks like the CI didn't succeed to Validate my PR

@FabianTerhorst
Copy link
Contributor

FabianTerhorst commented Aug 17, 2024

The ci isn't happy, because you didnt excluded redm from the code that only works with fivem.

#ifdef STATE_FIVE

around the native handler.

and add

game: gta5

the the native declaration.

@FabianTerhorst FabianTerhorst removed the ready-to-merge This PR is enqueued for merging label Aug 17, 2024
@ahcenezdh
Copy link
Contributor Author

The ci isn't happy, because you didnt excluded redm from the code that only works with fivem.

#ifdef STATE_FIVE

around the native handler.

and add

game: gta5

the the native declaration.

Looking at ServerGame_Scripting only cross native are using the #idef STATE_FIVE

* Implement the server side native GET_VEHICLE_HORN_TYPE by reading the HornTypeHash bit in the CVehicleAppearance datanode.

Co-Authored-By: Dillon Skaggs <[email protected]>
@github-actions github-actions bot added the triage Needs a preliminary assessment to determine the urgency and required action label Aug 18, 2024
@github-actions github-actions bot removed the invalid Requires changes before it's considered valid and can be (re)triaged label Aug 18, 2024
@FabianTerhorst FabianTerhorst added ready-to-merge This PR is enqueued for merging and removed triage Needs a preliminary assessment to determine the urgency and required action labels Aug 18, 2024
@FabianTerhorst
Copy link
Contributor

Looks good now 👍

@prikolium-cfx prikolium-cfx merged commit c0937ff into citizenfx:master Aug 20, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR is enqueued for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants