Ok, watching a bit longer the pointer logic going on here, I just realized my if's were total useless, they actually can't check anything. They basically add a number to 0 or greater and test if that number is still 0.
Lets name that function getWeaponStruct_80E9270 (based on Mitch's comment in the Server Crash thread).
Lets dissect:
PHP Code:
int __cdecl getWeaponStruct_80E9270(int a1)
{
return dword_8576160[a1];
}
The [] is basically syntax sugar for:
PHP Code:
int __cdecl getWeaponStruct_80E9270(int a1)
{
return *((int *)0x8576160 + a1);
}
Same game here, this function just cannot fail. It will always point to a valid array element address, implying your debug-printed a1 values of 111 and 211. It could only fail with very large numbers (either positive or negative).
The only reason you don't see the printf after that line, is because you dereference v3 in the next printf:
PHP Code:
printf("hook_BG_IsWeaponValid -- Last weapon used: %s\n", *(char**)(v3 + 0));
And I guess that's the whole problem here, getWeaponStruct() probably returns 0.
So the only thing you need to check for in hook_BG_IsWeaponValid() should be:
PHP Code:
if ( ! v3)
{
printf("Warning: getWeaponStruct(%d) returned 0!\n", a2);
return 0;
}