Skip to content

Commit

Permalink
tweak: assortment of styling/coding fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AvarianKnight committed Aug 24, 2024
1 parent 331a50c commit a036252
Show file tree
Hide file tree
Showing 17 changed files with 153 additions and 119 deletions.
13 changes: 8 additions & 5 deletions CAM/CreateCamera.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ns: CAM
// 0x5E3CF89C6BCCA67D 0x5D6739AE
Cam CREATE_CAMERA(Hash camHash, BOOL active);
```
Creates a camera with the specified camera hash, You can use `SET_CAM_` natives to manipulate the camera.
Creates a camera with the specified camera hash, You can use `SET_CAM_` natives to manipulate the camera.
Make sure to call [RENDER_SCRIPT_CAMS](#_0x07E5B515DB0636FC) once the camera is created, or this won't have any visible effect.
Take a look at [CREATE_CAM](#_0xC3981DCE61D9E13F) if you would like to see the available camera names.
Expand All @@ -27,21 +27,24 @@ A camera handle referencing the camera that was created.
## Examples
```lua
local cam = CreateCamera(GetHashKey("DEFAULT_SCRIPTED_CAMERA"), true) -- creates a camera with the "DEFAULT_SCRIPTED_CAMERA" type
-- creates a camera with the "DEFAULT_SCRIPTED_CAMERA" type
local cam = CreateCamera(GetHashKey("DEFAULT_SCRIPTED_CAMERA"), true)
RenderScriptCams(true, false, 0, true, true)
```

```js
const cam = CreateCamera(GetHashKey("DEFAULT_SCRIPTED_CAMERA"), true); // creates a camera with the "DEFAULT_SCRIPTED_CAMERA" type
// creates a camera with the "DEFAULT_SCRIPTED_CAMERA" type
const cam = CreateCamera(GetHashKey("DEFAULT_SCRIPTED_CAMERA"), true);

RenderScriptCams(true, false, 0, true, true)
```

```cs
using static CitizenFX.Core.Native.API;
// ...
int cam = CreateCamera(GetHashKey("DEFAULT_SCRIPTED_CAMERA"), true); // creates a camera with the "DEFAULT_SCRIPTED_CAMERA" type

// creates a camera with the "DEFAULT_SCRIPTED_CAMERA" type
int cam = CreateCamera(GetHashKey("DEFAULT_SCRIPTED_CAMERA"), true);

RenderScriptCams(true, false, 0, true, true);
```
20 changes: 13 additions & 7 deletions CAM/HardAttachCamToEntity.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,23 @@ NativeDB Introduced: v2189
-- assuming that the obj variable was created earlier in the script
local cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)
HardAttachCamToEntity(cam, obj, 0.0, 0.0, 90.0, 10.0, 0.0, 0.0, true) -- attaches the camera to the object rotated 90 degrees and offset 10 x values
-- attaches the camera to the object rotated 90 degrees and offset 10 x values
HardAttachCamToEntity(cam, obj, 0.0, 0.0, 90.0, 10.0, 0.0, 0.0, true)
RenderScriptCams(true, false, 0, true, true) -- renders the camera
-- renders the camera
RenderScriptCams(true, false, 0, true, true)
```

```js
// assuming that the obj variable was created earlier in the script
const cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)

HardAttachCamToEntity(cam, obj, 0.0, 0.0, 90.0, 10.0, 0.0, 0.0, true) // attaches the camera to the object rotated 90 degrees and offset 10 x values
// attaches the camera to the object rotated 90 degrees and offset 10 x values
HardAttachCamToEntity(cam, obj, 0.0, 0.0, 90.0, 10.0, 0.0, 0.0, true)

RenderScriptCams(true, false, 0, true, true) // renders the camera
// renders the camera
RenderScriptCams(true, false, 0, true, true)
```

