Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions modules/hamsandwich/DataHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ static cell AMX_NATIVE_CALL SetHamItemInfo(AMX *amx, cell *params)
ItemInfo *pItem = reinterpret_cast<ItemInfo *>(params[1]);
cell *ptr = MF_GetAmxAddr(amx, params[3]);
int iLen;
char *szString;

switch (params[2])
{
Expand All @@ -420,23 +421,26 @@ static cell AMX_NATIVE_CALL SetHamItemInfo(AMX *amx, cell *params)
break;

case ItemInfo_pszAmmo1:
pItem->pszAmmo1 = MF_GetAmxString(amx, params[3], 0, &iLen);
szString = MF_GetAmxString(amx, params[3], 0, &iLen);
pItem->pszAmmo1 = szString ? STRING(ALLOC_STRING(szString)) : nullptr;
return iLen;

case ItemInfo_iMaxAmmo1:
pItem->iMaxAmmo1 = *ptr;
break;

case ItemInfo_pszAmmo2:
pItem->pszAmmo2 = MF_GetAmxString(amx, params[3], 0, &iLen);
szString = MF_GetAmxString(amx, params[3], 0, &iLen);
pItem->pszAmmo2 = szString ? STRING(ALLOC_STRING(szString)) : nullptr;
return iLen;

case ItemInfo_iMaxAmmo2:
pItem->iMaxAmmo2 = *ptr;
break;

case ItemInfo_pszName:
pItem->pszName = MF_GetAmxString(amx, params[3], 0, &iLen);
szString = MF_GetAmxString(amx, params[3], 0, &iLen);
pItem->pszName = szString ? STRING(ALLOC_STRING(szString)) : nullptr;
return iLen;

case ItemInfo_iMaxClip:
Expand Down
Loading