HUDClient

getCharacterFromAudioConversationFilenameWithByteLimit

GET_CHARACTER_FROM_AUDIO_CONVERSATION_FILENAME_WITH_BYTE_LIMIT0xB2798643312205C5

The GTA V native GET_CHARACTER_FROM_AUDIO_CONVERSATION_FILENAME_WITH_BYTE_LIMIT of the HUD namespace, as LS:MP client scripts call it: the global function getCharacterFromAudioConversationFilenameWithByteLimit, in JavaScript and in Lua.

SignatureJavaScript
getCharacterFromAudioConversationFilenameWithByteLimit(
  text: string,
  position: number,
  length: number,
  maxLength: number
): string
SignatureLua
getCharacterFromAudioConversationFilenameWithByteLimit(
  text: string,
  position: integer,
  length: integer,
  maxLength: integer
): string

Usage

JavaScript
const result = getCharacterFromAudioConversationFilenameWithByteLimit(
  text, position, length, maxLength
);
Lua
local result = getCharacterFromAudioConversationFilenameWithByteLimit(
    text, position, length, maxLength
)

Parameters

ParameterTypeJavaScriptLua
textstringstringstring
positionintnumberinteger
lengthintnumberinteger
maxLengthintnumberinteger

Returns

string JavaScript string, Lua string

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Returns a substring of a specified length starting at a specified position. The result is guaranteed not to exceed the specified max length.

NOTE: The 'maxLength' parameter might actually be the size of the buffer that is returned. More research is needed. -CL69

Example:

// Condensed example of how Rockstar uses this function
strLen = getLengthOfLiteralString(getOnscreenKeyboardResult());
subStr = getCharacterFromAudioConversationFilenameWithByteLimit(getOnscreenKeyboardResult(), 0, strLen, 63);

--

"fm_race_creator.ysc", line 85115:

// parameters modified for clarity
BOOL sub_8e5aa(char *text, int length) {
    for (i = 0; i <= (length - 2); i += 1) {
        if (!areStringsEqual(getCharacterFromAudioConversationFilenameWithByteLimit(text, i, i + 1, 1), " ")) {
            return FALSE;
        }
    }
    return TRUE;
}

Reference

Namespace
HUD HUD
In the game
const char* GET_CHARACTER_FROM_AUDIO_CONVERSATION_FILENAME_WITH_BYTE_LIMIT(const char* text, int position, int length, int maxLength)
Hash
0xB2798643312205C5
Formerly
_GET_TEXT_SUBSTRING_SAFE

Open in the interactive natives reference