```cs
Expand All @@ -52,7 +56,9 @@ using static CitizenFX.Core.Native.API;
// assuming that the obj variable was created earlier in the script
int cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true);

HardAttachCamToEntity(cam, obj, 0.0f, 0.0f, 90.0f, 10.0f, 0.0f, 0.0f, true); // attaches the camera to the object rotated 90 degrees and offset 10 x values
// attaches the camera to the object rotated 90 degrees and offset 10 x values
HardAttachCamToEntity(cam, obj, 0.0f, 0.0f, 90.0f, 10.0f, 0.0f, 0.0f, true);

RenderScriptCams(true, false, 0, true, true); // renders the camera
```
// renders the camera
RenderScriptCams(true, false, 0, true, true);
```
22 changes: 14 additions & 8 deletions CAM/HardAttachCamToPedBone.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NativeDB Introduced: v1180
## Parameters
* **cam**: The camera handle.
* **ped**: The ped handle.
* **boneIndex**: This is different to boneID, use ['GET_PED_BONE_INDEX'](#_0x3F428D08BE5AAE31) to get the index from the ID. use the index for attaching to specific bones. `cam` will be attached to the center of `ped` if bone index given doesn't correspond to bone indexes for that entity type.
* **boneIndex**: This is different to boneID, use [`GET_PED_BONE_INDEX`](#_0x3F428D08BE5AAE31) to get the index from the ID. use the index for attaching to specific bones. `cam` will be attached to the center of `ped` if bone index given doesn't correspond to bone indexes for that entity type.
* **xRot**: X-axis rotation.
* **yRot**: Y-axis rotation.
* **zRot**: Z-axis rotation.
Expand All @@ -35,9 +35,11 @@ local ped = PlayerPedId()
local cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)
local BONETAG_L_FINGER01 = 4089
HardAttachCamToPedBone(cam, ped, BONETAG_L_FINGER01, 90.0, 0.0, 0.0, 0.0, 0.0, 0.0, true) -- attach it to a finger on the left hand and rotates it 90 degrees on the X-axis
-- attach it to a finger on the left hand and rotates it 90 degrees on the X-axis
HardAttachCamToPedBone(cam, ped, BONETAG_L_FINGER01, 90.0, 0.0, 0.0, 0.0, 0.0, 0.0, true)
RenderScriptCams(true, false, 0, true, true) -- renders the camera
-- renders the camera
RenderScriptCams(true, false, 0, true, true)
```

Expand All @@ -46,9 +48,11 @@ const ped = PlayerPedId()
const cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)
const BONETAG_L_FINGER01= 4089

HardAttachCamToPedBone(cam, ped, BONETAG_L_FINGER01, 90.0, 0.0, 0.0, 0.0, 0.0, 0.0, true) // attach it to a finger on the left hand and rotates it 90 degrees on the X-axis
// attach it to a finger on the left hand and rotates it 90 degrees on the X-axis
HardAttachCamToPedBone(cam, ped, BONETAG_L_FINGER01, 90.0, 0.0, 0.0, 0.0, 0.0, 0.0, true)

RenderScriptCams(true, false, 0, true, true) // renders the camera
// renders the camera
RenderScriptCams(true, false, 0, true, true)
```

```cs
Expand All @@ -58,7 +62,9 @@ int ped = PlayerPedId();
int cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true);
int BONETAG_L_FINGER01 = 4089;

HardAttachCamToPedBone(cam, ped, BONETAG_L_FINGER01, 90.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, true); // attach it to a finger on the left hand and rotates it 90 degrees on the X-axis
// attach it to a finger on the left hand and rotates it 90 degrees on the X-axis
HardAttachCamToPedBone(cam, ped, BONETAG_L_FINGER01, 90.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, true);

