void registerPrompt(int& prompt, const char* input, const char* name, bool toggle, bool addToGroup, Entity entity)
{
prompt = HUD::_UIPROMPT_REGISTER_BEGIN();
HUD::_UIPROMPT_SET_CONTROL_ACTION(prompt, MISC::GET_HASH_KEY(input));
HUD::_UIPROMPT_SET_TEXT(prompt, MISC::VAR_STRING(10, "LITERAL_STRING", name));
HUD::_UIPROMPT_SET_HOLD_MODE(prompt, 1);
if (addToGroup) {
int group = HUD::_UIPROMPT_GET_GROUP_ID_FOR_TARGET_ENTITY(entity);
HUD::_UIPROMPT_SET_GROUP(prompt, group, 0);
}
HUD::_UIPROMPT_REGISTER_END(prompt);
togglePrompt(prompt, toggle);
}
void togglePrompt(int prompt, bool enable)
{
HUD::_UIPROMPT_SET_VISIBLE(prompt, enable);
HUD::_UIPROMPT_SET_ENABLED(prompt, enable);
}
I do it like this, you can use it like:
static int myPrompt{};
registerPrompt(myPrompt, "INPUT_SPRINT", "My Prompts Name", false, true, *example ped*);
Ped target;
PLAYER::GET_PLAYER_INTERACTION_TARGET_ENTITY(PLAYER::PLAYER_ID(), &target, 1, 1);
if (target == *example ped*) // if you're targeting your example ped you reistered the prompt on
togglePromt(myPrompt, true);
else togglePromt(myPrompt, false);
Adding it to a ped or other entity is optional. Depending on what you do there are better ways to do the toggling..
Btw I have a few of my mods source code shared on their pages, you can find stuff like this in them.
edit: I edited the input, it was supposed to be "INPUT_SPRINT"