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
This commit is contained in:
Vaqtincha 2019-09-22 19:41:57 +05:00 committed by Dmitry Novikov
parent a386ef41ea
commit 7607207d32

View File

@ -3521,6 +3521,23 @@ void EXT_FUNC InternalCommand(edict_t *pEntity, const char *pcmd, const char *pa
{ {
pPlayer->SmartRadio(); 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 else
{ {
if (HandleBuyAliasCommands(pPlayer, pcmd)) if (HandleBuyAliasCommands(pPlayer, pcmd))