L4D2Tools: Fix model change setting ammo to 0

This commit is contained in:
Jackzie 2021-05-17 23:18:11 -05:00
parent 6d10b7c964
commit fa17aa5541
No known key found for this signature in database
GPG key ID: 1E834FE36520537A

View file

@ -285,14 +285,18 @@ public Action Command_SetClientModel(int client, int args) {
}
UpdatePlayerIdentity(target, view_as<Character>(modelID), keepModel);
int weapon = GetPlayerWeaponSlot(target, 0);
if( weapon != -1 ) {
DataPack pack = new DataPack();
pack.WriteCell(GetClientUserId(target));
pack.WriteCell(EntIndexToEntRef(weapon)); // Save last held weapon to switch back
DataPack pack = new DataPack();
pack.WriteCell(GetClientUserId(target));
for(int slot = 0; slot <= 1; slot++) {
int weapon = GetPlayerWeaponSlot(target, slot);
if( weapon > 0 ) {
SDKHooks_DropWeapon(target, weapon, NULL_VECTOR);
pack.WriteCell(EntIndexToEntRef(weapon)); // Save last held weapon to switch back
CreateTimer(0.2, Timer_RequipWeapon, pack);
}
}
CreateTimer(0.1, Timer_RequipWeapon, pack);
}
}
}