RenderScriptCams(true, false, 0, true, true); // renders the camera
```
// renders the camera
RenderScriptCams(true, false, 0, true, true);
```
47 changes: 27 additions & 20 deletions FILES/GetTattooShopDlcItemData.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,22 @@ Returned struct properties:
```c
struct sTattooShopItemValues
{
int LockHash; // Lock hash, used with IS_CONTENT_ITEM_LOCKED
int Index; // Unique ID of this slot. It can also be 0.
int CollectionHash; // Collection hash of this tattoo
int PresetHash; // Preset hash of this tattoo
int Cost; // Cost of this tattoo in shops.
int eFacing; // Secondary placement of this tattoo.
int UpdateGroup; // Location of this tattoo on the body (for example, for torso there would be chest upper, stomach, etc)
const char* NameTextLabel; // This tattoo's name in the form of a text label.
// Lock hash, used with IS_CONTENT_ITEM_LOCKED
int LockHash;
// Unique ID of this slot. It can also be 0.
int Index;
// Collection hash of this tattoo
int CollectionHash;
// Preset hash of this tattoo
int PresetHash;
// Cost of this tattoo in shops.
int Cost;
// Secondary placement of this tattoo.
int eFacing;
// Location of this tattoo on the body (for example, for torso there would be chest upper, stomach, etc)
int UpdateGroup;
// This tattoo's name in the form of a text label.
const char* NameTextLabel;
};
```

Expand All @@ -48,17 +56,6 @@ struct sTattooShopItemValues
A bool indicating that the tattoo data exists in the files.

## Examples
```js
var characterType = 4; // MPFemale.
var tattooIndex = 0; // Value between 0 and GetNumDecorations(characterType).

var structArray = new Uint32Array(new ArrayBuffer(10 * 8));

if (Citizen.invokeNative("0xFF56381874F82086", characterType, tattooIndex, structArray))
{
Console.Log(JSON.stringify(structArray));
}
```
```lua
local function TattooBlobToTable(blob)
local LockHash = string.unpack('<i4', blob, 1) & 0xFFFFFFFF -- uint (hash)
Expand All @@ -85,7 +82,7 @@ end
function GetTattooDlcItemDataTable(CharacterType, DecorationIndex)
local blob = string.rep('\0\0\0\0\0\0\0\0', 7+16)
if not Citizen.InvokeNative(0xFF56381874F82086, CharacterType, DecorationIndex, blob) then return nil end -- Data doesn't exist, return a nil

return TattooBlobToTable(blob) -- Return the data table
end

Expand All @@ -94,5 +91,15 @@ for i = 0, numberOfTattoos - 1 do
local tattooData = GetTattooDlcItemDataTable(3, i)
-- Do stuff with your tattoo data
end
```
```js
const characterType = 4; // MPFemale.
const tattooIndex = 0; // Value between 0 and GetNumDecorations(characterType).

const structArray = new Uint32Array(new ArrayBuffer(10 * 8));

if (Citizen.invokeNative("0xFF56381874F82086", characterType, tattooIndex, structArray))
{
console.Log(JSON.stringify(structArray));
}
```
9 changes: 5 additions & 4 deletions HUD/N_0xf83d0febe75e62c9.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ radians = degrees * pi / 180
* **blip**: A blip from an entity. The entity can not be a ped. The width and length will not change if it is a ped.
* **p1**: -1.0 in decompiled scripts (unk)
* **p2**: 1.0 in decompiled scripts (unk)
* **width**: Width of the cone (0.0 to ~3.0)
* **width**: Width of the cone (0.0 to ~3.0)
* **p4**: 1.0 in decompiled scripts (unk)
* **length**: Length of the cone. (8.2 is 'normal' sized)
* **heading**: This heading is in radians, this can be calculated with (heading + 180.00) * (pi/180)
Expand All @@ -39,8 +39,9 @@ radians = degrees * pi / 180
## Examples
```lua
blip = AddBlipForEntity(--[[entity]])
-- ...
Citizen.InvokeNative(0xf83d0febe75e62c9, blip, -1.0, 1.0, 0.36, 1.0, 8.2, (0.5 * math.pi), 0, 11)
local ped = PlayerPedId()
local blip = AddBlipForEntity(ped)
Citizen.InvokeNative(0xF83D0FEBE75E62C9, blip, -1.0, 1.0, 0.36, 1.0, 8.2, (0.5 * math.pi), 0, 11)
SetBlipShowCone(blip, true, 11)
```
40 changes: 12 additions & 28 deletions HUD/SetMouseCursorStyle.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,21 @@ Changes the mouse style.
```c
enum eMousePointerStyle {
MOUSE_CURSOR_STYLE_ARROW = 1,
MOUSE_CURSOR_STYLE_ARROW_DIMMED,
MOUSE_CURSOR_STYLE_HAND_OPEN,
MOUSE_CURSOR_STYLE_HAND_GRAB,
MOUSE_CURSOR_STYLE_HAND_MIDDLE_FINGER,
MOUSE_CURSOR_STYLE_ARROW_LEFT,
MOUSE_CURSOR_STYLE_ARROW_RIGHT,
MOUSE_CURSOR_STYLE_ARROW_UP,
MOUSE_CURSOR_STYLE_ARROW_DOWN,
MOUSE_CURSOR_STYLE_ARROW_TRIMMING,
MOUSE_CURSOR_STYLE_ARROW_PLUS,
MOUSE_CURSOR_STYLE_ARROW_MINUS
ARROW = 1,
ARROW_DIMMED = 2,
HAND_OPEN = 3,
HAND_GRAB = 4,
HAND_MIDDLE_FINGER = 5,
ARROW_LEFT = 6,
ARROW_RIGHT = 7,
ARROW_UP = 8,
ARROW_DOWN = 9,
ARROW_TRIMMING = 10,
ARROW_PLUS = 11,
ARROW_MINUS = 12
};
```

