Użytkownik Zjarany_Ziomek_420 edytował ten post 24.03.2026 22:29
Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Szukam pluginu który naprawia wyrzucanie broni powyżej 30
#1
Napisano 24.03.2026 22:29
#3
Napisano 27.03.2026 09:03
masz, sprawdź sobie to, nie mam serwera żeby to przetestować w akcji
#include <amxmodx>
#include <fakemeta>
#include <engine>
#define PLUGIN "Drop Fix"
#define VERSION "1.0"
#define AUTHOR "Misiaczek ;c / Err0r"
#define THINKER_CLASSNAME "amxx_dropfix_thinker"
#define MAX_TRACKED_WEAPONS 512
new g_pEnabled;
new g_pMaxWeapons;
new g_pLifeTime;
new g_pScanInterval;
new g_pDebug;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
g_pEnabled = register_cvar("amx_dropfix_enable", "1");
g_pMaxWeapons = register_cvar("amx_dropfix_max", "28");
g_pLifeTime = register_cvar("amx_dropfix_lifetime", "25.0");
g_pScanInterval = register_cvar("amx_dropfix_scan_interval", "1.0");
g_pDebug = register_cvar("amx_dropfix_debug", "0");
create_thinker();
}
public plugin_cfg()
{
create_thinker();
}
public create_thinker()
{
new ent = FM_NULLENT;
while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", THINKER_CLASSNAME)))
{
engfunc(EngFunc_RemoveEntity, ent);
}
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if (!pev_valid(ent))
{
log_amx("[DROPFIX] Nie udalo sie utworzyc.");
return;
}
set_pev(ent, pev_classname, THINKER_CLASSNAME);
set_pev(ent, pev_nextthink, get_gametime() + get_pcvar_float(g_pScanInterval));
register_think(THINKER_CLASSNAME, "fw_Think");
}
public fw_Think(ent)
{
if (!pev_valid(ent))
return;
if (get_pcvar_num(g_pEnabled))
{
scan_weaponboxes();
}
set_pev(ent, pev_nextthink, get_gametime() + get_pcvar_float(g_pScanInterval));
}
stock bool:is_c4_weaponbox(ent)
{
if (!pev_valid(ent))
return false;
new weapon = -1;
while ((weapon = engfunc(EngFunc_FindEntityByString, weapon, "classname", "weapon_c4")))
{
if (!pev_valid(weapon))
continue;
if (pev(weapon, pev_owner) == ent)
return true;
}
return false;
}
stock scan_weaponboxes()
{
new ent = FM_NULLENT;
new count = 0;
new Float:now = get_gametime();
new Float:lifetime = get_pcvar_float(g_pLifeTime);
new maxWeapons = get_pcvar_num(g_pMaxWeapons);
new weaponList[MAX_TRACKED_WEAPONS];
new Float:spawnTime[MAX_TRACKED_WEAPONS];
while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "weaponbox")))
{
if (!pev_valid(ent))
continue;
if (is_c4_weaponbox(ent))
continue;
new Float:stamp;
pev(ent, pev_fuser1, stamp);
if (stamp <= 0.0)
{
stamp = now;
set_pev(ent, pev_fuser1, stamp);
}
if (lifetime > 0.0 && (now - stamp) >= lifetime)
{
if (get_pcvar_num(g_pDebug))
{
log_amx("[DROPFIX] Usuwam stary weaponbox ent=%d age=%.2f", ent, now - stamp);
}
engfunc(EngFunc_RemoveEntity, ent);
continue;
}
if (count < MAX_TRACKED_WEAPONS)
{
weaponList[count] = ent;
spawnTime[count] = stamp;
count++;
}
}
if (count <= maxWeapons)
return;
new toRemove = count - maxWeapons;
for (new i = 0; i < toRemove; i++)
{
new oldestIndex = -1;
new Float:oldestTime = 9999999.0;
for (new j = 0; j < count; j++)
{
if (weaponList[j] == 0)
continue;
if (spawnTime[j] < oldestTime)
{
oldestTime = spawnTime[j];
oldestIndex = j;
}
}
if (oldestIndex == -1)
break;
if (pev_valid(weaponList[oldestIndex]))
{
if (get_pcvar_num(g_pDebug))
{
log_amx("[DROPFIX] Limit przekroczony (%d > %d), usuwam najstarszy weaponbox ent=%d",
count, maxWeapons, weaponList[oldestIndex]);
}
engfunc(EngFunc_RemoveEntity, weaponList[oldestIndex]);
}
weaponList[oldestIndex] = 0;
}
}
#4
Napisano 27.03.2026 23:23
masz, sprawdź sobie to, nie mam serwera żeby to przetestować w akcji
#include <amxmodx> #include <fakemeta> #include <engine> #define PLUGIN "Drop Fix" #define VERSION "1.0" #define AUTHOR "Misiaczek ;c / Err0r" #define THINKER_CLASSNAME "amxx_dropfix_thinker" #define MAX_TRACKED_WEAPONS 512 new g_pEnabled; new g_pMaxWeapons; new g_pLifeTime; new g_pScanInterval; new g_pDebug; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); g_pEnabled = register_cvar("amx_dropfix_enable", "1"); g_pMaxWeapons = register_cvar("amx_dropfix_max", "28"); g_pLifeTime = register_cvar("amx_dropfix_lifetime", "25.0"); g_pScanInterval = register_cvar("amx_dropfix_scan_interval", "1.0"); g_pDebug = register_cvar("amx_dropfix_debug", "0"); create_thinker(); } public plugin_cfg() { create_thinker(); } public create_thinker() { new ent = FM_NULLENT; while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", THINKER_CLASSNAME))) { engfunc(EngFunc_RemoveEntity, ent); } ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); if (!pev_valid(ent)) { log_amx("[DROPFIX] Nie udalo sie utworzyc."); return; } set_pev(ent, pev_classname, THINKER_CLASSNAME); set_pev(ent, pev_nextthink, get_gametime() + get_pcvar_float(g_pScanInterval)); register_think(THINKER_CLASSNAME, "fw_Think"); } public fw_Think(ent) { if (!pev_valid(ent)) return; if (get_pcvar_num(g_pEnabled)) { scan_weaponboxes(); } set_pev(ent, pev_nextthink, get_gametime() + get_pcvar_float(g_pScanInterval)); } stock bool:is_c4_weaponbox(ent) { if (!pev_valid(ent)) return false; new weapon = -1; while ((weapon = engfunc(EngFunc_FindEntityByString, weapon, "classname", "weapon_c4"))) { if (!pev_valid(weapon)) continue; if (pev(weapon, pev_owner) == ent) return true; } return false; } stock scan_weaponboxes() { new ent = FM_NULLENT; new count = 0; new Float:now = get_gametime(); new Float:lifetime = get_pcvar_float(g_pLifeTime); new maxWeapons = get_pcvar_num(g_pMaxWeapons); new weaponList[MAX_TRACKED_WEAPONS]; new Float:spawnTime[MAX_TRACKED_WEAPONS]; while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "weaponbox"))) { if (!pev_valid(ent)) continue; if (is_c4_weaponbox(ent)) continue; new Float:stamp; pev(ent, pev_fuser1, stamp); if (stamp <= 0.0) { stamp = now; set_pev(ent, pev_fuser1, stamp); } if (lifetime > 0.0 && (now - stamp) >= lifetime) { if (get_pcvar_num(g_pDebug)) { log_amx("[DROPFIX] Usuwam stary weaponbox ent=%d age=%.2f", ent, now - stamp); } engfunc(EngFunc_RemoveEntity, ent); continue; } if (count < MAX_TRACKED_WEAPONS) { weaponList[count] = ent; spawnTime[count] = stamp; count++; } } if (count <= maxWeapons) return; new toRemove = count - maxWeapons; for (new i = 0; i < toRemove; i++) { new oldestIndex = -1; new Float:oldestTime = 9999999.0; for (new j = 0; j < count; j++) { if (weaponList[j] == 0) continue; if (spawnTime[j] < oldestTime) { oldestTime = spawnTime[j]; oldestIndex = j; } } if (oldestIndex == -1) break; if (pev_valid(weaponList[oldestIndex])) { if (get_pcvar_num(g_pDebug)) { log_amx("[DROPFIX] Limit przekroczony (%d > %d), usuwam najstarszy weaponbox ent=%d", count, maxWeapons, weaponList[oldestIndex]); } engfunc(EngFunc_RemoveEntity, weaponList[oldestIndex]); } weaponList[oldestIndex] = 0; } }
takie bledy Host_Error: CL_EntityNum: 1845 is an invalid number, cl.max_edicts is 1845
owszem dziala usuwa bronie 20/30 broni na raz jak przekroczy limit ale dalej crasuje serwer jak wyrzuce duza ilosc broni na mape crasuje serwer od limitu entów
#6
Napisano 29.03.2026 14:27
version
game version
meta list
rescount
wrzuć te informacje, wpisz je w konsoli pokaż nam wyniki,
#7
Napisano 29.03.2026 14:55
version
game version
meta list
rescount
wrzuć te informacje, wpisz je w konsoli pokaż nam wyniki,
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.14.0.857-dev
Build date: 19:52:21 Mar 27 2025 (4002)
Build from: https://github.com/r.../commit/89958d3
> game version
ReGameDLL version: 5.28.0.756-dev
Build date: 19:19:31 Mar 27 2025
Build from: https://github.com/r.../commit/96b2ef2
> Meta list
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] AMX Mod X RUN - amxmodx_mm_i386. v1.10.0. ini Start ANY
[ 2] Reunion RUN - reunion_mm_i386. v0.2.0.2 ini Start Never
[ 3] ReAuthCheck RUN - reauthcheck_mm_i v0.1.6 ini Start Never
[ 4] SafeNameAndChat RUN - SafeNameAndChat. v1.1 ini ANY ANY
[ 5] Revoice RUN - revoice_mm_i386. v0.1.0.3 ini Start Never
[ 6] HitBox Fix RUN - hitbox_fix_mm_i3 v1.1.5 ini Start ANY
[ 7] Print Center Fi RUN - printcenterfix_m v1.0.1 ini ANY Never
[ 8] Fun RUN - fun_amxx_i386.so v1.10.0. pl1 ANY ANY
[ 9] Engine RUN - engine_amxx_i386 v1.10.0. pl1 ANY ANY
[10] FakeMeta RUN - fakemeta_amxx_i3 v1.10.0. pl1 ANY ANY
[11] GeoIP RUN - geoip_amxx_i386. v1.10.0. pl1 ANY ANY
[12] CStrike RUN - cstrike_amxx_i38 v1.10.0. pl1 ANY ANY
[13] CSX RUN - csx_amxx_i386.so v1.10.0. pl1 ANY ANY
[14] Ham Sandwich RUN - hamsandwich_amxx v1.10.0. pl1 ANY ANY
[15] ReAPI RUN - reapi_amxx_i386. v5.26.0. pl1 ANY Never
[16] MySQL RUN - mysql_amxx_i386. v1.10.0. pl1 ANY ANY
16 plugins, 16 running
> rescount
Type : Total Limit
model : 373 510
sound : 335 511
generic : 22 4096
event : 29 255
decal : 225 511
------------------------
984 Total of precached resource count
#8
Napisano 29.03.2026 15:29
No tutaj wygląda ok.
Jakie encje tworzysz i w jaki sposób oraz jak usuwasz enty które tworzysz?
Po utworzeniu encji zmieniasz jej classname?
Użytkownik Boziak edytował ten post 29.03.2026 15:38
#10
Napisano 29.03.2026 17:53
No tutaj wygląda ok.
Jakie encje tworzysz i w jaki sposób oraz jak usuwasz enty które tworzysz?
Po utworzeniu encji zmieniasz jej classname?
Uzywam tego kodo do usuwania broni
#include
#include
#include
#define PLUGIN "Drop Fix"
#define VERSION "1.0"
#define AUTHOR "Misiaczek ;c / Err0r"
#define THINKER_CLASSNAME "amxx_dropfix_thinker"
#define MAX_TRACKED_WEAPONS 512
new g_pEnabled;
new g_pMaxWeapons;
new g_pLifeTime;
new g_pScanInterval;
new g_pDebug;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
g_pEnabled = register_cvar("amx_dropfix_enable", "1");
g_pMaxWeapons = register_cvar("amx_dropfix_max", "28");
g_pLifeTime = register_cvar("amx_dropfix_lifetime", "25.0");
g_pScanInterval = register_cvar("amx_dropfix_scan_interval", "1.0");
g_pDebug = register_cvar("amx_dropfix_debug", "0");
create_thinker();
}
public plugin_cfg()
{
create_thinker();
}
public create_thinker()
{
new ent = FM_NULLENT;
while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", THINKER_CLASSNAME)))
{
engfunc(EngFunc_RemoveEntity, ent);
}
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if (!pev_valid(ent))
{
log_amx("[DROPFIX] Nie udalo sie utworzyc.");
return;
}
set_pev(ent, pev_classname, THINKER_CLASSNAME);
set_pev(ent, pev_nextthink, get_gametime() + get_pcvar_float(g_pScanInterval));
register_think(THINKER_CLASSNAME, "fw_Think");
}
public fw_Think(ent)
{
if (!pev_valid(ent))
return;
if (get_pcvar_num(g_pEnabled))
{
scan_weaponboxes();
}
set_pev(ent, pev_nextthink, get_gametime() + get_pcvar_float(g_pScanInterval));
}
stock bool:is_c4_weaponbox(ent)
{
if (!pev_valid(ent))
return false;
new weapon = -1;
while ((weapon = engfunc(EngFunc_FindEntityByString, weapon, "classname", "weapon_c4")))
{
if (!pev_valid(weapon))
continue;
if (pev(weapon, pev_owner) == ent)
return true;
}
return false;
}
stock scan_weaponboxes()
{
new ent = FM_NULLENT;
new count = 0;
new Float:now = get_gametime();
new Float:lifetime = get_pcvar_float(g_pLifeTime);
new maxWeapons = get_pcvar_num(g_pMaxWeapons);
new weaponList[MAX_TRACKED_WEAPONS];
new Float:spawnTime[MAX_TRACKED_WEAPONS];
while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "weaponbox")))
{
if (!pev_valid(ent))
continue;
if (is_c4_weaponbox(ent))
continue;
new Float:stamp;
pev(ent, pev_fuser1, stamp);
if (stamp <= 0.0)
{
stamp = now;
set_pev(ent, pev_fuser1, stamp);
}
if (lifetime > 0.0 && (now - stamp) >= lifetime)
{
if (get_pcvar_num(g_pDebug))
{
log_amx("[DROPFIX] Usuwam stary weaponbox ent=%d age=%.2f", ent, now - stamp);
}
engfunc(EngFunc_RemoveEntity, ent);
continue;
}
if (count < MAX_TRACKED_WEAPONS)
{
weaponList[count] = ent;
spawnTime[count] = stamp;
count++;
}
}
if (count <= maxWeapons)
return;
new toRemove = count - maxWeapons;
for (new i = 0; i < toRemove; i++)
{
new oldestIndex = -1;
new Float:oldestTime = 9999999.0;
for (new j = 0; j < count; j++)
{
if (weaponList[j] == 0)
continue;
if (spawnTime[j] < oldestTime)
{
oldestTime = spawnTime[j];
oldestIndex = j;
}
}
if (oldestIndex == -1)
break;
if (pev_valid(weaponList[oldestIndex]))
{
if (get_pcvar_num(g_pDebug))
{
log_amx("[DROPFIX] Limit przekroczony (%d > %d), usuwam najstarszy weaponbox ent=%d",
count, maxWeapons, weaponList[oldestIndex]);
}
engfunc(EngFunc_RemoveEntity, weaponList[oldestIndex]);
}
weaponList[oldestIndex] = 0;
}
}
i bład dziala tak ze jak wyrzucisz z 500 broni to crashuje serwer
#11
Napisano 29.03.2026 17:54
Komenda startowa?
hlds_run -autorestart -game cstrike +maxplayers 16 +ip 193.33.177.216 +port 27015 -pingboost 1 +sys_ticrate 1000 +exec server.cfg +map jail_minecraft_v3 -num_edicts 10000
ale to itak bez znaczenia poniewaz NS bedzie itak wywalac z serwera
#12
Napisano 29.03.2026 18:11
Czy ja pytałem jakiego kodu używasz do usuwania broni czy jak operujesz na encjach na swoim serwerze?
#13
Napisano 29.03.2026 20:21
Czy ja pytałem jakiego kodu używasz do usuwania broni czy jak operujesz na encjach na swoim serwerze?
Chodzi mi o bronie leżące na mapie, czyli encje typu weaponbox.
#14
Napisano 29.03.2026 21:02
Dobra, nie chce mi się.
Poczytaj czym jest hash table encji w rehlds może zrozumiesz czemu o to pytam.
Ty piszesz o broniach które są encja, spoko. Ja bym się zastanowił czemu przekraczasz limit ogólny tablicy ent. Szukasz powodu w broniach, a problem jest zapewne w tym że robisz śmietnik w bytach na serwerze.
Lecz skoro nie masz ochoty współpracować, mi też nie chce się marnować czasu ![]()
Użytkownik Boziak edytował ten post 29.03.2026 21:08
#15
Napisano 29.03.2026 21:25
powaliło mi sie sorry
Nie tworzę własnych encji, problem jest przy dużej ilości weaponboxów z dropu.
Plugin usuwa je dopiero po czasie i zanim to zrobi, serwer dobija do limitu edictów i crashuje.
posiadam na serwerze ReHLDS + ReGameDLL + ReAPI, AMXX 1.10.
Masz może pomysł jak ograniczyć tworzenie tych weaponboxów od razu przy dropie albo jak sprawdzić czy jakiś plugin nie spamuje encjami?
Użytkownik Zjarany_Ziomek_420 edytował ten post 29.03.2026 21:27
#16
Napisano 30.03.2026 07:53
Spróbujemy to ugryźć inaczej ![]()
guard_max_weapons "20" - maksymalna ilość broni na mapie // 20 - NS // 25 - Maksymalne dla stabilności // 30 - ryzyko crasha guard_weapon_life "10.0" - czas "życia" broni na ziemi // 10.0 - agresywne usuwanie // 15.0 - optymalne / stabline // 30.0 - długie, możliwy crash guard_max_edicts "900" - maksymalna ilośc encji na serwerze // 850 - bezpieczen / stabilne // 900 - optymalne / stabilne // 1000 - ryzykowne przy NS guard_safe_margin "100" - buffor bezpieczeństwa, plugin nie czeka az osiągniesz wartość z guard_max_edicts tylko reaguje odpowiednio wcześniej // 50 - pozna reakcja, możliwe ryzyko crasha // 100 - optymalne / stabilne // 150 - bezpieczne / stabilne // // dokładnie działa to tak [ guard_max_edicts - guard_safe_margin ] guard_debug "0" - debuger // 0 - off // 1 - on // loguje do konsoli co robi plugin oraz dodatkowo co spamuje enitami z innych pluginów
#include <amxmodx>
#include <reapi>
#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_pSafeMargin;
new g_pDebug;
new g_iWeaponCount;
new g_iEdictCount;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
g_pMaxWeapons = register_cvar("guard_max_weapons", "25");
g_pWeaponLife = register_cvar("guard_weapon_life", "15.0");
g_pMaxEdicts = register_cvar("guard_max_edicts", "900");
g_pSafeMargin = register_cvar("guard_safe_margin", "50");
g_pDebug = register_cvar("guard_debug", "0");
RegisterHookChain(RG_CBasePlayer_DropPlayerItem, "OnDrop", false);
RegisterHookChain(RG_CreateEntity, "OnEntityCreate", false);
RegisterHookChain(RG_RemoveEntity, "OnEntityRemove", true);
RegisterHookChain(RG_RoundEnd, "OnRoundEnd", true);
set_task(1.0, "CleanupWeapons", _, _, _, "b");
set_task(3.0, "FullSync", _, _, _, "b");
}
public plugin_cfg()
{
FullSync();
}
public OnDrop(const id, const char[] item)
{
if (!is_user_alive(id))
return HC_CONTINUE;
new max = get_pcvar_num(g_pMaxWeapons);
if (g_iWeaponCount >= max)
{
if (get_pcvar_num(g_pDebug))
client_print(id, print_center, "[GUARD] Limit broni!");
return HC_SUPERCEDE;
}
return HC_CONTINUE;
}
public OnEntityCreate(const ent, const char[] classname[])
{
if (!ent)
return HC_CONTINUE;
new maxEdicts = get_pcvar_num(g_pMaxEdicts);
new margin = get_pcvar_num(g_pSafeMargin);
if (g_iEdictCount >= (maxEdicts - margin))
{
if (IsRemovable(classname))
{
if (get_pcvar_num(g_pDebug))
server_print("[GUARD] BLOCK ENTITY: %s", classname);
return HC_SUPERCEDE;
}
}
if (equal(classname, "weaponbox"))
{
new maxWeapons = get_pcvar_num(g_pMaxWeapons);
if (g_iWeaponCount >= maxWeapons)
{
if (get_pcvar_num(g_pDebug))
server_print("[GUARD] BLOCK WEAPONBOX");
return HC_SUPERCEDE;
}
g_iWeaponCount++;
}
g_iEdictCount++;
return HC_CONTINUE;
}
public OnEntityRemove(const ent)
{
if (!is_entity(ent))
return HC_CONTINUE;
static classname[32];
get_entvar(ent, var_classname, classname, charsmax(classname));
if (equal(classname, "weaponbox"))
{
if (g_iWeaponCount > 0)
g_iWeaponCount--;
}
if (g_iEdictCount > 0)
g_iEdictCount--;
return HC_CONTINUE;
}
public CleanupWeapons()
{
new ent = -1;
new Float:time = get_gametime();
new Float:lifetime = get_pcvar_float(g_pWeaponLife);
while ((ent = rg_find_ent_by_class(ent, "weaponbox")))
{
if (!is_entity(ent))
continue;
if (IsC4(ent))
continue;
new Float:spawn;
get_entvar(ent, var_fuser1, spawn);
if (spawn == 0.0)
{
set_entvar(ent, var_fuser1, time);
continue;
}
if ((time - spawn) > lifetime)
{
rg_remove_entity(ent);
}
}
}
public FullSync()
{
new ent = -1;
g_iWeaponCount = 0;
g_iEdictCount = 0;
while ((ent = rg_find_ent_by_class(ent, "*")))
{
if (!is_entity(ent))
continue;
g_iEdictCount++;
static classname[32];
get_entvar(ent, var_classname, classname, charsmax(classname));
if (equal(classname, "weaponbox") && !IsC4(ent))
{
g_iWeaponCount++;
}
}
if (get_pcvar_num(g_pDebug))
{
server_print("[GUARD] Edicts: %d | Weapons: %d", g_iEdictCount, g_iWeaponCount);
}
}
public OnRoundEnd()
{
g_iWeaponCount = 0;
}
stock bool:IsRemovable(const classname[])
{
if (equal(classname, "weaponbox")) return true;
if (equal(classname, "armoury_entity")) return true;
if (equal(classname, "grenade")) return true;
return false;
}
stock bool:IsC4(ent)
{
static model[64];
get_entvar(ent, var_model, model, charsmax(model));
return containi(model, "c4") != -1;
}
#17
Napisano 30.03.2026 13:31
Spróbujemy to ugryźć inaczejguard_max_weapons "20" - maksymalna ilość broni na mapie // 20 - NS // 25 - Maksymalne dla stabilności // 30 - ryzyko crasha guard_weapon_life "10.0" - czas "życia" broni na ziemi // 10.0 - agresywne usuwanie // 15.0 - optymalne / stabline // 30.0 - długie, możliwy crash guard_max_edicts "900" - maksymalna ilośc encji na serwerze // 850 - bezpieczen / stabilne // 900 - optymalne / stabilne // 1000 - ryzykowne przy NS guard_safe_margin "100" - buffor bezpieczeństwa, plugin nie czeka az osiągniesz wartość z guard_max_edicts tylko reaguje odpowiednio wcześniej // 50 - pozna reakcja, możliwe ryzyko crasha // 100 - optymalne / stabilne // 150 - bezpieczne / stabilne // // dokładnie działa to tak [ guard_max_edicts - guard_safe_margin ] guard_debug "0" - debuger // 0 - off // 1 - on // loguje do konsoli co robi plugin oraz dodatkowo co spamuje enitami z innych pluginów#include <amxmodx> #include <reapi> #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_pSafeMargin; new g_pDebug; new g_iWeaponCount; new g_iEdictCount; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); g_pMaxWeapons = register_cvar("guard_max_weapons", "25"); g_pWeaponLife = register_cvar("guard_weapon_life", "15.0"); g_pMaxEdicts = register_cvar("guard_max_edicts", "900"); g_pSafeMargin = register_cvar("guard_safe_margin", "50"); g_pDebug = register_cvar("guard_debug", "0"); RegisterHookChain(RG_CBasePlayer_DropPlayerItem, "OnDrop", false); RegisterHookChain(RG_CreateEntity, "OnEntityCreate", false); RegisterHookChain(RG_RemoveEntity, "OnEntityRemove", true); RegisterHookChain(RG_RoundEnd, "OnRoundEnd", true); set_task(1.0, "CleanupWeapons", _, _, _, "b"); set_task(3.0, "FullSync", _, _, _, "b"); } public plugin_cfg() { FullSync(); } public OnDrop(const id, const char[] item) { if (!is_user_alive(id)) return HC_CONTINUE; new max = get_pcvar_num(g_pMaxWeapons); if (g_iWeaponCount >= max) { if (get_pcvar_num(g_pDebug)) client_print(id, print_center, "[GUARD] Limit broni!"); return HC_SUPERCEDE; } return HC_CONTINUE; } public OnEntityCreate(const ent, const char[] classname[]) { if (!ent) return HC_CONTINUE; new maxEdicts = get_pcvar_num(g_pMaxEdicts); new margin = get_pcvar_num(g_pSafeMargin); if (g_iEdictCount >= (maxEdicts - margin)) { if (IsRemovable(classname)) { if (get_pcvar_num(g_pDebug)) server_print("[GUARD] BLOCK ENTITY: %s", classname); return HC_SUPERCEDE; } } if (equal(classname, "weaponbox")) { new maxWeapons = get_pcvar_num(g_pMaxWeapons); if (g_iWeaponCount >= maxWeapons) { if (get_pcvar_num(g_pDebug)) server_print("[GUARD] BLOCK WEAPONBOX"); return HC_SUPERCEDE; } g_iWeaponCount++; } g_iEdictCount++; return HC_CONTINUE; } public OnEntityRemove(const ent) { if (!is_entity(ent)) return HC_CONTINUE; static classname[32]; get_entvar(ent, var_classname, classname, charsmax(classname)); if (equal(classname, "weaponbox")) { if (g_iWeaponCount > 0) g_iWeaponCount--; } if (g_iEdictCount > 0) g_iEdictCount--; return HC_CONTINUE; } public CleanupWeapons() { new ent = -1; new Float:time = get_gametime(); new Float:lifetime = get_pcvar_float(g_pWeaponLife); while ((ent = rg_find_ent_by_class(ent, "weaponbox"))) { if (!is_entity(ent)) continue; if (IsC4(ent)) continue; new Float:spawn; get_entvar(ent, var_fuser1, spawn); if (spawn == 0.0) { set_entvar(ent, var_fuser1, time); continue; } if ((time - spawn) > lifetime) { rg_remove_entity(ent); } } } public FullSync() { new ent = -1; g_iWeaponCount = 0; g_iEdictCount = 0; while ((ent = rg_find_ent_by_class(ent, "*"))) { if (!is_entity(ent)) continue; g_iEdictCount++; static classname[32]; get_entvar(ent, var_classname, classname, charsmax(classname)); if (equal(classname, "weaponbox") && !IsC4(ent)) { g_iWeaponCount++; } } if (get_pcvar_num(g_pDebug)) { server_print("[GUARD] Edicts: %d | Weapons: %d", g_iEdictCount, g_iWeaponCount); } } public OnRoundEnd() { g_iWeaponCount = 0; } stock bool:IsRemovable(const classname[]) { if (equal(classname, "weaponbox")) return true; if (equal(classname, "armoury_entity")) return true; if (equal(classname, "grenade")) return true; return false; } stock bool:IsC4(ent) { static model[64]; get_entvar(ent, var_model, model, charsmax(model)); return containi(model, "c4") != -1; }
majster skąd te eventy wziąłeś? bo bym sam skorzystał
#18
Napisano 30.03.2026 16:05
Z Piątnicy no bo skąd 🙈🤣majster skąd te eventy wziąłeś? bo bym sam skorzystał
A tak serio: https://github.com/r...ripting/include
#19
Napisano 30.03.2026 16:12
No tylko nie istnieje RG_CreateEntity tak samo RG_RemoveEntity
Natywy owszem
/* * Creates an entity using Counter-Strike's custom CreateNamedEntity wrapper. * * @param classname Entity classname * @param useHashTable Use this only for known game entities * @note: Do not use this if you plan to change custom classname an entity after creation, * otherwise it will never be release from hash table even if an entity was destroyed, * and that to lead table to inflate/memory leaks * * @return Index of the created entity or 0 otherwise */ native rg_create_entity(const classname[], const bool:useHashTable = false);
/* * Removes an entity using gamedll's UTIL_Remove function, which sets a frame delay to ensure its removal. * * @param pEntity Entity index to remove * * @return 1 on success, 0 otherwise */ native rg_remove_entity(const pEntity);
AI się nie spisało chyba ![]()
Użytkownik Boziak edytował ten post 30.03.2026 16:15
#20
Napisano 30.03.2026 16:42
No tylko nie istnieje RG_CreateEntity tak samo RG_RemoveEntity
Natywy owszem
/** Creates an entity using Counter-Strike's custom CreateNamedEntity wrapper.** @param classname Entity classname* @param useHashTable Use this only for known game entities* @note: Do not use this if you plan to change custom classname an entity after creation,* otherwise it will never be release from hash table even if an entity was destroyed,* and that to lead table to inflate/memory leaks** @return Index of the created entity or 0 otherwise*/native rg_create_entity(const classname[], const bool:useHashTable = false);/** Removes an entity using gamedll's UTIL_Remove function, which sets a frame delay to ensure its removal.** @param pEntity Entity index to remove** @return 1 on success, 0 otherwise*/native rg_remove_entity(const pEntity);AI się nie spisało chyba
Fajnie by bylo miec dostęp do AI w pracy
Jak u mnie nawet notatnik jest zablokowany
Użytkownicy przeglądający ten temat: 3
0 użytkowników, 3 gości, 0 anonimowych


Dodatki SourceMod













