OnDispenserGather returns less
Hi, I'm having problems with this hook. When I collect any material, the hook always returns less.
In the 1000 stone game only 750 are recorded.
Sulfur, instead of 300 it registers 200.
Do you know what could be happening?
My current code is this:
using System;
namespace Oxide.Plugins
{
[Info("GatheredLogger", "Code Copilot", "1.0.4")]
[Description("Reporte simple de materiales recolectados.")]
public class GatheredLogger : CovalencePlugin
{
private void Init()
{
Puts("GatheredMaterialLogger initialized.");
}
private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
{
// Validar que la entidad sea un jugador
if (entity is not BasePlayer player)
{
Puts("Entidad no válida, no es un jugador.");
return;
}
int actualAmount = item.amount;
// Validar cantidad recolectada
if (actualAmount <= 0)
{
Puts($"Advertencia: {player.displayName} recolectó cantidad no válida ({actualAmount}) de {item.info.shortname}.");
return;
}
// Reportar en la consola
Puts($"{player.displayName} recolectó {actualAmount} de {item.info.shortname}.");
}
}
}