Skip to content

Commit d691b66

Browse files
author
lopezloo
committed
Fixed getPedTotalAmmo crashing game if incorrect slot ID was passed
1 parent 93e121f commit d691b66

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

MTA10/mods/shared_logic/lua/CLuaFunctionDefs.Ped.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ int CLuaFunctionDefs::GetPedTotalAmmo ( lua_State* luaVM )
233233
lua_pushnumber ( luaVM, usAmmo );
234234
return 1;
235235
}
236-
else if ( pPed->m_usWeaponAmmo [ ucSlot ] )
236+
else if ( ucSlot < WEAPONSLOT_MAX && pPed->m_usWeaponAmmo [ ucSlot ] )
237237
{
238238
// The ped musn't be streamed in, so we can get the stored value instead
239239
ushort usAmmo = 1;

0 commit comments

Comments
 (0)