Skip to content

Commit

Permalink
tweak(natives): use shorthand name for codeblocks throughout the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
AvarianKnight committed Aug 26, 2024
1 parent ba89303 commit 0a7ba93
Show file tree
Hide file tree
Showing 22 changed files with 67 additions and 70 deletions.
4 changes: 2 additions & 2 deletions CAM/IsScriptGlobalShaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ print(IsScriptGlobalShaking())
// Print whether a global camera shake is currently active
console.log(IsScriptGlobalShaking());
```
```csharp
```cs
using static CitizenFX.Core.Native.API;

// Print whether a global camera shake is currently active
Debug.WriteLine(IsScriptGlobalShaking());
```
```
4 changes: 2 additions & 2 deletions CAM/StopScriptGlobalShaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ if (IsScriptGlobalShaking()) {
StopScriptGlobalShaking(false);
}
```
```csharp
```cs
using static CitizenFX.Core.Native.API;

// Stops the currently active global camera shake with a gradual fade out
if (IsScriptGlobalShaking())
{
StopScriptGlobalShaking(false);
}
```
```
2 changes: 1 addition & 1 deletion ENTITY/SetEntityAlpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SetEntityAlpha(PlayerPedId(), 51, false)
SetEntityAlpha(PlayerPedId(), 51, false);
```

```csharp
```cs
using static CitizenFX.Core.Native.API;
// ...
Expand Down
2 changes: 0 additions & 2 deletions HUD/EndTextCommandDisplayHelp.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ AddTextEntry('HelpMsg', 'Press ~INPUT_CONTEXT~ to do something.')
BeginTextCommandDisplayHelp('HelpMsg')
EndTextCommandDisplayHelp(0, false, true, -1)
-- Shows a floating help text which uses FLOATING_HELP_TEXT_1 hud component.
AddTextEntry('FloatingHelpText', 'Press E to show respect.')
SetFloatingHelpTextWorldPosition(0, vector3(100, 100, 100))
Expand Down
14 changes: 7 additions & 7 deletions HUD/EndTextCommandThefeedPostTicker.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ Example output preview:
![](https://i.imgur.com/TJvqkYq.png)
## Examples
```lua
BeginTextCommandThefeedPost("STRING")
AddTextComponentSubstringPlayerName("Hello " .. GetPlayerName(PlayerId()) .. ".")
EndTextCommandThefeedPostTicker(true, true)
```

## Parameters
* **isImportant**: Makes the notification flash on the screen.
* **bHasTokens**: Makes the notification appear in the "Pause Menu > Info/Brief > Notifications" section.
## Return value
The notification handle.
## Examples
```lua
BeginTextCommandThefeedPost("STRING")
AddTextComponentSubstringPlayerName("Hello " .. GetPlayerName(PlayerId()) .. ".")
EndTextCommandThefeedPostTicker(true, true)
```
11 changes: 5 additions & 6 deletions MISC/ClearAreaOfCops.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ void CLEAR_AREA_OF_COPS(float x, float y, float z, float radius, cs_type(int) BO
Clears an area of cops at the given coordinates and radius.
## Examples
```lua
-- Clear the area, do also create an event
ClearAreaOfCops(0.0, 0.0, 0.0, 10000.0, true)
```

## Parameters
* **x**: The x coordinate of where to clear cops.
* **y**: The y coordinate of where to clear cops.
* **z**: The z coordinate of where to clear cops.
* **radius**: The area radius to clear cops.
* **createNetEvent**: specifies whether a `CClearAreaEvent` event of should be created for online use.
## Examples
```lua
-- Clear the area, do also create an event
ClearAreaOfCops(0.0, 0.0, 0.0, 10000.0, true)
```
2 changes: 1 addition & 1 deletion MISC/GetGroundZAndNormalFor_3dCoord.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if (success) {
}
```

```csharp
```cs
using static CitizenFX.Core.Native.API;

float x = 100.0f, y = -200.0f, z = 50.0f;
Expand Down
2 changes: 1 addition & 1 deletion MISC/GetLinePlaneIntersection.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ if (success) {
}
```

```csharp
```cs
using static CitizenFX.Core.Native.API;

// Define the line segment with start and end points
Expand Down
4 changes: 2 additions & 2 deletions OBJECT/DeleteObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if (IsEntityAMissionEntity(object)) {
DeleteObject(object);
```

