Created
August 17, 2018 14:53
-
-
Save codenulls/7f465021f74017d4485ac8bd7acb6dfa 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