Skip to content

Add NPC_GetVehiclePos and NPC_GetVehicleRot natives#1237

Open
Revelts wants to merge 1 commit into
openmultiplayer:masterfrom
Revelts:Revelt/npc-get-vehicle-pos-rot
Open

Add NPC_GetVehiclePos and NPC_GetVehicleRot natives#1237
Revelts wants to merge 1 commit into
openmultiplayer:masterfrom
Revelts:Revelt/npc-get-vehicle-pos-rot

Conversation

@Revelts

@Revelts Revelts commented Jun 28, 2026

Copy link
Copy Markdown

Closes #1197.

Summary

Adds the getter counterparts to NPC_SetVehiclePos / NPC_SetVehicleRot, as requested in #1197.

  • INPC::getVehiclePosition() and INPC::getVehicleRotation() — SDK side (see paired SDK PR add get vehicle position and rotation open.mp-sdk#71)
  • NPC::getVehiclePosition() / NPC::getVehicleRotation() — implementations in Server/Components/NPCs/NPC/npc.cpp
  • NPC_GetVehiclePos(npcid, &Float:x, &Float:y, &Float:z) and NPC_GetVehicleRot(npcid, &Float:x, &Float:y, &Float:z) — PAWN natives in Server/Components/Pawn/Scripting/NPC/Natives.cpp

Both getters return zero/identity when the NPC is not currently in a vehicle, matching the silent no-op semantics of the existing setters.

Depends on

A companion PR to openmultiplayer/omp-stdlib for the .inc declarations of NPC_GetVehiclePos / NPC_GetVehicleRot is still to be opened.

Test plan

  • CI build green (Linux/Windows/macOS) once SDK PR merged and submodule re-pointed
  • In-game: spawn NPC, put in vehicle, confirm NPC_GetVehiclePos and NPC_GetVehicleRot return values matching what was written via the corresponding setters
  • Out of vehicle: confirm both natives return zeroed Vector3

Implements the INPC vehicle position/rotation getters added in SDK
PR openmultiplayer/open.mp-sdk#71 and exposes them to PAWN as
NPC_GetVehiclePos and NPC_GetVehicleRot, mirroring the existing
NPC_SetVehiclePos / NPC_SetVehicleRot setters.

Both getters return zero/identity when the NPC is not currently
in a vehicle, matching the silent no-op semantics of the setters.

Closes openmultiplayer#1197.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Getter counterparts for NPC_SetVehicle(Pos/Rot)

1 participant