Skip to content

Commit

Permalink
Merge pull request #856 from DerDevHD/patch-1
Browse files Browse the repository at this point in the history
Extend the documentation for SetFloatingHelpTextStyle
  • Loading branch information
thorium-cfx authored Oct 30, 2023
2 parents 325f44e + f283e64 commit 70003e6
Showing 1 changed file with 58 additions and 7 deletions.
65 changes: 58 additions & 7 deletions HUD/SetFloatingHelpTextStyle.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,65 @@ aliases: ["0x788E7FD431BD67F1"]

```c
// 0x788E7FD431BD67F1 0x97852A82
void SET_FLOATING_HELP_TEXT_STYLE(int hudIndex, int p1, int p2, int p3, int p4, int p5);
void SET_FLOATING_HELP_TEXT_STYLE(int hudIndex, int style, int hudColor, int alpha, int arrowPosition, int boxOffset);
```
### Arrow Positions
* 0 = Off / No arrow
* 1 = Top
* 2 = Left
* 3 = Bottom
* 4 = Right
### Note
Any numeric value greater than 4 will result in a right arrow (Index 4)
### Important
Needs to be called every frame
![Preview of the provided example code](https://forum.cfx.re/uploads/default/original/4X/7/f/3/7f319bc93c3a00b8829bd4ac8dddc235fbf3a9ef.png)
## Parameters
* **hudIndex**:
* **p1**:
* **p2**:
* **p3**:
* **p4**:
* **p5**:
* **hudIndex**: The hud index for the floating help message
* **style**: Value 0 won't show an arrow at all. Values 1, 2 and -2 will display an arrow.
* **hudColor**: https://docs.fivem.net/docs/game-references/hud-colors/
* **alpha**: Value for the help box opacity, from 0-255. Anything greater will simply ignore the alpha value. Always 191 in R* scripts.
* **arrowPosition**: Used to set the arrow positon. No value will hide the arrow
* **boxOffset**: Offset for the floating help box. Note: Arrow stays fixed
## Examples
```lua
function DisplayHelpText(string)
BeginTextCommandDisplayHelp("STRING")
AddTextComponentSubstringPlayerName(string)
EndTextCommandDisplayHelp(1, false, false, 0)
end
CreateThread(function()
while true do
Wait(0)
local Ped = PlayerPedId()
DisplayHelpText('Example Text')
SetFloatingHelpTextStyle(0, 2, 2, 0, 3, 0)
SetFloatingHelpTextToEntity(0, Ped, 0, 0)
end
end)
```

```js
function DisplayHelpText(string) {
BeginTextCommandDisplayHelp("STRING")
AddTextComponentSubstringPlayerName(string)
EndTextCommandDisplayHelp(1, false, false, 0)
}

setTick(() => {
const Ped = PlayerPedId()

DisplayHelpText('Example Text')
SetFloatingHelpTextStyle(0, 2, 2, 0, 3, 0)
SetFloatingHelpTextToEntity(0, Ped, 0, 0)
})
```

0 comments on commit 70003e6

Please sign in to comment.