#include <sourcemod>
#include <colors>
#include <sdktools>
#include <sdkhooks>
public Plugin myinfo =
{
name = "SetItemsCount",
author = "pa4H",
description = "",
version = "1.0",
url = "https://t.me/pa4H232"
}
public OnPluginStart()
{
//RegConsoleCmd("sm_test", debb, "");
//RegConsoleCmd("sm_itemcount", printItemCount, "");
HookEvent("round_start", clearEvent);
}
stock Action debb(int client, int args) // DEBUG
{
return Plugin_Handled;
}
stock Action printItemCount(int client, int args)
{
char eName[64];
int pill, med, adr, pipe, molot, defib, vomit, ince, expl;
for (int i = 1; i <= GetMaxEntities(); i++)
{
if (IsValidEntity(i))
{
GetEntityClassname(i, eName, sizeof eName);
if (strcmp(eName, "weapon_first_aid_kit_spawn") == 0) {
med++;
}
if (strcmp(eName, "weapon_pain_pills_spawn") == 0) {
pill++;
}
if (strcmp(eName, "weapon_adrenaline_spawn") == 0) {
adr++;
}
if (strcmp(eName, "weapon_defibrillator_spawn") == 0) {
defib++;
}
if (strcmp(eName, "weapon_vomitjar_spawn") == 0) {
vomit++;
}
if (strcmp(eName, "weapon_molotov_spawn") == 0) {
molot++;
}
if (strcmp(eName, "weapon_pipe_bomb_spawn") == 0) {
pipe++;
}
if (strcmp(eName, "weapon_upgradepack_incendiary_spawn") == 0) {
ince++;
}
if (strcmp(eName, "weapon_upgradepack_explosive_spawn") == 0) {
expl++;
}
}
}
PrintToChatAll("Incendiary: %i", ince);
PrintToChatAll("Explosive: %i", expl);
PrintToChatAll("Pipe: %i", pipe);
PrintToChatAll("Molotov: %i", molot);
PrintToChatAll("Vomit: %i", vomit);
PrintToChatAll("Pills: %i", pill);
PrintToChatAll("Adrenaline: %i", adr);
PrintToChatAll("Medkit: %i", med);
PrintToChatAll("Defib: %i", defib);
return Plugin_Handled;
}
public void clearEvent(Event event, char[] name, bool dobr)
{
char eName[64];
int pill, med, adr, pipe, molot, defib, vomit, ince, expl;
for (int i = 1; i <= GetMaxEntities(); i++)
{
if (IsValidEntity(i))
{
GetEntityClassname(i, eName, sizeof eName);
if (strcmp(eName, "weapon_first_aid_kit_spawn") == 0) {
med++;
if (med > 6) {
AcceptEntityInput(i, "Kill"); RemoveEdict(i);
}
}
if (strcmp(eName, "weapon_pain_pills_spawn") == 0) {
pill++;
if (pill <= 2 || pill > 6) {
AcceptEntityInput(i, "Kill"); RemoveEdict(i);
}
}
if (strcmp(eName, "weapon_adrenaline_spawn") == 0) {
adr++;
if (adr > 2) {
AcceptEntityInput(i, "Kill"); RemoveEdict(i);
}
}
if (strcmp(eName, "weapon_defibrillator_spawn") == 0) {
defib++;
if (defib > 1) {
AcceptEntityInput(i, "Kill"); RemoveEdict(i);
}
}
if (strcmp(eName, "weapon_vomitjar_spawn") == 0) {
vomit++;
if (vomit <= 4 || vomit > 6) {
AcceptEntityInput(i, "Kill"); RemoveEdict(i);
}
}
if (strcmp(eName, "weapon_molotov_spawn") == 0) {
molot++;
if (molot <= 2 || molot > 4) {
AcceptEntityInput(i, "Kill"); RemoveEdict(i);
}
}
if (strcmp(eName, "weapon_pipe_bomb_spawn") == 0) {
pipe++;
if (pipe <= 2 || pipe > 6) {
AcceptEntityInput(i, "Kill"); RemoveEdict(i);
}
}
if (strcmp(eName, "weapon_upgradepack_incendiary_spawn") == 0) {
ince++;
if (ince > 1) {
AcceptEntityInput(i, "Kill"); RemoveEdict(i);
}
}
if (strcmp(eName, "weapon_upgradepack_explosive_spawn") == 0) {
expl++;
if (expl > 1) {
AcceptEntityInput(i, "Kill"); RemoveEdict(i);
}
}
}
}
}
stock bool IsValidClient(client)
{
if (client > 0 && client <= MaxClients && IsClientInGame(client) && IsClientConnected(client) && !IsFakeClient(client)) {
return true;
}
return false;
}
/*
1 weapon_upgradepack_incendiary_spawn
1 ;weapon_upgradepack_explosive_spawn
2 weapon_adrenaline_spawn
4 weapon_pain_pills_spawn
6 weapon_first_aid_kit_spawn
1 weapon_defibrillator_spawn
2 weapon_vomitjar_spawn
2 weapon_molotov_spawn
4 weapon_pipe_bomb_spawn
*/