Available styles are:
| ID | Description |
| :-: | :-----------------: |
| 1 | Arrow |
| 2 | Arrow (Dimmed) |
| 3 | Open Hand |
| 4 | Hand Grab |
| 5 | Click/Middle Finger |
| 6 | Left Arrow |
| 7 | Right Arrow |
| 8 | Up Arrow |
| 9 | Down Arrow |
| 10 | Arrow Trimming |
| 11 | Arrow Plus |
| 12 | Arrow Minus |

## Parameters
* **style**: Which sprite to change to, see declared enum `eMousePointerStyle`.

10 changes: 5 additions & 5 deletions MISC/DisplayOnscreenKeyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void DISPLAY_ONSCREEN_KEYBOARD(int keyboardType, char* windowTitle, char* descri
Displays a text input box.
```
```c
enum eKeyboardType
{
ONSCREEN_KEYBOARD_ENGLISH = 0,
Expand All @@ -26,11 +26,11 @@ enum eKeyboardType
## Parameters
* **keyboardType**: See the list above. Default is `0`.
* **windowTitle**: Text label for the title of the box.
* **description**: Has no use on PC.
* **description**: Has no use on PC.
* **defaultText**: Default text that is written in the input field.
* **defaultConcat1**:
* **defaultConcat2**:
* **defaultConcat3**:
* **defaultConcat1**:
* **defaultConcat2**:
* **defaultConcat3**:
* **maxInputLength**: Max number of characters that can be typed (2 - 256).


Expand Down
4 changes: 1 addition & 3 deletions MISC/NextOnscreenKeyboardResultWillDisplayUsingTheseFonts.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ aliases: ["0x3ED1438C1F5C6612"]
void NEXT_ONSCREEN_KEYBOARD_RESULT_WILL_DISPLAY_USING_THESE_FONTS(int fontBitField);
```
```
```c
enum eFontBitField
{
FONT_BIT_STANDARD = 1,
Expand All @@ -25,5 +25,3 @@ enum eFontBitField

## Parameters
* **fontBitField**: See the list above.
9 changes: 5 additions & 4 deletions NETWORK/NetworkConcealPlayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ To manage player visibility with NetworkConcealPlayer, here’s a solid approach
This setup keeps instance players separate from each other while allowing interaction with the general population.
## Parameters
* **player**:
* **toggle**:
* **bAllowDamagingWhileConcealed**:
* **player**:
* **toggle**:
* **bAllowDamagingWhileConcealed**:
## Examples
```lua
function GetPlayerInstance(player)
-- you can replace this with your own data
Expand All @@ -43,7 +44,7 @@ function concealPlayers()
for _, player in ipairs(allPlayers) do
if player == playerId then goto continue end
local playerInstance = GetPlayerInstance(player)
local playerInstance = GetPlayerInstance(player)
if playerInstance == localPlayerInstance then
-- if we're in the same instance then we want to be able to see them
Expand Down
Loading

0 comments on commit a036252

Please sign in to comment.