natives.setStateOfClosestDoorOfType

From GTA Connected
Jump to navigation Jump to search

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0
void natives.setStateOfClosestDoorOfType(int modelHash, Vec3 position, int locked, float state)
The natives.setStateOfClosestDoorOfType function is used to Control the state and lock of the closest door of a given type.

Parameters

1) int modelHash The door model hash (use natives.getHashKey).
2) Vec3 position The position of the door.
3) int locked 0 = door can move, 1 = door locked (cannot move).
4) float state 0.0 = door visually closed, 1.0 = door visually open.

Return

void This function doesn't return a value.

Notes

  • - Must use natives.getHashKey to obtain the door model hash.- `state` controls how the door looks (closed = 0.0, open = 1.0).- `locked` controls whether the door can move (0 free, 1 locked).- Examples: - `state=0.0, locked=0` → door closed, can move - `state=0.0, locked=1` → door closed, locked - `state=1.0, locked=0` → door open, can move - `state=1.0, locked=1` → door open, locked.

Examples

Example 1 - JavaScript:

var hash = natives.getHashKey("cj_int_door_10");
    var pos = new Vec3(892.9844, -501.7633, 19.4067);
    natives.setStateOfClosestDoorOfType(hash, pos, 1, 0.0);

Compatibility

There isn't any compatibility information for this function.