#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
public OnPluginStart()
{
//Это на кнопку R, но на автоперезарядку не пашет
HookEvent("weapon_reload", Event_Reload);
//Это когда хоть раз стрельнешь при 0/0 аммо
HookEvent("weapon_fire_on_empty", Event_Reload);
//А это просто не работает, блеть, а так нужна здесь....
//HookEvent("weapon_outofammo", Event_Reload);
}
public Event_Reload(Handle:event, const String:name[], bool:dontBroadcast)
{
new iPlayer = GetClientOfUserId(GetEventInt(event, "userid"));
int Primary = GetPlayerWeaponSlot(iPlayer, 0);
int Secondary = GetPlayerWeaponSlot(iPlayer, 1);
int iAmmoType;
if (Primary != -1)
{
iAmmoType = GetEntProp(Primary, Prop_Send, "m_iPrimaryAmmoType");
SetEntProp(iPlayer, Prop_Send, "m_iAmmo", 200, _, iAmmoType);
}
else if (Secondary != -1)
{
iAmmoType = GetEntProp(Secondary, Prop_Send, "m_iPrimaryAmmoType");
SetEntProp(iPlayer, Prop_Send, "m_iAmmo", 200, _, iAmmoType);
}
}
If 10/24 bullets and press R >> 12/24
If 0/0 bullets and press +attack >> 0/24 >> autoreload >> 12/12
But if 0/12 bullets and press +attack >> 12/0