merhaba
Ekranda C4 ün hangi bölgeye kuruldugunu gösteren bi eklenti varmıdır
resim olarak ekledim yardımcı olursanız sevinirim iyi forumlar
Konu
https://www.webailesi.com/konu-bomba-kurulu-yeri-bildir-34571 biraz araştirma yapin.
ZebaniBey
https://www.webailesi.com/konu-c4-konum-gosterme-eklentisi-29881 Bu daha çok iş görmez mi hocam bi bak istersen
Son Düzenleme: 16-09-2025, 15:54, Düzenleyen: kage.
PHP Kod:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#define PLUGIN_NAME "Bomba kurulu yeri goster"
#define PLUGIN_VERSION "1.1.1"
#define PLUGIN_AUTHOR "Osmanbnm"
#define MAX_PLAYERS 32
#define MAX_ZONES 8
new pcv_enable;
new pcv_tag;
new g_zoneEnts[MAX_ZONES];
new Float:g_zoneCenter[MAX_ZONES][3];
new g_zoneLetter[MAX_ZONES];
new g_zoneCount;
new g_playerZone[MAX_PLAYERS + 1];
new g_lastPlanter;
new bool:g_sitesFinalized;
stock detect_letter_from_string(const s[])
{
new up[128];
copy(up, charsmax(up), s);
strtoupper(up);
if (contain(up, "BOMBSITE A") != -1 || contain(up, "BOMB SITE A") != -1 || contain(up, "BOMB A") != -1 || contain(up, "SITE A") != -1)
return 'A';
if (contain(up, "BOMBSITE B") != -1 || contain(up, "BOMB SITE B") != -1 || contain(up, "BOMB B") != -1 || contain(up, "SITE B") != -1)
return 'B';
new len = strlen(up);
new bool:hasA = (contain(up, " A") != -1) || (len > 0 && (up[0] == 'A' || up[len-1] == 'A')) || (contain(up, "_A") != -1) || (contain(up, "-A") != -1);
new bool:hasB = (contain(up, " B") != -1) || (len > 0 && (up[0] == 'B' || up[len-1] == 'B')) || (contain(up, "_B") != -1) || (contain(up, "-B") != -1);
if (hasA && !hasB) return 'A';
if (hasB && !hasA) return 'B';
return 0;
}
stock detect_letter_from_entity(ent)
{
new s[128], ch;
entity_get_string(ent, EV_SZ_targetname, s, charsmax(s));
if ((ch = detect_letter_from_string(s))) return ch;
entity_get_string(ent, EV_SZ_target, s, charsmax(s));
if ((ch = detect_letter_from_string(s))) return ch;
entity_get_string(ent, EV_SZ_netname, s, charsmax(s));
if ((ch = detect_letter_from_string(s))) return ch;
entity_get_string(ent, EV_SZ_message, s, charsmax(s));
if ((ch = detect_letter_from_string(s))) return ch;
return 0;
}
stock get_brush_center(ent, Float:outCenter[3])
{
new Float:mins[3], Float:maxs[3];
entity_get_vector(ent, EV_VEC_absmin, mins);
entity_get_vector(ent, EV_VEC_absmax, maxs);
outCenter[0] = (mins[0] + maxs[0]) * 0.5;
outCenter[1] = (mins[1] + maxs[1]) * 0.5;
outCenter[2] = (mins[2] + maxs[2]) * 0.5;
}
stock zone_index_by_ent(ent)
{
for (new i = 0; i < g_zoneCount; i++)
{
if (g_zoneEnts[i] == ent)
return i + 1;
}
return 0;
}
stock bool:is_valid_player(id) { return (id >= 1 && id <= MAX_PLAYERS) && is_user_connected(id); }
stock scan_bombsites()
{
g_zoneCount = 0;
g_sitesFinalized = false;
arrayset(g_zoneEnts, 0, sizeof g_zoneEnts);
arrayset(g_zoneLetter, 0, sizeof g_zoneLetter);
for (new i = 0; i < MAX_ZONES; i++)
{
g_zoneCenter[i][0] = 0.0;
g_zoneCenter[i][1] = 0.0;
g_zoneCenter[i][2] = 0.0;
}
new ent = 0;
while ((ent = find_ent_by_class(ent, "func_bomb_target")) && g_zoneCount < MAX_ZONES)
{
g_zoneEnts[g_zoneCount] = ent;
get_brush_center(ent, g_zoneCenter[g_zoneCount]);
g_zoneLetter[g_zoneCount] = detect_letter_from_entity(ent);
g_zoneCount++;
}
ent = 0;
while ((ent = find_ent_by_class(ent, "info_bomb_target")) && g_zoneCount < MAX_ZONES)
{
g_zoneEnts[g_zoneCount] = ent;
entity_get_vector(ent, EV_VEC_origin, g_zoneCenter[g_zoneCount]);
g_zoneLetter[g_zoneCount] = detect_letter_from_entity(ent);
g_zoneCount++;
}
finalize_site_letters();
}
stock finalize_site_letters()
{
if (g_zoneCount == 0) { g_sitesFinalized = true; return; }
new haveA = -1, haveB = -1;
for (new i = 0; i < g_zoneCount; i++)
{
if (g_zoneLetter[i] == 'A') haveA = i;
if (g_zoneLetter[i] == 'B') haveB = i;
}
if (haveA != -1 && haveB != -1) { g_sitesFinalized = true; return; }
if (g_zoneCount == 1)
{
g_zoneLetter[0] = 'A';
g_sitesFinalized = true;
return;
}
if (g_zoneCount >= 2 && haveA == -1 && haveB == -1)
{
new i1 = 0, i2 = 1;
if (g_zoneCenter[i2][0] < g_zoneCenter[i1][0]
|| (floatabs(g_zoneCenter[i2][0] - g_zoneCenter[i1][0]) < 0.001 && g_zoneCenter[i2][1] < g_zoneCenter[i1][1]))
{
new tmp = i1; i1 = i2; i2 = tmp;
}
g_zoneLetter[i1] = 'A';
g_zoneLetter[i2] = 'B';
g_sitesFinalized = true;
return;
}
if (haveA != -1 && haveB == -1)
{
new idxB = find_other_closest(haveA);
if (idxB != -1) g_zoneLetter[idxB] = 'B';
g_sitesFinalized = true;
return;
}
if (haveB != -1 && haveA == -1)
{
new idxA = find_other_closest(haveB);
if (idxA != -1) g_zoneLetter[idxA] = 'A';
g_sitesFinalized = true;
return;
}
g_sitesFinalized = true;
}
stock Float:vec_distance(const Float:a[3], const Float:b[3])
{
new Float:dx = a[0] - b[0];
new Float:dy = a[1] - b[1];
new Float:dz = a[2] - b[2];
return floatsqroot(dx*dx + dy*dy + dz*dz);
}
stock find_other_closest(refIdx)
{
new best = -1;
new Float:bestDist = 9999999.9;
for (new i = 0; i < g_zoneCount; i++)
{
if (i == refIdx) continue;
new Float:d = vec_distance(g_zoneCenter[refIdx], g_zoneCenter[i]);
if (d < bestDist)
{
bestDist = d;
best = i;
}
}
return best;
}
stock nearest_zone_to_player(id)
{
if (!is_valid_player(id) || g_zoneCount == 0) return -1;
new Float:origin[3];
entity_get_vector(id, EV_VEC_origin, origin);
new best = -1;
new Float:bestDist = 9999999.9;
for (new i = 0; i < g_zoneCount; i++)
{
new Float:d = vec_distance(origin, g_zoneCenter[i]);
if (d < bestDist)
{
bestDist = d;
best = i;
}
}
return best;
}
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
pcv_enable = register_cvar("wai_bombsite_info", "1");
pcv_tag = register_cvar("wai_tag", "[WebAilesi]");
scan_bombsites();
register_event("BarTime", "ev_BarTime_Plant", "be", "1=3");
register_event("SendAudio", "ev_Bomb_Planted", "a", "2&%!MRAD_BOMBPL");
register_touch("func_bomb_target", "player", "fw_Touch_BombTarget");
register_event("DeathMsg", "ev_DeathMsg", "a");
register_logevent("ev_RoundStart", 2, "1=Round_Start");
register_logevent("ev_GameCommencing", 2, "1=Game_Commencing");
}
public ev_RoundStart()
{
g_lastPlanter = 0;
arrayset(g_playerZone, 0, sizeof g_playerZone);
}
public ev_GameCommencing()
{
g_lastPlanter = 0;
arrayset(g_playerZone, 0, sizeof g_playerZone);
}
public client_disconnected(id)
{
if (!is_valid_player(id)) return;
g_playerZone[id] = 0;
if (g_lastPlanter == id) g_lastPlanter = 0;
}
public ev_DeathMsg()
{
new id = read_data(2);
if (is_valid_player(id))
{
g_playerZone[id] = 0;
if (g_lastPlanter == id) g_lastPlanter = 0;
}
}
public fw_Touch_BombTarget(ent, id)
{
if (!is_valid_player(id) || !ent) return;
new idx = zone_index_by_ent(ent);
if (idx) g_playerZone[id] = idx;
}
public ev_BarTime_Plant(id)
{
if (!get_pcvar_num(pcv_enable)) return;
if (!is_valid_player(id)) return;
g_lastPlanter = id;
}
public ev_Bomb_Planted()
{
if (!get_pcvar_num(pcv_enable)) return;
new tag[32];
get_pcvar_string(pcv_tag, tag, charsmax(tag));
new zoneIdx = -1;
new letter = 0;
if (is_valid_player(g_lastPlanter))
{
new lastTouch = g_playerZone[g_lastPlanter];
if (lastTouch >= 1 && lastTouch <= g_zoneCount) zoneIdx = lastTouch - 1;
else zoneIdx = nearest_zone_to_player(g_lastPlanter);
}
else
{
if (g_zoneCount >= 1) zoneIdx = 0;
}
if (zoneIdx != -1) letter = g_zoneLetter[zoneIdx];
set_dhudmessage(200, 200, 200, -1.0, 0.20, 0, _, 5.0);
if (letter == 'A' || letter == 'B')
show_dhudmessage(0, "Bomba %s bölgesine kuruldu!", (letter == 'A') ? "A" : "B");
else
show_dhudmessage(0, "Bomba Kuruldu!");
g_lastPlanter = 0;
}
public plugin_cfg()
{
if (!g_sitesFinalized) finalize_site_letters();
}
İstek konusu, @Lynchk adlı kullanıcı tarafından 8 saat içinde çözülmüştür.
İsteği çözdüğü için Lynchk Adlı kullanıcıya 1 rep puanı ve 1 yardım etme puanı otomatik olarak verilmiştir.
Lynchk Adlı kullanıcı sizin dışınızda toplam 1077 kişiye yardım etmiştir.
Herhangi bir konuda hata olduğunu düşünüyorsanız destek sistemi üzerinden iletişim kurabilirsiniz.
İsteği çözdüğü için Lynchk Adlı kullanıcıya 1 rep puanı ve 1 yardım etme puanı otomatik olarak verilmiştir.
Lynchk Adlı kullanıcı sizin dışınızda toplam 1077 kişiye yardım etmiştir.
Herhangi bir konuda hata olduğunu düşünüyorsanız destek sistemi üzerinden iletişim kurabilirsiniz.
Benzer Konular
Yorum
1.459
Okunma
02-05-2026, 15:48
Yorum
1.305
Okunma
12-04-2026, 22:45
Yorum
7.743
Okunma
18-04-2025, 23:22
Yorum
8.745
Okunma
)

