forked from UNLOZE/sm-plugins
67 lines
2.5 KiB
SourcePawn
67 lines
2.5 KiB
SourcePawn
#include <sourcemod>
|
|
#include <sdkhooks>
|
|
#include <sdktools>
|
|
|
|
#define MAXAMMO 10000
|
|
//----------------------------------------------------------------------------------------------------
|
|
// Purpose:
|
|
//----------------------------------------------------------------------------------------------------
|
|
public Plugin myinfo =
|
|
{
|
|
name = "IncreaseReserveAmmo",
|
|
author = "zaCade",
|
|
description = "Feex volvo bullshiet!",
|
|
version = "1.0.0"
|
|
};
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
// Purpose:
|
|
//----------------------------------------------------------------------------------------------------
|
|
public void OnPluginStart()
|
|
{
|
|
for(int client = 1; client <= MaxClients; client++)
|
|
{
|
|
if(IsClientInGame(client) && !IsFakeClient(client))
|
|
OnClientPutInServer(client);
|
|
}
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
// Purpose:
|
|
//----------------------------------------------------------------------------------------------------
|
|
public void OnClientPutInServer(int client)
|
|
{
|
|
if (!IsFakeClient(client))
|
|
{
|
|
SDKHook(client, SDKHook_WeaponEquipPost, OnWeaponAction);
|
|
SDKHook(client, SDKHook_WeaponDropPost, OnWeaponAction);
|
|
}
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
// Purpose:
|
|
//----------------------------------------------------------------------------------------------------
|
|
public void OnWeaponAction(int client, int weapon)
|
|
{
|
|
if (IsValidEntity(weapon))
|
|
{
|
|
if (!HasEntProp(client, Prop_Send, "m_iAmmo"))
|
|
return;
|
|
|
|
SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", MAXAMMO);
|
|
SetEntProp(weapon, Prop_Send, "m_iSecondaryReserveAmmoCount", MAXAMMO);
|
|
|
|
int AmmoTypePrimary = GetEntProp(weapon, Prop_Data, "m_iPrimaryAmmoType");
|
|
int AmmoTypeSecondary = GetEntProp(weapon, Prop_Data, "m_iSecondaryAmmoType");
|
|
|
|
// PrintToChatAll("Primary: %d | Secondary: %d", AmmoTypePrimary, AmmoTypeSecondary)
|
|
|
|
if (AmmoTypePrimary >= 0 && AmmoTypePrimary <= 13 || AmmoTypePrimary == 20)
|
|
if (GetEntProp(client, Prop_Send, "m_iAmmo", _, AmmoTypePrimary) >= 0)
|
|
SetEntProp(client, Prop_Send, "m_iAmmo", MAXAMMO, _, AmmoTypePrimary);
|
|
|
|
if (AmmoTypeSecondary >= 0 && AmmoTypeSecondary <= 13 || AmmoTypeSecondary == 20)
|
|
if (GetEntProp(client, Prop_Send, "m_iAmmo", _, AmmoTypeSecondary) >= 0)
|
|
SetEntProp(client, Prop_Send, "m_iAmmo", MAXAMMO, _, AmmoTypeSecondary);
|
|
}
|
|
} |