```csharp
```cs
using static CitizenFX.Core.Native.API;

int playerPed = PlayerPedId();
Expand All @@ -68,4 +68,4 @@ if (IsEntityAMissionEntity(prop))
}

DeleteObject(ref prop);
```
```
9 changes: 4 additions & 5 deletions PLAYER/SetPlayerCanDoDriveBy.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ Sets whether the player is able to do drive-bys in vehicle (shooting & aiming in
This is a toggle, it does not have to be ran every frame.
Example:
```lua
SetPlayerCanDoDriveBy(PlayerId(), false)
```

## Parameters
* **player**: The player to target.
* **toggle**: If set to false, disables the players ability to do drive bys.
## Example
```lua
SetPlayerCanDoDriveBy(PlayerId(), false)
```
4 changes: 2 additions & 2 deletions STREAMING/GetPlayerSwitchState.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if stateSwitch == 5 then
end
```

```javascript
```js
const stateSwitch = GetPlayerSwitchState();
if (stateSwitch == 5) {
// Player is in the air
Expand All @@ -31,7 +31,7 @@ if (stateSwitch == 5) {
}
```

```csharp
```cs
using static CitizenFX.Core.Native.API;

int stateSwitch = GetPlayerSwitchState();
Expand Down
2 changes: 1 addition & 1 deletion STREAMING/SwitchToMultiFirstpart.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if (!IsPlayerSwitchInProgress()) {
}
```

```csharp
```cs
using static CitizenFX.Core.Native.API;

// Check if the player is in a Switch "state"
Expand Down
6 changes: 3 additions & 3 deletions STREAMING/SwitchToMultiSecondpart.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RegisterCommand("switchPlayer", function()
end, false)
```

```javascript
```js
RegisterCommand("switchPlayer", () => {
if (IsPlayerSwitchInProgress()) return;
const ped = PlayerPedId();
Expand All @@ -35,7 +35,7 @@ RegisterCommand("switchPlayer", () => {
}, false);
```

```csharp
```cs
using static CitizenFX.Core.Native.API;
RegisterCommand("switchPlayer", new Action<int, List<object>, string>(async (user, args, raw) =>
{
Expand All @@ -45,4 +45,4 @@ RegisterCommand("switchPlayer", new Action<int, List<object>, string>(async (use
await Delay(5000);
SwitchToMultiSecondPart(ped);
}), false);
```
```
6 changes: 3 additions & 3 deletions VEHICLE/FullyChargeNitrous.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SetOverrideNitrousLevel(vehicle, true, 1.5, 2.0, 0.5, false)
FullyChargeNitrous(vehicle)
```

```javascript
```js
// Retrieve the player ped
const playerPed = PlayerPedId();

Expand All @@ -53,7 +53,7 @@ SetOverrideNitrousLevel(vehicle, true, 1.5, 2.0, 0.5, false);
FullyChargeNitrous(vehicle);
```

```csharp
```cs
using static CitizenFX.Core.Native.API;

// Retrieve the player ped
Expand All @@ -70,4 +70,4 @@ SetOverrideNitrousLevel(vehicle, true, 1.5, 2.0, 0.5, false);

// After setting the modifiers, fully recharge the nitrous system to the new max defined.
FullyChargeNitrous(vehicle);
```
```
4 changes: 2 additions & 2 deletions VEHICLE/GetRemainingNitrousDuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ CreateThread(function()
end)
```

```javascript
```js
setTick(async () => {
// Retrieve the player ped.
let playerPed = PlayerPedId();
Expand All @@ -53,4 +53,4 @@ setTick(async () => {
console.log(GetRemainingNitrousDuration(vehicle));
}
});
```
```
29 changes: 15 additions & 14 deletions VEHICLE/GetVehicleFlightNozzlePosition.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ end
```


```js
let vehicle = GetVehiclePedIsIn(PlayerPedId(), false);

if (GetVehicleFlightNozzlePosition(vehicle) === 0.0) {
console.log("Flying normally!");
}
else if (GetVehicleFlightNozzlePosition(vehicle) === 1.0) {
console.log("Flying in VTOL mode!");
}
else {
console.log("Currently switching hover mode!");
}
```

```cs
int vehicle = GetVehiclePedIsIn(PlayerPedId(), false);

Expand All @@ -45,17 +60,3 @@ else
Debug.WriteLine("Currently switching hover mode!");
}
```

```js
let vehicle = GetVehiclePedIsIn(PlayerPedId(), false);

if (GetVehicleFlightNozzlePosition(vehicle) === 0.0) {
console.log("Flying normally!");
}
else if (GetVehicleFlightNozzlePosition(vehicle) === 1.0) {
console.log("Flying in VTOL mode!");
}
else {
console.log("Currently switching hover mode!");
}
```
4 changes: 2 additions & 2 deletions VEHICLE/IsNitrousActive.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if vehicle == 0 then return end
print(IsNitrousActive(vehicle))
```

```javascript
```js
// Retrieve the player ped
const playerPed = PlayerPedId();

Expand Down Expand Up @@ -64,4 +64,4 @@ if (vehicle == 0) return;

// Print whether nitrous is active in the vehicle (True or False).
Debug.WriteLine(IsNitrousActive(vehicle));
```
```
4 changes: 2 additions & 2 deletions VEHICLE/SetDisableHeliExplodeFromBodyDamage.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if (helicopter == 0) or (not IsThisModelAHeli(GetEntityModel(helicopter))) then
SetDisableHeliExplodeFromBodyDamage(helicopter, true)
```

```javascript
```js
// Retrieve the player ped.
const playerPed = PlayerPedId();

Expand All @@ -48,7 +48,7 @@ if (helicopter === 0 || !IsThisModelAHeli(GetEntityModel(helicopter))) return;
SetDisableHeliExplodeFromBodyDamage(helicopter, true);
```

```csharp
```cs
using static CitizenFX.Core.Native.API;

// Retrieve the player ped.
Expand Down
6 changes: 3 additions & 3 deletions VEHICLE/SetHeliTailBoomCanBreakOff.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ if heli == 0 or GetVehicleType(heli) ~= "heli" then return end
SetHeliTailBoomCanBreakOff(heli, true)
```

```javascript
```js
const heli = GetVehiclePedIsIn(PlayerPedId(), false);
if (heli === 0 || GetVehicleType(heli) !== "heli") return;

SetHeliTailBoomCanBreakOff(heli, true);
```

```csharp
```cs
using static CitizenFX.Core.Native.API;

int heli = GetVehiclePedIsIn(PlayerPedId(), false);
if (heli == 0 || GetVehicleType(heli) !== "heli") return;

SetHeliTailBoomCanBreakOff(heli, true);
```
```
6 changes: 3 additions & 3 deletions VEHICLE/SetNitrousIsActive.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if vehicle == 0 then return end
SetNitrousIsActive(vehicle, true)
```

```javascript
```js
// Retrieve the player ped
const playerPed = PlayerPedId();

Expand All @@ -49,7 +49,7 @@ if (vehicle == 0) return;
SetNitrousIsActive(vehicle, true);
```

```csharp
```cs
using static CitizenFX.Core.Native.API;

// Retrieve the player ped
Expand All @@ -63,4 +63,4 @@ if (vehicle == 0) return;

// Enable the nitrous system on the vehicle.
SetNitrousIsActive(vehicle, true);
```
```
6 changes: 3 additions & 3 deletions VEHICLE/SetOverrideNitrousLevel.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if vehicle == 0 then return end
SetOverrideNitrousLevel(vehicle, true, 100, 100, 99999999999, false);
```

```javascript
```js
// Retrieve the player ped
const playerPed = PlayerPedId();

Expand All @@ -53,7 +53,7 @@ if (vehicle == 0) return;
SetOverrideNitrousLevel(vehicle, true, 100, 100, 99999999999, false);
```

```csharp
```cs
using static CitizenFX.Core.Native.API;

// Retrieve the player ped
Expand All @@ -67,4 +67,4 @@ if (vehicle == 0) return;

// Configure the vehicle's nitrous system with custom settings for maximum effect.
SetOverrideNitrousLevel(vehicle, true, 100, 100, 99999999999, false);
```
```
Loading

0 comments on commit 0a7ba93

Please sign in to comment.