Theme
Player
The local player, via the engine's own component.
| Export | Summary |
|---|---|
ShGetPlayer | The local player. |
ShEntityVtable | The live entity vtable. |
ShGetPlayerPosition | The soldier's own position, from its matrix. |
ShGetCameraEyePosition | Where the player global says the view sits, about 1.9m behind and 1.6m above the body in third person. |
ShTeleportPlayer | In a vehicle it carries the car and the camera, and that is verified cross map too. |
ShTeleportPlayerHops | delayMs is a real pause per hop. |
ShIsInVehicle | True while riding a vehicle, read from the entity link in the parent chain. |
ShIsSwimming | True while the local player is actively swimming. |
ShSetSuperAccuracy | Pin the player's spread to zero while enabled. |
ShGetSuperAccuracy | See ShSetSuperAccuracy. |
ShSetSuperAccuracyActive | See ShSetSuperAccuracy. |
ShWalkToRoot | Walk an entity's parent chain to its root. |
ShInvalidate | Drop the cached player, so the next call re-resolves. |
ShGetPlayer
c
SH_API int ShGetPlayer(ShPlayer *out);The local player. In a vehicle the root re-parents to the vehicle; the entity stays the soldier.
Never scans and never blocks: if the framework has not resolved the player yet (first spawn after a load, a moment after a vehicle change re-parents it) this answers 0 and the caller tries again next tick. The recovery walk it used to fall into reads every committed page in the process, which is not something a plugin polling at 60Hz should be able to ask for. [api] player_scan=1 in scripthook.ini restores the old behaviour; the framework's own recovery paths still scan.
scripthook.h, line 613
ShEntityVtable
c
SH_API uint64_t ShEntityVtable(void);The live entity vtable. A game update moves it, and a stale value makes every entity test silently answer no - so the framework learns it from the player entity and this is where the rest of the code asks. Before it is known the pinned constant is answered.
scripthook.h, line 619
ShGetPlayerPosition
c
SH_API int ShGetPlayerPosition(ShVec3 *out);The soldier's own position, from its matrix. Use this for anything placed in the world.
scripthook.h, line 622
ShGetCameraEyePosition
c
SH_API int ShGetCameraEyePosition(ShVec3 *out);Where the player global says the view sits, about 1.9m behind and 1.6m above the body in third person.
scripthook.h, line 625
ShTeleportPlayer
c
SH_API int ShTeleportPlayer(const ShVec3 *pos,
const ShVec3 *orient);In a vehicle it carries the car and the camera, and that is verified cross map too.
scripthook.h, line 632
ShTeleportPlayerHops
c
SH_API int ShTeleportPlayerHops(const ShVec3 *pos,
const ShVec3 *orient,
float hopMetres, int delayMs);delayMs is a real pause per hop. 300 is the value proven over long routes, 0 has crashed the game.
scripthook.h, line 641
ShIsInVehicle
c
SH_API int ShIsInVehicle(void);True while riding a vehicle, read from the entity link in the parent chain. Verified both ways.
scripthook.h, line 648
ShIsSwimming
c
SH_API int ShIsSwimming(void);True while the local player is actively swimming. Read from the locomotion component's state byte, held across its brief transitions; see ShGetOccupiedVehicle for the vehicle side.
scripthook.h, line 652
ShSetSuperAccuracy
c
SH_API int ShSetSuperAccuracy(int enabled);Pin the player's spread to zero while enabled. Installs three verified mid-function hooks; 1 once they are in. The Active call pauses the effect without uninstalling, so a mode blacklist can hand the spread back frame by frame.
scripthook.h, line 659
ShGetSuperAccuracy
c
SH_API int ShGetSuperAccuracy(void);Documented together with ShSetSuperAccuracy just above.
scripthook.h, line 660
ShSetSuperAccuracyActive
c
SH_API void ShSetSuperAccuracyActive(int active);Documented together with ShSetSuperAccuracy just above.
scripthook.h, line 661
ShWalkToRoot
c
SH_API int ShWalkToRoot(uint64_t entity, uint64_t *outRoot);Walk an entity's parent chain to its root.
scripthook.h, line 1092
ShInvalidate
c
SH_API void ShInvalidate(void);Drop the cached player, so the next call re-resolves.
scripthook.h, line 1094