Hiçbir şekilde log, hata kaydı oluşmuyor sunucuda. Direkt kapanıyor. Bazı eklentileri açtım-kapattım denedim.
Bir rekabetçi eklentisi var, eklenti round sayısı 30'a ulaşınca map oylaması yapıyor. Oyunda user var ve seçim yapıyorsa devam ediyor.
Diğer türlü kimse yoksa, map değişmiyor sunucu kapanıyor.
Eklenti aşağıdaki gibidir.
Kod: Tümünü seç
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#include <fakemeta>
#define MAX_MAP 250
#define TimeVote 30
#define VOTE_TIME 5.0 // Map suresi 1.75(1dk45sn) olarak hesaplanir.
#define MSG_TIME 1.0 // TakimDegisti mesaji
#define RS_TIME 15.0 // Reset
#if AMXX_VERSION_NUM > 182
#define client_disconnect client_disconnected
#endif
new const VOTE_YETKI = ADMIN_MAP;
new
PLUGIN[] = "Rekabetci Mod",
AUTHOR[] = "-CSmiLeFaCe, Server",
VERSION[] = "v0.1",
SERVER[] = "Server",
CONFIGYOLU[] = "map_choose",
INI_ISMI[] = "maps.ini",
INI_ISMI_MINI[] = "minimaps.ini",
rekabetcimod,
rekabetcitur,
sv_minplayers,
adminvote,
bilgilendirme = 0,
girdi = 0,
round = 0,
el = 0,
players[32],
g_iTimerVote[33],
g_iPlayerProcc,
g_LastRound = 0,
Float:g_iLastSec[33],
bool:g_Vote,
bool:b_HasAlreadyVoted[33],
iAllVoted,
sonuc,
SmiLe[MAX_MAP][250],
configsdir[250],
komutdosyasi[250],
CSmiLeFaCe[MAX_MAP][250],
CSmiLeFaCee,FaCe[6],
LeFa[6],
bironcekiharita,
bironcekiharitacevir[32],
ondanbironcekiharita,
ondanbironcekiharitacevir[32],
ondanbirbironcekiharita,
ondanbirbironcekiharitacevir[32],
inum;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
// Cvar Kaydi
rekabetcimod = register_cvar("rekabetci_mod","1"); // Rekabetci mod aciksa bazi eklentiler stop edilir
rekabetcitur = register_cvar("rekabetci_tur","0"); // 1. olunca ikinci 15 round baslar. Reset Gelir
sv_minplayers = register_cvar("rekabetci_minplayers","15"); // Bu kadar kisi altindaysa mapi cevir specbot dahil
adminvote = register_cvar("rekabetci_vote","0"); // Admin oylama baslatirsa cvar degisecek.
register_menucmd(register_menuid("VoteMenu"), 1023, "ActionVoteMenu");
register_clcmd("say /oylama", "Oylama");
// Logevent Event
register_event( "TextMsg","Restart","a","2=#Game_will_restart_in","2=#Game_Commencing" );
register_event( "HLTV", "RoundStart", "a", "1=0", "2=0" );
register_logevent("RoundEnd", 2, "1=Round_End");
bironcekiharita = register_cvar("csm_bironcekiharita","YOK")
get_pcvar_string(bironcekiharita,bironcekiharitacevir,31)
ondanbironcekiharita = register_cvar("csm_ondanbironcekiharita","YOK")
get_pcvar_string(ondanbironcekiharita,ondanbironcekiharitacevir,31)
ondanbirbironcekiharita = register_cvar("csm_ondanbirbironcekiharita","YOK")
get_pcvar_string(ondanbirbironcekiharita,ondanbirbironcekiharitacevir,31)
new suankimap[250];
get_mapname(suankimap,249);
set_cvar_string("csm_ondanbirbironcekiharita", ondanbironcekiharitacevir);
set_cvar_string("csm_ondanbironcekiharita", bironcekiharitacevir);
set_cvar_string("csm_bironcekiharita", suankimap);
set_task(45.0, "ClCmdVote", _, _, _, "d") //Buradaki 45 timeleft'in bitmesine kaç saniye kala çalışacağını gösterir.
register_cvar("amx_nextmap", "");
set_cvar_string("amx_nextmap", "");
if (get_pcvar_num(rekabetcimod) == 1)
{
set_cvar_float("mp_timelimit", 0.0);
}
}
public client_disconnect()
{
bilgilendirme = 0;
girdi = 0;
}
public client_putinserver(id)
{
GirdiBilgi(id);
}
public Restart()
{
if (get_pcvar_num(rekabetcitur) == 1)
{
el= 0;
}
else if (get_pcvar_num(rekabetcitur) == 0)
{
round = 0
el = 0
}
}
public RoundStart()
{
if (get_pcvar_num(rekabetcimod) == 1)
{
TurMesaji()
if(round == 30 )
{
set_task(VOTE_TIME, "ClCmdVote")
}
}
else if (get_pcvar_num(rekabetcimod) == 0 && bilgilendirme == 0 )
{
bilgilendirme = 1;
ChatColor(0, "!g[%s Rekabetci !t(KAPALI)!g]: !nRekabet modu kapali.Map degisimi icin surenin bitmesini bekliyoruz.",SERVER)
}
}
public RoundEnd()
{
el ++
round ++
if(g_LastRound == 30)
{
if(round == 30 || round > 30)
set_task(1.0, "changelevel");
}
else if(round == 15 )
{
teams_change();
set_task(MSG_TIME,"message");
set_task(RS_TIME,"restartround");
}
}
public teams_change()
{
get_players(players,inum)
for(new i;i<inum;i++)
{
switch(i)
{
case 0..6: set_task(0.1,"delayed_team_change",players[i])
case 7..14: set_task(0.2,"delayed_team_change",players[i])
case 15..22: set_task(0.3,"delayed_team_change",players[i])
case 23..31: set_task(0.4,"delayed_team_change",players[i])
}
}
server_cmd("amx_cvar rekabetci_tur 1");
}
public message()
{
ekran_mesaj_noktasi( 0, 255, 0, -1.0, -0.70, 2, 4.0, 11.0, 0.01, 1.5 );
ekran_mesaji(0, ">> %s <<^nILK TUR TAMAMLANDI^nAz bi'saniye sonra ikinci tur basliyor",SERVER);
ChatColor(0,"!g[%s]: !nIlk tur tamamlandi. Takimlar yer degistirildi.",SERVER);
ChatColor(0,"!g[%s]: !nIkinci tur basliyor hazirlanin.",SERVER);
}
public restartround()
{
ChatColor(0,"!g[%s]: !nIlk tur tamamlandi. Reset atiliyor. Takimlar yer degistirildi.",SERVER);
ChatColor(0,"!g[%s]: !nIkinci tur baslayacaktir.",SERVER);
server_cmd("amx_cvar sv_restartround 1")
set_task(3.0,"restartroundmessage");
}
public restartroundmessage()
{
ekran_mesaj_noktasi( 0, 255, 0, -1.0, -0.70, 2, 4.0, 11.0, 0.01, 1.5 );
ekran_mesaji(0, ">> %s <<^nIKINCI TUR BASLADI^n BASARILAR !!!",SERVER);
}
public delayed_team_change(id)
{
switch(cs_get_user_team(id))
{
case CS_TEAM_T:
{
cs_set_user_team(id,CS_TEAM_CT);
ExecuteHamB(Ham_CS_RoundRespawn,id);
}
case CS_TEAM_CT:
{
cs_set_user_team(id,CS_TEAM_T);
ExecuteHamB(Ham_CS_RoundRespawn,id);
}
case CS_TEAM_SPECTATOR:
{
cs_set_user_team(id,CS_TEAM_SPECTATOR);
}
}
}
public LoadMapsInVote()
{
new sv_totalplayer = get_playersnum(); // Sunucudaki oyuncu sayisi specbot dahil
get_configsdir(configsdir,249);
new szMapName[ 64 ];
get_mapname( szMapName, 63 );
new satirsayisi,sonuc;
if ( sv_totalplayer >= get_pcvar_num(sv_minplayers))
{
format(komutdosyasi,249,"%s/%s/%s",configsdir,CONFIGYOLU, INI_ISMI);
for(new i=0,deger;i<MAX_MAP;i++)
{
sonuc = read_file(komutdosyasi,i,SmiLe[i],249,satirsayisi);
if(sonuc != 0)
{
CSmiLeFaCee++;
CSmiLeFaCe[CSmiLeFaCee] = SmiLe[i];
deger++;
}
}
}
else if (sv_totalplayer < get_pcvar_num(sv_minplayers))
{
format(komutdosyasi,249,"%s/%s/%s",configsdir,CONFIGYOLU, INI_ISMI_MINI);
for(new i=0,deger;i<MAX_MAP;i++)
{
sonuc = read_file(komutdosyasi,i,SmiLe[i],249,satirsayisi);
if(sonuc != 0)
{
CSmiLeFaCee++;
CSmiLeFaCe[CSmiLeFaCee] = SmiLe[i];
deger++;
}
}
}
}
public Oylama(id)
{
new isim[35]
get_user_name(id,isim,35)
if(access(id,VOTE_YETKI))
{
ChatColor(0,"!g[%s]: !t%s !nisimli yetkili !gharita oylamasi !nbaslatti.",SERVER,isim);
server_cmd("amx_cvar rekabetci_vote 1")
set_task(VOTE_TIME, "ClCmdVote");
}
}
public ClCmdVote()
{
client_cmd(0, "spk Gman/gman_choose2")
set_cvar_float("mp_timelimit", 0.0)
startvote()
new yazi[256]
format(yazi, 255,"^nHarita Oylamasi Baslatiliyor.^nOylama Suresi: [%d Saniye]",TimeVote-10)
set_hudmessage(255, 255, 255, 0.0, 0.35, 2, 6.0, 5.0)
show_hudmessage(0, yazi)
set_task(1.0, "ValueVote", _, _, _, "a", 10);
}
public ValueVote()
{
new yazi[256]
format(yazi, 255,"^nHarita Oylamasi Baslatiliyor.^nOylama Suresi: [%d Saniye]",TimeVote-10)
static timer = 10
timer--
switch(timer)
{
case 0:
{
ChatColor(0, "!g[%s]: !nHarita oylamasi !gbasladi.", SERVER);
g_Vote = true;
FaCe[0] = 0;
FaCe[1] = 0;
FaCe[2] = 0;
FaCe[3] = 0;
FaCe[4] = 0;
arrayset(FaCe, 0, sizeof(FaCe));
arrayset(g_iTimerVote, TimeVote-10, 33);
arrayset(b_HasAlreadyVoted, false, 33);
set_task(float(TimeVote)-5, "endvote");
timer = 10;
set_cvar_string("amx_nextmap", "[Oylamada]");
}
default:
{
ChatColor(0, "!g[%s]: !nHarita oylamasinin baslamasina kalan saniye: !g%d", SERVER,timer);
}
}
}
public startvote()
{
CSmiLeFaCee = 0;
LoadMapsInVote()
new suankimap[250];
get_mapname(suankimap,249);
if(CSmiLeFaCee >= 6){
LeFa[0] = random_num(1,CSmiLeFaCee);
LeFa[1] = random_num(1,CSmiLeFaCee);
LeFa[2] = random_num(1,CSmiLeFaCee);
LeFa[3] = random_num(1,CSmiLeFaCee);
LeFa[4] = random_num(1,CSmiLeFaCee);
for(new i = 0;i<5;i++){
for(new j = 0;j<5;j++){
if(i == j)
continue;
if(LeFa[i] == LeFa[j] || equal(CSmiLeFaCe[LeFa[i]],suankimap) || equal(CSmiLeFaCe[LeFa[i]],bironcekiharitacevir)){
LeFa[i] = random_num(1,CSmiLeFaCee);
i = 0;}
}
}
}
return PLUGIN_HANDLED;
}
public ChooseMap(id)
{
if(!g_Vote)
return PLUGIN_CONTINUE;
if(b_HasAlreadyVoted[id]){
new yazi[256]
format(yazi, 255,"^nHarita Oylamasi icin kalan sure: %d saniye", g_iTimerVote[id])
for(new q; q < 5; q++)
{
format(yazi, 255,"%s^n%d. %s [Yuzde %d]",yazi,q+1, CSmiLeFaCe[LeFa[q]], FaCe[q] * g_iPlayerProcc)
}
format(yazi, 255,"%s^nGecerli oy sayisi [%d]",yazi,iAllVoted)
set_hudmessage(255, 255, 255, 0.0, 0.35, 0, 6.0, 1.0)
show_hudmessage(id, yazi)
return PLUGIN_HANDLED;
}
else{
new szMenu[512], iLen, iKey
iLen = format(szMenu[iLen], charsmax(szMenu)-iLen, "^n\yHarita Oylamasi icin kalan sure: \r%d \dsaniye", g_iTimerVote[id])
for(new q; q < 5; q++)
{
if(!b_HasAlreadyVoted[id])
iLen += format(szMenu[iLen], charsmax(szMenu)-iLen, "^n\r%d. \w%s \d[\yYuzde %d\d]",q+1, CSmiLeFaCe[LeFa[q]], FaCe[q] * g_iPlayerProcc)
}
if(!b_HasAlreadyVoted[id])
{
iKey |= MENU_KEY_0;
iLen += format(szMenu[iLen], charsmax(szMenu)-iLen, "^n^n\r0. \wOylamaya Katilma")
}
iLen += format(szMenu[iLen], charsmax(szMenu)-iLen, "^n^n\yGecerli oy sayisi: \r%d", iAllVoted)
iKey |= MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5
if(b_HasAlreadyVoted[id])
iKey &= ~(MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5);
show_menu(id, iKey, szMenu, -1, "VoteMenu");
return PLUGIN_HANDLED;
}
}
public ActionVoteMenu(id, iKey)
{
if(!g_Vote)
return PLUGIN_CONTINUE;
new szName[32]
get_user_name(id, szName, 31)
if(iKey == 9)
{
if(!b_HasAlreadyVoted[id])
ChatColor(0, "!g[%s]: !t%s isimli oyuncu !gharita oylamasina !nkatilmadi..", SERVER,szName);
b_HasAlreadyVoted[id] = true;
return PLUGIN_CONTINUE;
}
iAllVoted++;
FaCe[iKey]++
b_HasAlreadyVoted[id] = true;
ChatColor(0, "!g[%s]: !t%s isimli oyuncunun !nsectigi harita !g%s", SERVER,szName, CSmiLeFaCe[LeFa[iKey]]);
return PLUGIN_HANDLED;
}
public endvote()
{
new kazanan = LeFa[0], eniyiharita = FaCe[0];
for(new i = 0; i <5; i++){
if(FaCe[i] > eniyiharita){
kazanan = LeFa[i];
eniyiharita = FaCe[i];}
}
g_Vote = false;
if(!is_map_valid(CSmiLeFaCe[kazanan]))
{
FaCe[0] = 0;
FaCe[1] = 0;
FaCe[2] = 0;
FaCe[3] = 0;
FaCe[4] = 0;
iAllVoted = 0;
client_cmd(0, "spk Gman/gman_nowork")
set_task(5.0, "ClCmdVote");
ChatColor(0, "!g[%s]: !t%s !nisimli harita ^"!gmaps!n^" klasorunde yok. Oylama !gtekrar !nyapilacaktir.", SERVER,CSmiLeFaCe[kazanan]);
return PLUGIN_HANDLED;
}
ChatColor(0, "!g[%s]: !nSonraki Harita: !g%s", SERVER, CSmiLeFaCe[kazanan])
set_cvar_string("amx_nextmap", CSmiLeFaCe[kazanan]);
sonuc = kazanan;
if (get_pcvar_num(adminvote) == 1)
{
changelevel();
}
else if (get_pcvar_num(adminvote) == 0)
{
g_LastRound = 30;
set_dhudmessage( 0, 255, 0, -1.0, -0.70, 2, 4.0, 11.0, 0.01, 1.5 )
show_dhudmessage(0, ">> %s <<^nSonraki Harita: %s^nHarita 30. round sonunda degisecektir",SERVER,CSmiLeFaCe[kazanan])
}
return PLUGIN_HANDLED;
}
public changelevel()
{
set_cvar_float("mp_timelimit", 0.0);
new iNum, szPlayers[32];
get_players(szPlayers, iNum)
for(new i; i < iNum; i++)
{
client_cmd(szPlayers[i], "drop;wait;wait;wait;wait;wait;drop;wait;wait;wait;wait;wait;drop");
set_pev(szPlayers[i], pev_flags, pev(szPlayers[i], pev_flags) | FL_FROZEN)
}
set_task(3.5, "changelevel1");
set_task(6.0, "changelevel2");
}
public changelevel1()
{
new _modName[10]
get_modname(_modName, 9)
if (!equal(_modName, "zp"))
{
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()
}
}
public changelevel2()
{
server_cmd("changelevel %s", CSmiLeFaCe[sonuc]);
}
public client_PreThink(id)
{
if(!g_Vote)
return;
if(g_iTimerVote[id] <= -1)
return;
if(iAllVoted)
g_iPlayerProcc = 100 / iAllVoted;
else
g_iPlayerProcc = 0;
if((get_gametime() - g_iLastSec[id]) >= 1.0)
if(g_iTimerVote[id] != 0)
g_iTimerVote[id]--, ChooseMap(id), g_iLastSec[id] = get_gametime();
else
show_menu(id, 0, "^n"), g_iTimerVote[id] = -1;
}
public TurMesaji()
{
if (get_pcvar_num(rekabetcitur) == 1)
{
if (round == 30)
{
ChatColor(0, "!g[%s Rekabetci !t(2. Tur)!g]: !nRound sonunda harita degisiyor.",SERVER);
ChatColor(0, "!g[%s Rekabetci !t(2. Tur)!g]: !tTur: !g%d/15 !n- !tRound: !g%d/30",SERVER,el,round);
}
else
{
ChatColor(0, "!g[%s Rekabetci !t(2. Tur)!g]: !tTur: !g%d/15 !n- !tRound: !g%d/30",SERVER,el,round);
}
}
else
{
ChatColor(0, "!g[%s Rekabetci !t(1. Tur)!g]: !tTur: !g%d/15 !n- !tRound: !g%d/30",SERVER,el,round);
}
}
public GirdiBilgi(id)
{
if (get_pcvar_num(rekabetcitur) == 1 && girdi == 0)
{
if (round == 30)
{
ChatColor(id, "!g[%s Rekabetci !t(2. Tur)!g]: !nRound sonunda harita degisiyor.",SERVER);
ChatColor(id, "!g[%s Rekabetci !t(2. Tur)!g]: !tTur: !g%d/15 !n- !tRound: !g%d/30",SERVER,el,round);
girdi = 1;
}
else
{
ChatColor(id, "!g[%s Rekabetci !t(2. Tur)!g]: !tTur: !g%d/15 !n- !tRound: !g%d/30",SERVER,el,round);
girdi = 1;
}
}
else if (get_pcvar_num(rekabetcitur) == 0 && girdi == 0)
{
ChatColor(id, "!g[%s Rekabetci !t(1. Tur)!g]: !tTur: !g%d/15 !n- !tRound: !g%d/30",SERVER,el,round);
girdi = 1;
}
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, sizeof(msg) - 1, input, 3)
replace_all(msg, 190, "!n", "^x01")
replace_all(msg, 190, "!y", "^x01")
replace_all(msg, 190, "!g", "^x04")
replace_all(msg, 190, "!t", "^x03")
if(id) players[0] = id; else get_players(players, count, "ch")
for(new i = 0; i < count; i++)
{
if(is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i])
write_string(msg)
message_end()
}
}
}
/* === HUD MESAJI === */
/// HUD MESSAGE ///
#if defined _dhudmessage_included
#endinput
#endif
#define _dhudmessage_included
stock __dhud_color;
stock __dhud_x;
stock __dhud_y;
stock __dhud_effect;
stock __dhud_fxtime;
stock __dhud_holdtime;
stock __dhud_fadeintime;
stock __dhud_fadeouttime;
stock __dhud_reliable;
stock ekran_mesaj_noktasi( red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0, Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = false )
{
#define clamp_byte(%1) ( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )
__dhud_color = pack_color( clamp_byte( red ), clamp_byte( green ), clamp_byte( blue ) );
__dhud_x = _:x;
__dhud_y = _:y;
__dhud_effect = effects;
__dhud_fxtime = _:fxtime;
__dhud_holdtime = _:holdtime;
__dhud_fadeintime = _:fadeintime;
__dhud_fadeouttime = _:fadeouttime;
__dhud_reliable = _:reliable;
return 1;
}
stock ekran_mesaji( index, const message[], any:... )
{
new buffer[ 128 ];
new numArguments = numargs();
if( numArguments == 2 )
{
send_dhudMessage( index, message );
}
else if( index || numArguments == 3 )
{
vformat( buffer, charsmax( buffer ), message, 3 );
send_dhudMessage( index, buffer );
}
else
{
new playersList[ 32 ], numPlayers;
get_players( playersList, numPlayers, "ch" );
if( !numPlayers )
{
return 0;
}
new Array:handleArrayML = ArrayCreate();
for( new i = 2, j; i < numArguments; i++ )
{
if( getarg( i ) == LANG_PLAYER )
{
while( ( buffer[ j ] = getarg( i + 1, j++ ) ) ) {}
j = 0;
if( GetLangTransKey( buffer ) != TransKey_Bad )
{
ArrayPushCell( handleArrayML, i++ );
}
}
}
new size = ArraySize( handleArrayML );
if( !size )
{
vformat( buffer, charsmax( buffer ), message, 3 );
send_dhudMessage( index, buffer );
}
else
{
for( new i = 0, j; i < numPlayers; i++ )
{
index = playersList[ i ];
for( j = 0; j < size; j++ )
{
setarg( ArrayGetCell( handleArrayML, j ), 0, index );
}
vformat( buffer, charsmax( buffer ), message, 3 );
send_dhudMessage( index, buffer );
}
}
ArrayDestroy( handleArrayML );
}
return 1;
}
stock send_dhudMessage( const index, const message[] )
{
message_begin( __dhud_reliable ? ( index ? MSG_ONE : MSG_ALL ) : ( index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST ), SVC_DIRECTOR, _, index );
{
write_byte( strlen( message ) + 31 );
write_byte( DRC_CMD_MESSAGE );
write_byte( __dhud_effect );
write_long( __dhud_color );
write_long( __dhud_x );
write_long( __dhud_y );
write_long( __dhud_fadeintime );
write_long( __dhud_fadeouttime );
write_long( __dhud_holdtime );
write_long( __dhud_fxtime );
write_string( message );
}
message_end();
}