merhaba bir takımda 3 kişiden fazla kişinin awp almasını istemiyorum awp sınır yapabilcek var mı oyt serveri için
awp sınır
)

#pragma semicolon 1
#include <amxmodx>
#include <reapi>
#include <cstrike>
//#define ADMIN_AWP_ETKILENMEZ ADMIN_RCON //
new g_iMaxAwpinRound[33], g_iCvar; // 32 oyuncu + 1 takım değişkeni
public plugin_init() {
register_plugin("Awp Siniri", "0.0.1", "PurposeLess");
RegisterHookChain(RG_BuyWeaponByWeaponID, "@BuyWeaponByWeaponID_Pre", .post = false);
RegisterHookChain(RG_CSGameRules_RestartRound, "@CSGameRules_RestartRound_Pre", .post = false);
bind_pcvar_num(create_cvar("max_awp_in_round", "2"), g_iCvar);
register_clcmd("say /awp", "CmdSayAwp"); // /awp komutu için kayıt
}
@BuyWeaponByWeaponID_Pre(const pPlayer, const WeaponIdType:weaponID) {
if (weaponID != WEAPON_AWP) {
return HC_CONTINUE;
}
#if defined ADMIN_AWP_ETKILENMEZ
if (get_user_flags(pPlayer) & ADMIN_AWP_ETKILENMEZ) {
return HC_CONTINUE;
}
#endif
new iTeam = get_user_team(pPlayer); // Oyuncunun takımını al
if (g_iMaxAwpinRound[iTeam] >= get_pcvar_num(g_iCvar)) {
client_print_color(pPlayer, pPlayer, "^3Takimca bir roundda maksimum^1 %i ^4awp alinabilirsiniz", get_pcvar_num(g_iCvar));
// Sohbette diğer oyunculara sınırın aşıldığını bildirme
new szName[32];
get_user_name(pPlayer, szName, sizeof(szName));
client_print_color(0, print_chat, "^1%s ^3fazla awp aldı!", szName);
SetHookChainReturn(ATYPE_INTEGER, false);
return HC_SUPERCEDE;
}
g_iMaxAwpinRound[iTeam]++;
return HC_CONTINUE;
}
@CSGameRules_RestartRound_Pre() {
for (new i = 0; i < 33; i++) {
g_iMaxAwpinRound[i] = 0;
}
}
// /awp komutu ile AWP alan oyuncuları gösterir
public CmdSayAwp(id) {
new szOutput[256];
format(szOutput, sizeof(szOutput), "^4AWP alan oyuncular:");
for (new i = 1; i <= get_maxplayers(); i++) {
if (is_user_connected(i) && is_user_alive(i)) {
new iTeam = get_user_team(i);
if (g_iMaxAwpinRound[iTeam] > 0) {
new szName[32];
get_user_name(i, szName, sizeof(szName));
format(szOutput, sizeof(szOutput), "%s ^1%s,", szOutput, szName);
}
}
}
client_print_color(id, print_chat, "%s", szOutput);
return PLUGIN_HANDLED;
}