#include <amxmodx>
#include <engine>
#define PLUGIN "Entity & Drop Fix"
#define VERSION "1.1"
#define AUTHOR "Misiaczek ;c / Err0r"
new g_pMaxWeapons;
new g_pWeaponLife;
new g_pMaxEdicts;
new g_pDebug;
new g_iWeaponCount;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
g_pMaxWeapons = register_cvar("guard_max_weapons", "20");
g_pWeaponLife = register_cvar("guard_weapon_life", "12.0");
g_pMaxEdicts = register_cvar("guard_max_edicts", "850");
g_pDebug = register_cvar("guard_debug", "0");
register_event("CurWeapon", "OnWeaponDropCheck", "be");
set_task(1.0, "CleanupWeapons", _, _, _, "b");
set_task(3.0, "CheckEdicts", _, _, _, "b");
}
public plugin_cfg()
{
SyncWeapons();
}
public OnWeaponDropCheck(id)
{
if (!is_user_alive(id))
return;
SyncWeapons();
if (g_iWeaponCount >= get_pcvar_num(g_pMaxWeapons))
{
client_print(id, print_center, "[GUARD] Za duzo broni na mapie!");
}
}
public CleanupWeapons()
{
new ent = -1;
new Float:time = get_gametime();
new Float:lifetime = get_pcvar_float(g_pWeaponLife);
while ((ent = find_ent_by_class(ent, "weaponbox")))
{
if (!is_valid_ent(ent))
continue;
if (IsC4(ent))
continue;
new Float:spawn = entity_get_float(ent, EV_FL_fuser1);
if (spawn == 0.0)
{
entity_set_float(ent, EV_FL_fuser1, time);
continue;
}
if ((time - spawn) > lifetime)
{
remove_entity(ent);
}
}
}
public CheckEdicts()
{
new total = 0;
new ent = -1;
while ((ent = find_ent_by_class(ent, "*")))
{
if (is_valid_ent(ent))
total++;
}
if (total >= get_pcvar_num(g_pMaxEdicts))
{
new w = -1;
while ((w = find_ent_by_class(w, "weaponbox")))
{
if (is_valid_ent(w))
remove_entity(w);
}
if (get_pcvar_num(g_pDebug))
server_print("[GUARD] CLEANUP! Edicts: %d", total);
}
}
public SyncWeapons()
{
new ent = -1;
g_iWeaponCount = 0;
while ((ent = find_ent_by_class(ent, "weaponbox")))
{
if (is_valid_ent(ent) && !IsC4(ent))
g_iWeaponCount++;
}
}
stock bool:IsC4(ent)
{
static model[64];
entity_get_string(ent, EV_SZ_model, model, charsmax(model));
return containi(model, "c4") != -1;
}
mój błąd wcześniej, w reapi sugerowałem się częściowo fakemeta, przez co nieściłośc wyszła, ale prosze , to działa bez problemu
//AMXXPC compile.exe // by the AMX Mod X Dev Team //// test.sma // // Header size: 728 bytes // Code size: 2480 bytes // Data size: 1684 bytes // Stack/heap size: 16384 bytes // Total requirements: 21276 bytes // Done. // // Compilation Time: 0,7 sec // ----------------------------------------


Dodatki SourceMod




Moja zawartość
Mężczyzna





codclass_saper.amxx