Quote:
Originally Posted by ConnorMcLeod
Signature is ok.
I think there is no return.
About ammo, if function works, ammo is duplicated, owner still has ammo.
On default cs routine, owner weapons are stripped after weapons are packed, so all ammo is set to 0 at this time, that's why you noticed owner still has ammo.
So, try with no return, or void, depending on how you have to do with orpheu when there is no return.
|
Now it strangely works, I had to reset the ammo manually as you said because all ammo is reseted after weapons are stripped because game was done to be like that.
The function works, and the weaponbox got the ammo correctly, I had to set 1 instead of true as I saw, and about the return type, I think that my hlds doesn't crash because the game doesn't ask for the return value of packPlayerItem, but by default it returns a value.
Code:
int __cdecl packPlayerItem(CBasePlayer *a1, CBasePlayerItem *a2, bool a3)
{
int result; // eax@2
int v4; // esi@4
int v5; // ecx@4
float v6; // ST40_4@4
float v7; // ST3C_4@4
float v8; // ST44_4@4
int v9; // eax@4
int v10; // ST08_4@5
int v11; // [sp-8h] [bp-30h]@4
int v12; // [sp-4h] [bp-2Ch]@4
int v13; // [sp+18h] [bp-10h]@1
v13 = 0;
if ( a2 )
{
result = GetCSModelName(a2->m_iId);
v13 = result;
}
if ( v13 )
{
v4 = (int)CBaseEntity::Create(
"weaponbox",
(const Vector *)a1->pev->origin,
(const Vector *)a1->pev->angles,
a1->pev->pContainingEntity);
*(_DWORD *)(*(_DWORD *)v4 + 80) = 0;
*(_DWORD *)(*(_DWORD *)v4 + 88) = 0;
v5 = *(_DWORD *)v4;
v6 = a1->pev->velocity[1] * 0.75;
v7 = a1->pev->velocity[0] * 0.75;
v8 = 0.75 * a1->pev->velocity[2];
*(_DWORD *)(*(_DWORD *)v4 + 32) = LODWORD(v7);
*(_DWORD *)(v5 + 36) = LODWORD(v6);
HIWORD(v9) = HIWORD(v8);
*(_DWORD *)(v5 + 40) = LODWORD(v8);
LOWORD(v9) = 0;
*(_DWORD *)(v4 + 12) = v9 | 0xFFFF0000;
*(_DWORD *)(v4 + 16) = CWeaponBox::Kill;
*(float *)(*(_DWORD *)v4 + 260) = gpGlobals->time + 300.0;
CWeaponBox::PackWeapon((CBasePlayerItem *)v4);
if ( a3 )
{
v10 = a1->m_rgAmmo[((int (__cdecl *)(CBasePlayerItem *))a2->vtable->CBasePlayerItem__PrimaryAmmoIndex)(a2)];
CWeaponBox::PackAmmo(
v4,
*(_DWORD *)&CBasePlayerItem::ItemInfoArray[44 * a2->m_iId + 8] - (unsigned int)gpGlobals->pStringBase);
}
result = ((int (__stdcall *)(_DWORD, int, int, int))g_engfuncs.pfnSetModel)(
*(_DWORD *)(*(_DWORD *)v4 + 520),
v13,
v11,
v12);
}
return result;
}
Thanks for helping !
__________________