Merhabalar
bu maç botuna pause unpause eklemek mümkün mü veya ayrı bir eklenti olarakta yapabilabilir maç esnasında gerektiği zaman oyunu durduramıyoruz sorun oluyor.
bot2.sma(Dosya Boyutu: 120,26 KB | İndirme Sayısı: 3))

#include <amxmodx>
#include <reapi>
// List of client commands to use pause feature
new const CLCMDS[][] = {
"say !pause",
"say .pause",
"say /pause"
}
// Create config with cvars in 'configs/plugins', and execute it?
//#define AUTO_CFG
stock const SOUND__ERROR[] = "sound/buttons/button2.wav"
stock const SOUND__BELL1[] = "sound/buttons/bell1.wav"
stock const SOUND__BLIP2[] = "sound/buttons/blip2.wav"
#define FREEZETIME_NOT_SET -1
enum _:CVAR_ENUM {
CVAR__PAUSABLE,
CVAR__PAUSE_TIME,
CVAR__PAUSE_COOLDOWN
}
new g_eCvar[CVAR_ENUM]
new g_pFreezeTime
new bool:g_bNeedPause
new g_iOldFreezeTime = FREEZETIME_NOT_SET
new HookChain:g_hRestartPost
new g_iPauseTime
public plugin_init() {
register_plugin("Say Pause", "1.0.", "Mr.Commander")
//register_dictionary("say_pause.txt")
bind_cvar_num("pause_available", "2", .desc = "Is pausing available (1/0) ?", .bind = g_eCvar[CVAR__PAUSABLE])
bind_cvar_num("pause_duration", "60", .desc = "Pause duration in seconds", .bind = g_eCvar[CVAR__PAUSE_TIME])
bind_cvar_num("pause_cooldown", "120", .desc = "Pause usage cooldown in seconds", .bind = g_eCvar[CVAR__PAUSE_COOLDOWN])
/*#if defined AUTO_CFG
AutoExecConfig()
#endif*/
RegisterHookChain(RG_CSGameRules_RestartRound, "CSGameRules_RestartRound_Pre")
g_hRestartPost = RegisterHookChain(RG_CSGameRules_RestartRound, "CSGameRules_RestartRound_Post", true)
DisableHookChain(g_hRestartPost)
g_pFreezeTime = get_cvar_pointer("mp_freezetime")
for(new i; i < sizeof(CLCMDS); i++) {
register_clcmd(CLCMDS[i], "clcmd_SayPause")
}
}
public clcmd_SayPause(pPlayer) {
if(!g_eCvar[CVAR__PAUSABLE]) {
rg_send_audio(pPlayer, SOUND__ERROR)
client_print_color(pPlayer, print_team_red,"^1[^3csd^1] ^3* ^1Duraklatma su anda kullanilamaz!")
return PLUGIN_HANDLED
}
if(g_bNeedPause) {
rg_send_audio(pPlayer, SOUND__ERROR)
client_print_color(pPlayer, print_team_red,"^1[^3csd^1] ^3* ^1Pause zaten alindi!")
return PLUGIN_HANDLED
}
new iSeconds = get_systime() - g_iPauseTime
if(g_iPauseTime && iSeconds < g_eCvar[CVAR__PAUSE_COOLDOWN]) {
iSeconds = g_eCvar[CVAR__PAUSE_COOLDOWN] - iSeconds
rg_send_audio(pPlayer, SOUND__ERROR)
client_print_color(pPlayer, print_team_red,"^1[^3csd^1] ^3* ^1Pause su sure kadar gecerli olacak^4 %02d:%02d", iSeconds / 60, iSeconds % 60)
return PLUGIN_HANDLED
}
g_bNeedPause = true
rg_send_audio(0, SOUND__BELL1)
client_print_color(0, pPlayer, "%l", LANG_PLAYER, "^1[^3csd^1] ^4* ^1Oyuncu ^3%n ^1pause istedi ^4%i sn. ^1sonraki turda aktif olacak!", pPlayer, g_eCvar[CVAR__PAUSE_TIME])
return PLUGIN_HANDLED
}
public CSGameRules_RestartRound_Pre() {
if(!g_bNeedPause) {
return
}
g_bNeedPause = false
if(!g_eCvar[CVAR__PAUSABLE] || g_eCvar[CVAR__PAUSE_TIME] < 1) {
return
}
g_iPauseTime = get_systime()
rg_send_audio(0, SOUND__BLIP2)
client_print_color(0, print_team_default, "%l", LANG_PLAYER, "^1[^3csd^1] ^4* ^1Dikkat! Pause ^4%i sec.", g_eCvar[CVAR__PAUSE_TIME])
g_iOldFreezeTime = get_pcvar_num(g_pFreezeTime)
set_pcvar_num(g_pFreezeTime, g_eCvar[CVAR__PAUSE_TIME])
EnableHookChain(g_hRestartPost)
}
public CSGameRules_RestartRound_Post() {
DisableHookChain(g_hRestartPost)
set_pcvar_num(g_pFreezeTime, g_iOldFreezeTime)
g_iOldFreezeTime = FREEZETIME_NOT_SET
}
// Some mapchoosers can change map in RestartRound Pre, so we need to cover it
public plugin_end() {
if(g_iOldFreezeTime != FREEZETIME_NOT_SET) {
set_pcvar_num(g_pFreezeTime, g_iOldFreezeTime)
}
}
stock bind_cvar_num(const cvar[], const value[], flags = FCVAR_NONE, const desc[] = "", bool:has_min = false, Float:min_val = 0.0, bool:has_max = false, Float:max_val = 0.0, &bind) {
bind_pcvar_num(create_cvar(cvar, value, flags, desc, has_min, min_val, has_max, max_val), bind)
}
(27-03-2025, 05:06)Mr.Commander Adlı Kullanıcıdan Alıntı:Merhaba,PHP Kod:#include <amxmodx>
#include <reapi>
// List of client commands to use pause feature
new const CLCMDS[][] = {
"say !pause",
"say .pause",
"say /pause"
}
// Create config with cvars in 'configs/plugins', and execute it?
//#define AUTO_CFG
stock const SOUND__ERROR[] = "sound/buttons/button2.wav"
stock const SOUND__BELL1[] = "sound/buttons/bell1.wav"
stock const SOUND__BLIP2[] = "sound/buttons/blip2.wav"
#define FREEZETIME_NOT_SET -1
enum _:CVAR_ENUM {
CVAR__PAUSABLE,
CVAR__PAUSE_TIME,
CVAR__PAUSE_COOLDOWN
}
new g_eCvar[CVAR_ENUM]
new g_pFreezeTime
new bool:g_bNeedPause
new g_iOldFreezeTime = FREEZETIME_NOT_SET
new HookChain:g_hRestartPost
new g_iPauseTime
public plugin_init() {
register_plugin("Say Pause", "1.0.", "Mr.Commander")
//register_dictionary("say_pause.txt")
bind_cvar_num("pause_available", "2", .desc = "Is pausing available (1/0) ?", .bind = g_eCvar[CVAR__PAUSABLE])
bind_cvar_num("pause_duration", "60", .desc = "Pause duration in seconds", .bind = g_eCvar[CVAR__PAUSE_TIME])
bind_cvar_num("pause_cooldown", "120", .desc = "Pause usage cooldown in seconds", .bind = g_eCvar[CVAR__PAUSE_COOLDOWN])
/*#if defined AUTO_CFG
AutoExecConfig()
#endif*/
RegisterHookChain(RG_CSGameRules_RestartRound, "CSGameRules_RestartRound_Pre")
g_hRestartPost = RegisterHookChain(RG_CSGameRules_RestartRound, "CSGameRules_RestartRound_Post", true)
DisableHookChain(g_hRestartPost)
g_pFreezeTime = get_cvar_pointer("mp_freezetime")
for(new i; i < sizeof(CLCMDS); i++) {
register_clcmd(CLCMDS[i], "clcmd_SayPause")
}
}
public clcmd_SayPause(pPlayer) {
if(!g_eCvar[CVAR__PAUSABLE]) {
rg_send_audio(pPlayer, SOUND__ERROR)
client_print_color(pPlayer, print_team_red,"^1[^3csd^1] ^3* ^1Duraklatma su anda kullanilamaz!")
return PLUGIN_HANDLED
}
if(g_bNeedPause) {
rg_send_audio(pPlayer, SOUND__ERROR)
client_print_color(pPlayer, print_team_red,"^1[^3csd^1] ^3* ^1Pause zaten alindi!")
return PLUGIN_HANDLED
}
new iSeconds = get_systime() - g_iPauseTime
if(g_iPauseTime && iSeconds < g_eCvar[CVAR__PAUSE_COOLDOWN]) {
iSeconds = g_eCvar[CVAR__PAUSE_COOLDOWN] - iSeconds
rg_send_audio(pPlayer, SOUND__ERROR)
client_print_color(pPlayer, print_team_red,"^1[^3csd^1] ^3* ^1Pause su sure kadar gecerli olacak^4 %02d:%02d", iSeconds / 60, iSeconds % 60)
return PLUGIN_HANDLED
}
g_bNeedPause = true
rg_send_audio(0, SOUND__BELL1)
client_print_color(0, pPlayer, "%l", LANG_PLAYER, "^1[^3csd^1] ^4* ^1Oyuncu ^3%n ^1pause istedi ^4%i sn. ^1sonraki turda aktif olacak!", pPlayer, g_eCvar[CVAR__PAUSE_TIME])
return PLUGIN_HANDLED
}
public CSGameRules_RestartRound_Pre() {
if(!g_bNeedPause) {
return
}
g_bNeedPause = false
if(!g_eCvar[CVAR__PAUSABLE] || g_eCvar[CVAR__PAUSE_TIME] < 1) {
return
}
g_iPauseTime = get_systime()
rg_send_audio(0, SOUND__BLIP2)
client_print_color(0, print_team_default, "%l", LANG_PLAYER, "^1[^3csd^1] ^4* ^1Dikkat! Pause ^4%i sec.", g_eCvar[CVAR__PAUSE_TIME])
g_iOldFreezeTime = get_pcvar_num(g_pFreezeTime)
set_pcvar_num(g_pFreezeTime, g_eCvar[CVAR__PAUSE_TIME])
EnableHookChain(g_hRestartPost)
}
public CSGameRules_RestartRound_Post() {
DisableHookChain(g_hRestartPost)
set_pcvar_num(g_pFreezeTime, g_iOldFreezeTime)
g_iOldFreezeTime = FREEZETIME_NOT_SET
}
// Some mapchoosers can change map in RestartRound Pre, so we need to cover it
public plugin_end() {
if(g_iOldFreezeTime != FREEZETIME_NOT_SET) {
set_pcvar_num(g_pFreezeTime, g_iOldFreezeTime)
}
}
stock bind_cvar_num(const cvar[], const value[], flags = FCVAR_NONE, const desc[] = "", bool:has_min = false, Float:min_val = 0.0, bool:has_max = false, Float:max_val = 0.0, &bind) {
bind_pcvar_num(create_cvar(cvar, value, flags, desc, has_min, min_val, has_max, max_val), bind)
}
Maç sunucunuza bu eklentiyi ayrıca yükleyip dener misiniz ? /pause !pause ve .pause olarak çalıştırabilirsiniz.
olmadı