From 7607207d3246510641f0d2f63dec41e56f29b831 Mon Sep 17 00:00:00 2001 From: Vaqtincha <51029683+Vaqtincha@users.noreply.github.com> Date: Sun, 22 Sep 2019 19:41:57 +0500 Subject: [PATCH] Add "give" client cheat command (e.g give weapon_ak47) like in csgo (#415) * Add "give" client cheat command (e.g give weapon_ak47) like in csgo --- regamedll/dlls/client.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index b3afc937..431056ff 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -3521,6 +3521,23 @@ void EXT_FUNC InternalCommand(edict_t *pEntity, const char *pcmd, const char *pa { pPlayer->SmartRadio(); } +#ifdef REGAMEDLL_ADD + else if (FStrEq(pcmd, "give")) + { + if (CVAR_GET_FLOAT("sv_cheats") != 0.0f && CMD_ARGC() > 1 && FStrnEq(parg1, "weapon_", sizeof("weapon_") - 1)) + { + const auto pInfo = GetWeaponInfo(parg1); + if (pInfo) + { + if (pInfo->id != WEAPON_GLOCK && pInfo->id != WEAPON_C4 /* && pInfo->id != WEAPON_KNIFE */) + { + pPlayer->GiveNamedItemEx(pInfo->entityName); + pPlayer->GiveAmmo(pInfo->maxRounds, pInfo->ammoName2); + } + } + } + } +#endif else { if (HandleBuyAliasCommands(pPlayer, pcmd))