2021-10-24 18:08:00 -04:00
|
|
|
#include "pch.h"
|
2021-10-25 10:03:27 -04:00
|
|
|
#include "weapon.h"
|
2021-09-20 08:41:40 -04:00
|
|
|
#include "ui.h"
|
|
|
|
#include "util.h"
|
2021-10-25 10:03:27 -04:00
|
|
|
#include "CWeaponInfo.h"
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2022-02-21 03:33:57 -05:00
|
|
|
void Weapon::Init()
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
Events::processScriptsEvent += []
|
|
|
|
{
|
|
|
|
CPlayerPed* player = FindPlayerPed();
|
2021-08-14 20:36:11 -04:00
|
|
|
|
|
|
|
#ifdef GTASA
|
2022-01-07 03:18:00 -05:00
|
|
|
if (m_bAutoAim)
|
|
|
|
{
|
2022-05-08 01:36:36 -04:00
|
|
|
if (CPad::NewMouseControllerState.x == 0 && CPad::NewMouseControllerState.y == 0)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
if (KeyPressed(2))
|
|
|
|
{
|
|
|
|
CCamera::m_bUseMouse3rdPerson = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CCamera::m_bUseMouse3rdPerson = true;
|
|
|
|
}
|
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
|
2022-05-16 14:42:00 -04:00
|
|
|
uchar slot = player->m_nActiveWeaponSlot;
|
2022-01-07 03:18:00 -05:00
|
|
|
if (m_nCurrentWeaponSlot != slot)
|
|
|
|
{
|
|
|
|
eWeaponType weaponType = player->m_aWeapons[slot].m_eWeaponType;
|
2021-10-24 04:15:06 -04:00
|
|
|
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-01-07 03:18:00 -05:00
|
|
|
CWeaponInfo* pWeaponInfo = CWeaponInfo::GetWeaponInfo(weaponType, player->GetWeaponSkill(weaponType));
|
|
|
|
#else
|
|
|
|
CWeaponInfo* pWeaponInfo = CWeaponInfo::GetWeaponInfo(weaponType);
|
|
|
|
|
|
|
|
if(m_bInfiniteAmmo)
|
|
|
|
{
|
|
|
|
Command<Commands::SET_PLAYER_AMMO>(0, weaponType, 999999);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (m_bHugeDamage)
|
|
|
|
{
|
|
|
|
pWeaponInfo->m_nDamage = 1000;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_bLongRange)
|
|
|
|
{
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-01-07 03:18:00 -05:00
|
|
|
pWeaponInfo->m_fTargetRange = 1000.0f;
|
|
|
|
pWeaponInfo->m_fWeaponRange = 1000.0f;
|
|
|
|
pWeaponInfo->m_fAccuracy = 1.0f;
|
|
|
|
pWeaponInfo->m_nFlags.bReload2Start = true;
|
|
|
|
#else
|
|
|
|
pWeaponInfo->m_fRange = 1000.0f;
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef GTASA
|
|
|
|
if (m_bRapidFire && weaponType != WEAPON_FTHROWER && weaponType != WEAPON_MINIGUN) // mingun & flamethrower doesn't work with rapidfire
|
|
|
|
{
|
|
|
|
pWeaponInfo->m_nFlags.bContinuosFire = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_bDualWeild && (weaponType == WEAPON_PISTOL || weaponType == WEAPON_MICRO_UZI || weaponType ==
|
|
|
|
WEAPON_TEC9 || weaponType == WEAPON_SAWNOFF))
|
|
|
|
{
|
|
|
|
pWeaponInfo->m_nFlags.bTwinPistol = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_bMoveAim)
|
|
|
|
{
|
|
|
|
pWeaponInfo->m_nFlags.bMoveAim = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_bMoveFire)
|
|
|
|
{
|
|
|
|
pWeaponInfo->m_nFlags.bMoveFire = true;
|
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
m_nCurrentWeaponSlot = slot;
|
|
|
|
}
|
|
|
|
};
|
2020-12-02 16:19:16 -05:00
|
|
|
}
|
|
|
|
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2021-10-25 10:03:27 -04:00
|
|
|
void Weapon::SetGangWeapon(std::string& weapon_type)
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
m_nGangWeaponList[m_nSelectedGang][m_nSelectedWeapon] = std::stoi(weapon_type);
|
|
|
|
CGangs::SetGangWeapons(m_nSelectedGang, m_nGangWeaponList[m_nSelectedGang][0], m_nGangWeaponList[m_nSelectedGang][1],
|
|
|
|
m_nGangWeaponList[m_nSelectedGang][2]);
|
2020-12-02 16:19:16 -05:00
|
|
|
}
|
2022-01-07 03:18:00 -05:00
|
|
|
#else
|
2021-08-14 20:36:11 -04:00
|
|
|
// Implementation of SA opcode 0x555
|
|
|
|
static void ClearPlayerWeapon(eWeaponType weaponType)
|
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
CPlayerPed *pPlayer = FindPlayerPed();
|
2021-08-14 20:36:11 -04:00
|
|
|
|
2021-10-24 04:15:06 -04:00
|
|
|
#ifdef GTA3
|
2022-01-07 03:18:00 -05:00
|
|
|
int weaponSlot = pPlayer->GetWeaponSlot(weaponType);
|
2021-10-24 04:15:06 -04:00
|
|
|
#else
|
2022-01-07 03:18:00 -05:00
|
|
|
int weaponSlot = CWeaponInfo::GetWeaponInfo(weaponType)->m_WeaponSlot;
|
2021-10-24 04:15:06 -04:00
|
|
|
#endif
|
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
if ( weaponSlot != -1 )
|
|
|
|
{
|
|
|
|
CWeapon *pWeapon = &pPlayer->m_aWeapons[weaponSlot];
|
2021-10-24 04:15:06 -04:00
|
|
|
|
2022-05-08 01:36:36 -04:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
if (pWeapon->m_eWeaponType == weaponType)
|
|
|
|
{
|
|
|
|
if (pPlayer->m_nCurrentWeapon == weaponSlot)
|
|
|
|
{
|
2022-05-08 01:36:36 -04:00
|
|
|
#ifdef GTA3
|
2022-01-07 03:18:00 -05:00
|
|
|
Command<Commands::SET_CURRENT_PLAYER_WEAPON>(0, WEAPONTYPE_UNARMED);
|
2021-10-24 04:15:06 -04:00
|
|
|
#else
|
2022-01-07 03:18:00 -05:00
|
|
|
CWeaponInfo *pWeaponInfo = CWeaponInfo::GetWeaponInfo(WEAPONTYPE_UNARMED);
|
|
|
|
pPlayer->SetCurrentWeapon(pWeaponInfo->m_WeaponSlot);
|
2022-05-08 01:36:36 -04:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2022-05-08 01:36:36 -04:00
|
|
|
#ifdef GTA3
|
|
|
|
// This doesn't work for melee weapons aka bats, chainsaw etc
|
|
|
|
pWeapon->m_eWeaponState = WEAPONSTATE_OUT_OF_AMMO;
|
|
|
|
pWeapon->m_nAmmoTotal = 0;
|
|
|
|
pWeapon->m_nAmmoInClip = 0;
|
|
|
|
#else
|
|
|
|
pWeapon->Shutdown();
|
2021-10-24 04:15:06 -04:00
|
|
|
#endif
|
2022-05-08 01:36:36 -04:00
|
|
|
}
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
}
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2021-08-14 20:36:11 -04:00
|
|
|
// Implementation of opcode 0x605 (CLEO)
|
|
|
|
static eWeaponType GetWeaponTypeFromModel(int model)
|
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
eWeaponType weaponType = WEAPONTYPE_UNARMED;
|
2021-08-14 20:36:11 -04:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
for (size_t i = 0; i < 37; i++)
|
|
|
|
{
|
2021-08-14 20:36:11 -04:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
int temp = CallAndReturn<int, BY_GAME(NULL, 0x4418B0, 0x430690)>(i); // int __cdecl CPickups::ModelForWeapon(int a1)
|
2021-08-14 20:36:11 -04:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
if (temp == model)
|
|
|
|
{
|
|
|
|
weaponType = (eWeaponType)i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return weaponType;
|
2021-08-14 20:36:11 -04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GTASA
|
2021-10-25 10:03:27 -04:00
|
|
|
void Weapon::GiveWeaponToPlayer(std::string& weapon_type)
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
CPlayerPed* player = FindPlayerPed();
|
|
|
|
int hplayer = CPools::GetPedRef(player);
|
|
|
|
|
|
|
|
if (weapon_type == "-1") // Jetpack
|
|
|
|
{
|
|
|
|
Command<Commands::TASK_JETPACK>(hplayer);
|
|
|
|
}
|
|
|
|
else if (weapon_type == "-2") // CellPhone
|
|
|
|
{
|
|
|
|
CStreaming::RequestModel(330, PRIORITY_REQUEST);
|
|
|
|
CStreaming::LoadAllRequestedModels(false);
|
|
|
|
player->ClearWeaponTarget();
|
|
|
|
player->SetCurrentWeapon(WEAPON_UNARMED);
|
|
|
|
player->AddWeaponModel(330);
|
|
|
|
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(330);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int iweapon_type = std::stoi(weapon_type);
|
|
|
|
|
|
|
|
int model = NULL;
|
|
|
|
Command<Commands::GET_WEAPONTYPE_MODEL>(iweapon_type, &model);
|
|
|
|
|
|
|
|
CStreaming::RequestModel(model, PRIORITY_REQUEST);
|
|
|
|
|
|
|
|
if (model == 363) // remote bomb
|
|
|
|
{
|
|
|
|
CStreaming::RequestModel(364, PRIORITY_REQUEST); // detonator
|
|
|
|
}
|
|
|
|
|
|
|
|
CStreaming::LoadAllRequestedModels(false);
|
|
|
|
Command<Commands::GIVE_WEAPON_TO_CHAR>(hplayer, iweapon_type, m_nAmmoCount);
|
|
|
|
|
|
|
|
if (model == 363) // remote bomb
|
|
|
|
{
|
|
|
|
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(364); // detonator
|
|
|
|
}
|
|
|
|
|
|
|
|
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(model);
|
|
|
|
}
|
2020-12-02 16:19:16 -05:00
|
|
|
}
|
2022-01-07 03:18:00 -05:00
|
|
|
#else
|
2021-10-25 10:03:27 -04:00
|
|
|
void Weapon::GiveWeaponToPlayer(std::string& rootkey, std::string& name, std::string& model)
|
2021-08-14 20:36:11 -04:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
CPlayerPed* player = FindPlayerPed();
|
|
|
|
int hplayer = CPools::GetPedRef(player);
|
|
|
|
int iModel = std::stoi(model);
|
|
|
|
CStreaming::RequestModel(iModel, PRIORITY_REQUEST);
|
|
|
|
CStreaming::LoadAllRequestedModels(false);
|
|
|
|
|
|
|
|
eWeaponType weaponType = GetWeaponTypeFromModel(iModel);
|
|
|
|
Command<Commands::GIVE_WEAPON_TO_CHAR>(hplayer, weaponType, m_nAmmoCount);
|
|
|
|
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(iModel);
|
2021-10-24 04:15:06 -04:00
|
|
|
#ifdef GTA3
|
2022-01-07 03:18:00 -05:00
|
|
|
Command<Commands::SET_CURRENT_PLAYER_WEAPON>(0, weaponType);
|
2021-10-24 04:15:06 -04:00
|
|
|
#endif
|
2021-08-14 20:36:11 -04:00
|
|
|
}
|
|
|
|
#endif
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2022-01-20 02:04:45 -05:00
|
|
|
void Weapon::ShowPage()
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
CPlayerPed* pPlayer = FindPlayerPed();
|
|
|
|
uint hplayer = CPools::GetPedRef(pPlayer);
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::Spacing();
|
2022-02-22 02:44:33 -05:00
|
|
|
if (ImGui::Button(TEXT("Weapon.DropWeapon"), Ui::GetSize(3)))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
float x, y, z;
|
|
|
|
Command<Commands::GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS>(hplayer, 0.0, 3.0, 0.0, &x, &y, &z);
|
2021-10-24 04:15:06 -04:00
|
|
|
|
2022-05-16 14:42:00 -04:00
|
|
|
eWeaponType weaponType = pPlayer->m_aWeapons[pPlayer->m_nActiveWeaponSlot].m_eWeaponType;
|
2022-01-07 03:18:00 -05:00
|
|
|
if (weaponType)
|
|
|
|
{
|
|
|
|
int model = 0, pickup = 0;
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-01-07 03:18:00 -05:00
|
|
|
Command<Commands::GET_WEAPONTYPE_MODEL>(weaponType, &model);
|
|
|
|
#else
|
|
|
|
model = CallAndReturn<int, BY_GAME(NULL, 0x4418B0, 0x430690)>(weaponType); // int __cdecl CPickups::ModelForWeapon(int a1)
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
Command<Commands::CREATE_PICKUP_WITH_AMMO>(model, 3, 999, x, y, z, &pickup);
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-01-07 03:18:00 -05:00
|
|
|
Command<Commands::REMOVE_WEAPON_FROM_CHAR>(hplayer, weaponType);
|
|
|
|
#else
|
|
|
|
ClearPlayerWeapon(weaponType);
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
2022-02-22 02:44:33 -05:00
|
|
|
if (ImGui::Button(TEXT("Weapon.DropAll"), Ui::GetSize(3)))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
pPlayer->ClearWeapons();
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
2022-02-22 02:44:33 -05:00
|
|
|
if (ImGui::Button(TEXT("Weapon.DropCurrent"), Ui::GetSize(3)))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-05-16 14:42:00 -04:00
|
|
|
Command<Commands::REMOVE_WEAPON_FROM_CHAR>(hplayer, pPlayer->m_aWeapons[pPlayer->m_nActiveWeaponSlot].m_eWeaponType);
|
2022-01-07 03:18:00 -05:00
|
|
|
#else
|
|
|
|
ClearPlayerWeapon(pPlayer->m_aWeapons[pPlayer->m_nCurrentWeapon].m_eWeaponType);
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
ImGui::Spacing();
|
|
|
|
|
|
|
|
if (ImGui::BeginTabBar("Ped", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
|
|
|
{
|
2022-02-22 02:44:33 -05:00
|
|
|
if (ImGui::BeginTabItem(TEXT("Window.CheckboxTab")))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
ImGui::Spacing();
|
|
|
|
ImGui::BeginChild("CheckboxesChild");
|
|
|
|
ImGui::Spacing();
|
|
|
|
ImGui::SameLine();
|
2022-02-22 02:44:33 -05:00
|
|
|
ImGui::Text(TEXT("Window.Info"));
|
|
|
|
Ui::ShowTooltip(TEXT("Weapon.WeaponTweaksText"));
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::Columns(2, 0, false);
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-02-22 02:44:33 -05:00
|
|
|
Ui::CheckboxWithHint(TEXT("Weapon.FastAim"), &m_bAutoAim, TEXT("Weapon.FastAimText"));
|
|
|
|
if (Ui::CheckboxWithHint(TEXT("Weapon.DualWeild"), &m_bDualWeild,TEXT("Weapon.DualWeildText")))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
if (!m_bDualWeild)
|
|
|
|
{
|
|
|
|
CWeaponInfo::LoadWeaponData();
|
|
|
|
}
|
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2022-02-22 02:44:33 -05:00
|
|
|
if (Ui::CheckboxWithHint(TEXT("Weapon.HugeDamage"), &m_bHugeDamage, TEXT("Weapon.HugeDamageText")))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
if (!m_bHugeDamage)
|
|
|
|
{
|
|
|
|
CWeaponInfo::LoadWeaponData();
|
|
|
|
}
|
|
|
|
}
|
2022-02-22 02:44:33 -05:00
|
|
|
if (Ui::CheckboxWithHint(TEXT("Weapon.FastReload"), &m_bFastReload))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
Command<Commands::SET_PLAYER_FAST_RELOAD>(hplayer, m_bFastReload);
|
|
|
|
}
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-02-22 02:44:33 -05:00
|
|
|
Ui::CheckboxAddress(TEXT("Weapon.InfiniteAmmo"), 0x969178);
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::NextColumn();
|
2021-10-24 04:15:06 -04:00
|
|
|
#else
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::NextColumn();
|
2022-02-22 02:44:33 -05:00
|
|
|
Ui::CheckboxWithHint(TEXT("Weapon.InfiniteAmmo"), &m_bInfiniteAmmo);
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2022-02-22 02:44:33 -05:00
|
|
|
if (Ui::CheckboxWithHint(TEXT("Weapon.LongRange"), &m_bLongRange))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
if (!m_bLongRange)
|
|
|
|
{
|
|
|
|
CWeaponInfo::LoadWeaponData();
|
|
|
|
}
|
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-02-22 02:44:33 -05:00
|
|
|
if (Ui::CheckboxWithHint(TEXT("Weapon.MoveWhenAiming"), &m_bMoveAim))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
if (!m_bMoveAim)
|
|
|
|
{
|
|
|
|
CWeaponInfo::LoadWeaponData();
|
|
|
|
}
|
|
|
|
}
|
2022-02-22 02:44:33 -05:00
|
|
|
if (Ui::CheckboxWithHint(TEXT("Weapon.MoveWhenFiring"), &m_bMoveFire))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
if (!m_bMoveFire)
|
|
|
|
{
|
|
|
|
CWeaponInfo::LoadWeaponData();
|
|
|
|
}
|
|
|
|
}
|
2022-02-22 02:44:33 -05:00
|
|
|
if (Ui::CheckboxWithHint(TEXT("Weapon.RapidFire"), &m_bRapidFire))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
if (!m_bRapidFire)
|
|
|
|
{
|
|
|
|
CWeaponInfo::LoadWeaponData();
|
|
|
|
}
|
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::Columns(1, 0, false);
|
|
|
|
ImGui::EndChild();
|
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
2022-02-22 02:44:33 -05:00
|
|
|
if (ImGui::BeginTabItem(TEXT("Window.SpawnTab")))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
ImGui::Spacing();
|
2022-02-22 02:44:33 -05:00
|
|
|
if (ImGui::InputInt(TEXT("Weapon.Ammo"), &m_nAmmoCount))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
m_nAmmoCount = (m_nAmmoCount < 0) ? 0 : m_nAmmoCount;
|
|
|
|
m_nAmmoCount = (m_nAmmoCount > 99999) ? 99999 : m_nAmmoCount;
|
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-01-07 03:18:00 -05:00
|
|
|
Ui::DrawImages(m_WeaponData, GiveWeaponToPlayer, nullptr,
|
|
|
|
[](std::string str)
|
|
|
|
{
|
|
|
|
return m_WeaponData.m_pJson->m_Data[str].get<std::string>();
|
|
|
|
},
|
|
|
|
[](std::string str)
|
|
|
|
{
|
|
|
|
return str != "0"; /*Unarmed*/
|
|
|
|
}
|
|
|
|
);
|
|
|
|
#else
|
|
|
|
Ui::DrawJSON(m_WeaponData, GiveWeaponToPlayer, nullptr);
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-02-22 02:44:33 -05:00
|
|
|
if (ImGui::BeginTabItem(TEXT("Weapon.GangWeaponEditor")))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
ImGui::Spacing();
|
2022-02-22 02:44:33 -05:00
|
|
|
Ui::ListBox(TEXT("Weapon.SelectGang"), m_GangList, m_nSelectedGang);
|
2022-05-17 06:51:59 -04:00
|
|
|
std::vector<std::string> vec = {TEXT("Weapon.Weapon1"), TEXT("Weapon.Weapon2"), TEXT("Weapon.Weapon3")};
|
|
|
|
Ui::ListBox(TEXT("Ped.SelectWeapon"), vec, m_nSelectedWeapon);
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::Spacing();
|
2022-02-22 02:44:33 -05:00
|
|
|
ImGui::Text(TEXT("Weapon.CurrentWeapon"),
|
2022-01-07 03:18:00 -05:00
|
|
|
m_WeaponData.m_pJson->m_Data[std::to_string(m_nGangWeaponList[m_nSelectedGang][m_nSelectedWeapon])].get<
|
|
|
|
std::string>().c_str());
|
|
|
|
ImGui::Spacing();
|
|
|
|
Ui::DrawImages(m_WeaponData, SetGangWeapon, nullptr,
|
|
|
|
[](std::string str)
|
|
|
|
{
|
|
|
|
return m_WeaponData.m_pJson->m_Data[str].get<std::string>();
|
|
|
|
},
|
|
|
|
[](std::string str)
|
|
|
|
{
|
|
|
|
return str != "-1"; /*Jetpack*/
|
|
|
|
}
|
|
|
|
);
|
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::EndTabBar();
|
|
|
|
}
|
2020-12-02 16:19:16 -05:00
|
|
|
}
|