-
-
Save AndnixSH/13cb190c661be1218da32475574dec57 to your computer and use it in GitHub Desktop.
A simple GTA:SA ASI mod to restore health of local player by pressing the R key on keyboard.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "plugin.h" | |
#include "common.h" | |
#include "CHud.h" | |
#include "CTimer.h" | |
using namespace plugin; | |
class RestoreHealthGTASA { | |
public: | |
RestoreHealthGTASA() { | |
// Initialise your plugin here | |
Events::gameProcessEvent += [] | |
{ | |
CPlayerPed* pLocalPlayer = FindPlayerPed(); | |
if (pLocalPlayer) | |
{ | |
static unsigned int lastKeyPressedTime = 0; | |
if (KeyPressed('R') && ( CTimer::m_snTimeInMilliseconds - lastKeyPressedTime > 500)) | |
{ | |
lastKeyPressedTime = CTimer::m_snTimeInMilliseconds; | |
pLocalPlayer->m_fHealth = pLocalPlayer->m_fMaxHealth; | |
CHud::SetHelpMessage("Restored Player Health!", true, false, false); | |
} | |
} | |
}; | |
} | |
} restoreHealthGTASA; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment