Участник
Пользователь
- Сообщения
- 166
- Реакции
- 34
- Помог
- 3 раз(а)
Всем доброе утро, нужен совет, опытного пользователя, так сказать
Есть стандартный квар mp_chattime при значении которого происходит задержка перед сменой карты с завершенной на следующую выбранную.
Данный кварт не хочет работать. Нужна задержка для того, что бы в конце карты игроки выдели лучшего игрока по убийствам (установлен плагин с MOTD окном)
Собственно вопрос. Стандартный плагин nextmap не закомментирован и работает с плагином GHW_Custom_Nextmap.amxx В данном плагине не чего связанного с кваром mp_chattime не нашел, что бы плагин менял значение в server.cfg. Может что то пропустил или даже не в курсе
Подскажите, пожалуйста в чем может быть проблема?
Есть стандартный квар mp_chattime при значении которого происходит задержка перед сменой карты с завершенной на следующую выбранную.
Данный кварт не хочет работать. Нужна задержка для того, что бы в конце карты игроки выдели лучшего игрока по убийствам (установлен плагин с MOTD окном)
Код:
#include <amxmodx>
#include <hamsandwich>
#include <nvault>
//Comment if you're not using Counter-Strike.
#define USE_CSTRIKE
#define PLUGIN_VERSION "1.1.2"
#define MOTD_BEST "addons/amxmodx/configs/BestPlayer.txt"
#define MOTD_STATS "addons/amxmodx/configs/BestPlayerStats.txt"
#define MAX_MOTD_LENGTH 1536
#define MAX_HEADER_LENGTH 32
#define MAX_FORMULA_CYCLES 10
#define ARG_MAP "$map$"
#define ARG_NAME "$name$"
#define ARG_WINS "$wins$"
#define ARG_KILLS "$kills$"
#define ARG_KILLS_SB "$kills_sb$"
#define ARG_DEATHS "$deaths$"
#define ARG_DEATHS_SB "$deaths_sb$"
#define ARG_HEADSHOTS "$headshots$"
#define ARG_HITS "$hits$"
#define ARG_DAMAGE "$damage$"
#define ARG_KDRATIO "$kdratio$"
#define ARG_KDRATIO_SB "$kdratio_sb$"
#define ARG_HSRATIO "$hsratio$"
#if defined USE_CSTRIKE
#include <cstrike>
#define ARG_CTSCORE "$ctscore$"
#define ARG_TSCORE "$tscore$"
#define ARG_BEST_TEAM "$best_team$"
#define get_user_deaths cs_get_user_deaths
new g_iTeamScore[3]
new const g_szTeams[][] = { "draw", "t", "ct" }
new const g_szTeamNames[][] = { "", "CT", "TERRORIST" }
#endif
#if defined client_disconnected
#define client_disconnect client_disconnected
#endif
enum _:Cvars
{
bpm_formula,
bpm_min_players,
bpm_motd_header,
#if defined USE_CSTRIKE
bpm_obey_team,
#endif
bpm_stats_header,
bpm_save_type
}
enum _:PlayerData
{
PDATA_INFO[35],
PDATA_WINS,
PDATA_KILLS,
PDATA_KILLS_SB,
PDATA_DEATHS,
PDATA_DEATHS_SB,
PDATA_HEADSHOTS,
PDATA_HITS,
Float:PDATA_DAMAGE,
Float:PDATA_KDRATIO,
Float:PDATA_KDRATIO_SB,
Float:PDATA_HSRATIO
}
new g_eCvars[Cvars], g_iSaveType, g_iVault
new g_ePlayerData[33][PlayerData], g_szStats[MAX_MOTD_LENGTH], g_szMap[32]
public plugin_init()
{
register_plugin("Best Player MOTD", PLUGIN_VERSION, "OciXCrom")
register_cvar("CRXBestPlayer", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
#if defined USE_CSTRIKE
register_event("TeamScore", "OnTeamScore", "a")
#endif
RegisterHam(Ham_TakeDamage, "player", "OnTakeDamage", 1)
register_event("DeathMsg", "OnPlayerKilled", "a")
register_message(SVC_INTERMISSION, "OnIntermission")
register_logevent("OnRestartRound", 2, "0=World triggered", "1&Restart_Round_")
register_clcmd("say /mystats", "Cmd_MyStats")
register_clcmd("say_team /mystats", "Cmd_MyStats")
g_eCvars[bpm_formula] = register_cvar("bpm_formula", "157")
g_eCvars[bpm_min_players] = register_cvar("bpm_min_players", "6")
g_eCvars[bpm_motd_header] = register_cvar("bpm_motd_header", "Best Player: $name$")
#if defined USE_CSTRIKE
g_eCvars[bpm_obey_team] = register_cvar("bpm_obey_team", "0")
#endif
g_eCvars[bpm_stats_header] = register_cvar("bpm_stats_header", "Player Stats: $name$")
g_eCvars[bpm_save_type] = register_cvar("bpm_save_type", "0")
get_mapname(g_szMap, charsmax(g_szMap))
g_iVault = nvault_open("BestPlayer")
}
public plugin_cfg()
g_iSaveType = get_pcvar_num(g_eCvars[bpm_save_type])
public plugin_end()
nvault_close(g_iVault)
public client_putinserver(id)
{
reset_player_stats(id)
get_user_saveinfo(id, g_ePlayerData[id][PDATA_INFO], charsmax(g_ePlayerData[][PDATA_INFO]))
use_vault(id, 1, g_ePlayerData[id][PDATA_INFO])
}
public client_disconnect(id)
use_vault(id, 0, g_ePlayerData[id][PDATA_INFO])
public client_infochanged(id)
{
if(g_iSaveType > 0)
return
static szNewName[32], szOldName[32]
get_user_info(id, "name", szNewName, charsmax(szNewName))
get_user_name(id, szOldName, charsmax(szOldName))
if(!equali(szNewName, szOldName))
{
strtolower(szNewName); strtolower(szOldName)
copy(g_ePlayerData[id][PDATA_INFO], charsmax(g_ePlayerData[][PDATA_INFO]), szNewName)
use_vault(id, 0, szOldName)
use_vault(id, 1, szNewName)
}
}
public Cmd_MyStats(id)
{
if(!g_szStats[0])
LoadFileForMe(MOTD_STATS, g_szStats, charsmax(g_szStats))
static szMotd[MAX_MOTD_LENGTH]
new szHeader[MAX_HEADER_LENGTH]
copy(szMotd, charsmax(szMotd), g_szStats)
get_pcvar_string(g_eCvars[bpm_stats_header], szHeader, charsmax(szHeader))
calculate_stats(id)
apply_replacements(id, szMotd, charsmax(szMotd))
apply_replacements(id, szHeader, charsmax(szHeader))
show_motd(id, szMotd, szHeader)
return PLUGIN_HANDLED
}
public OnRestartRound()
{
new iPlayers[32], iPnum
get_players(iPlayers, iPnum)
for(new i; i < iPnum; i++)
reset_player_stats(iPlayers)
}
public OnTakeDamage(iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits)
{
if(is_user_alive(iAttacker) && iAttacker != iVictim)
{
g_ePlayerData[iAttacker][PDATA_HITS]++
g_ePlayerData[iAttacker][PDATA_DAMAGE] += fDamage
}
}
public OnPlayerKilled()
{
new iAttacker = read_data(1),
iVictim = read_data(2)
g_ePlayerData[iVictim][PDATA_DEATHS]++
if(is_user_connected(iAttacker) && iAttacker != iVictim)
{
g_ePlayerData[iAttacker][PDATA_KILLS]++
if(read_data(3))
g_ePlayerData[iAttacker][PDATA_HEADSHOTS]++
}
}
#if defined USE_CSTRIKE
public OnTeamScore()
{
new szTeam[3], iScore = read_data(2)
read_data(1, szTeam, charsmax(szTeam))
g_iTeamScore[szTeam[0] == 'C' ? 2 : 1] = iScore
}
#endif
public OnIntermission()
{
new iPlayers[32], iPnum
#if defined USE_CSTRIKE
new iTeam = get_pcvar_num(g_eCvars[bpm_obey_team])
switch(iTeam)
{
case 0: get_players(iPlayers, iPnum)
case 1, 2: get_players(iPlayers, iPnum, "e", g_szTeamNames[iTeam])
case 3:
{
new iWinTeam = get_winning_team()
switch(iWinTeam)
{
case 0: get_players(iPlayers, iPnum)
case 1, 2: get_players(iPlayers, iPnum, "e", g_szTeamNames[iWinTeam])
}
}
}
#else
get_players(iPlayers, iPnum)
#endif
if(!iPnum || iPnum < get_pcvar_num(g_eCvars[bpm_min_players]))
return PLUGIN_CONTINUE
new szFormula[MAX_FORMULA_CYCLES], iBest = iPlayers[0]
get_pcvar_string(g_eCvars[bpm_formula], szFormula, charsmax(szFormula))
new iLen = strlen(szFormula)
for(new i, j, iPlayer, iScore, any:iBestScore; i < iPnum; i++)
{
iPlayer = iPlayers
calculate_stats(iPlayer)
for(j = 0; j < iLen; j++)
{
iScore = get_score_by_formula(iPlayer, j, szFormula)
iBestScore = get_score_by_formula(iBest, j, szFormula)
if(iScore > iBestScore)
{
iBest = iPlayer
break
}
else if(iScore == iBestScore)
{
if(j + 1 == iLen)
break
if(get_score_by_formula(iPlayer, j + 1, szFormula) > get_score_by_formula(iBest, j + 1, szFormula))
{
iPlayer = iBest
break
}
}
}
}
new bool:bNonZero
for(new i; i < iLen; i++)
{
if(get_score_by_formula(iBest, i, szFormula) != 0)
{
bNonZero = true
break
}
}
if(!bNonZero)
return PLUGIN_CONTINUE
g_ePlayerData[iBest][PDATA_WINS]++
new szMotd[MAX_MOTD_LENGTH], szHeader[MAX_HEADER_LENGTH]
LoadFileForMe(MOTD_BEST, szMotd, charsmax(szMotd))
get_pcvar_string(g_eCvars[bpm_motd_header], szHeader, charsmax(szHeader))
apply_replacements(iBest, szMotd, charsmax(szMotd))
apply_replacements(iBest, szHeader, charsmax(szHeader))
show_motd(0, szMotd, szHeader)
send_intermission()
return PLUGIN_HANDLED
}
bool:has_argument(const szMessage[], const szArgument[])
return contain(szMessage, szArgument) != -1
any:get_score_by_formula(const id, const iNum, const szFormula[])
{
switch(szFormula[iNum])
{
case '0': return g_ePlayerData[id][PDATA_WINS]
case '1': return g_ePlayerData[id][PDATA_KILLS]
case '2': return g_ePlayerData[id][PDATA_KILLS_SB]
case '3': return g_ePlayerData[id][PDATA_DEATHS] * -1
case '4': return g_ePlayerData[id][PDATA_DEATHS_SB] * -1
case '5': return g_ePlayerData[id][PDATA_HEADSHOTS]
case '6': return g_ePlayerData[id][PDATA_HITS]
case '7': return g_ePlayerData[id][PDATA_DAMAGE]
case '8': return g_ePlayerData[id][PDATA_KDRATIO]
case '9': return g_ePlayerData[id][PDATA_KDRATIO_SB]
case 'a': return g_ePlayerData[id][PDATA_HSRATIO]
}
return 0
}
apply_replacements(const id, szMessage[], const iLen)
{
if(has_argument(szMessage, ARG_MAP))
replace_all(szMessage, iLen, ARG_MAP, g_szMap)
if(has_argument(szMessage, ARG_NAME))
{
static szBuffer[32]
get_user_name(id, szBuffer, charsmax(szBuffer))
replace_all(szMessage, iLen, ARG_NAME, szBuffer)
}
if(has_argument(szMessage, ARG_WINS))
replace_num(szMessage, iLen, ARG_WINS, g_ePlayerData[id][PDATA_WINS])
if(has_argument(szMessage, ARG_KILLS))
replace_num(szMessage, iLen, ARG_KILLS, g_ePlayerData[id][PDATA_KILLS])
if(has_argument(szMessage, ARG_KILLS_SB))
replace_num(szMessage, iLen, ARG_KILLS_SB, g_ePlayerData[id][PDATA_KILLS_SB])
if(has_argument(szMessage, ARG_DEATHS))
replace_num(szMessage, iLen, ARG_DEATHS, g_ePlayerData[id][PDATA_DEATHS])
if(has_argument(szMessage, ARG_DEATHS_SB))
replace_num(szMessage, iLen, ARG_DEATHS_SB, g_ePlayerData[id][PDATA_DEATHS_SB])
if(has_argument(szMessage, ARG_HEADSHOTS))
replace_num(szMessage, iLen, ARG_HEADSHOTS, g_ePlayerData[id][PDATA_HEADSHOTS])
if(has_argument(szMessage, ARG_HITS))
replace_num(szMessage, iLen, ARG_HITS, g_ePlayerData[id][PDATA_HITS])
if(has_argument(szMessage, ARG_DAMAGE))
replace_num_f(szMessage, iLen, ARG_DAMAGE, g_ePlayerData[id][PDATA_DAMAGE])
if(has_argument(szMessage, ARG_KDRATIO))
replace_num_f(szMessage, iLen, ARG_KDRATIO, g_ePlayerData[id][PDATA_KDRATIO])
if(has_argument(szMessage, ARG_KDRATIO_SB))
replace_num_f(szMessage, iLen, ARG_KDRATIO_SB, g_ePlayerData[id][PDATA_KDRATIO_SB])
if(has_argument(szMessage, ARG_HSRATIO))
replace_num_f(szMessage, iLen, ARG_HSRATIO, g_ePlayerData[id][PDATA_HSRATIO])
#if defined USE_CSTRIKE
if(has_argument(szMessage, ARG_TSCORE))
replace_num(szMessage, iLen, ARG_TSCORE, g_iTeamScore[1])
if(has_argument(szMessage, ARG_CTSCORE))
replace_num(szMessage, iLen, ARG_CTSCORE, g_iTeamScore[2])
if(has_argument(szMessage, ARG_BEST_TEAM))
replace_all(szMessage, iLen, ARG_BEST_TEAM, g_szTeams[get_winning_team()])
#endif
}
#if defined USE_CSTRIKE
get_winning_team()
return g_iTeamScore[1] == g_iTeamScore[2] ? 0 : g_iTeamScore[1] > g_iTeamScore[2] ? 1 : 2
#endif
reset_player_stats(const id)
{
g_ePlayerData[id][PDATA_WINS] = 0
g_ePlayerData[id][PDATA_KILLS] = 0
g_ePlayerData[id][PDATA_KILLS_SB] = 0
g_ePlayerData[id][PDATA_DEATHS] = 0
g_ePlayerData[id][PDATA_DEATHS_SB] = 0
g_ePlayerData[id][PDATA_HEADSHOTS] = 0
g_ePlayerData[id][PDATA_HITS] = 0
g_ePlayerData[id][PDATA_DAMAGE] = _:0.0
g_ePlayerData[id][PDATA_KDRATIO] = _:0.0
g_ePlayerData[id][PDATA_KDRATIO_SB] = _:0.0
g_ePlayerData[id][PDATA_HSRATIO] = _:0.0
}
use_vault(const id, const iType, const szInfo[])
{
if(!szInfo[0])
return
switch(iType)
{
case 0:
{
new szWins[10]
num_to_str(g_ePlayerData[id][PDATA_WINS], szWins, charsmax(szWins))
nvault_set(g_iVault, szInfo, szWins)
}
case 1: g_ePlayerData[id][PDATA_WINS] = nvault_get(g_iVault, szInfo)
}
}
get_user_saveinfo(const id, szInfo[], const iLen)
{
switch(g_iSaveType)
{
case 0: { get_user_name(id, szInfo, iLen); strtolower(szInfo); }
case 1: get_user_ip(id, szInfo, iLen, 1)
case 2: get_user_authid(id, szInfo, iLen)
}
}
calculate_stats(const id)
{
g_ePlayerData[id][PDATA_KILLS_SB] = get_user_frags(id)
g_ePlayerData[id][PDATA_DEATHS_SB] = get_user_deaths(id)
g_ePlayerData[id][PDATA_KDRATIO] = g_ePlayerData[id][PDATA_DEATHS] ? (float(g_ePlayerData[id][PDATA_KILLS]) / float(g_ePlayerData[id][PDATA_DEATHS])) : float(g_ePlayerData[id][PDATA_KILLS])
g_ePlayerData[id][PDATA_KDRATIO_SB] = g_ePlayerData[id][PDATA_DEATHS_SB] ? (float(g_ePlayerData[id][PDATA_KILLS_SB]) / float(g_ePlayerData[id][PDATA_DEATHS_SB])) : float(g_ePlayerData[id][PDATA_KILLS_SB])
g_ePlayerData[id][PDATA_HSRATIO] = g_ePlayerData[id][PDATA_HEADSHOTS] ? (float(g_ePlayerData[id][PDATA_HEADSHOTS]) / float(g_ePlayerData[id][PDATA_KILLS])) : float(g_ePlayerData[id][PDATA_HEADSHOTS])
}
replace_num(szMessage[], const iLen, const szPlaceholder[], const iNum)
{
static szBuffer[32]
num_to_str(iNum, szBuffer, charsmax(szBuffer))
replace_all(szMessage, iLen, szPlaceholder, szBuffer)
}
replace_num_f(szMessage[], const iLen, const szPlaceholder[], const Float:fNum)
{
static szBuffer[32], i
formatex(szBuffer, charsmax(szBuffer), "%.2f", fNum)
i = strlen(szBuffer) - 1
while(szBuffer == '0' && szBuffer[i - 1] != '.')
--i
szBuffer[i + 1] = EOS
replace_all(szMessage, iLen, szPlaceholder, szBuffer)
}
send_intermission()
{
message_begin(MSG_ALL, SVC_FINALE)
write_string("")
message_end()
}
Собственно вопрос. Стандартный плагин nextmap не закомментирован и работает с плагином GHW_Custom_Nextmap.amxx В данном плагине не чего связанного с кваром mp_chattime не нашел, что бы плагин менял значение в server.cfg. Может что то пропустил или даже не в курсе
Подскажите, пожалуйста в чем может быть проблема?
Код:
/*
* _______ _ _ __ __
* | _____/ | | | | \ \ __ / /
* | | | | | | | | / \ | |
* | | | |____| | | |/ __ \| |
* | | ___ | ______ | | / \ |
* | | |_ | | | | | | / \ |
* | | | | | | | | | | | |
* | |____| | | | | | | | | |
* |_______/ |_| |_| \_/ \_/
*
*
*
* Last Edited: 05-16-08
*
* ============
* Changelog:
* ============
*
* v1.4e
* -is_map_valid() broken, hardcoded a bug fix.
*
* v1.4d
* -Bug Fixes
*
* v1.4c
* -nominate command changed
*
* v1.4b
* -GG Compadability Beta
*
* v1.4
* -Added Nominating
*
* v1.1 - 1.3
* -Bug Fixes
* -Added RTV
*
* v1.0
* -Initial Release
*
*/
#define VERSION "1.4d"
#include <amxmodx>
#include <amxmisc>
#define MAX_NOMINATED 20
#define MAX_TRIES 50
new configfile[200]
new menu[2000]
new keys
new g_teamScore[2]
new bool:voting
new votes[10]
new maps[9][32]
new num_nominated = 0
new nominated[MAX_NOMINATED][32]
new bool:has_nominated[33]
new mp_winlimit
new mp_maxrounds
new mp_timelimit
new extended_pcvar
new extendtime_pcvar
new lastmap_pcvar
new lastmap_was_pcvar
new lastlastmap_pcvar
new lastlastmap_was_pcvar
new showvotes_pcvar
new rtv_percent_pcvar
new rtv_wait_pcvar
new delay_time_pcvar
new delay_tally_time_pcvar
new extended
new cur_nextmap[32]
new cstrike
new bool:rtv[33]
new rtvtotal
new Float:voterocked
new bool:voterocked2
new num
new say_commands[][32] =
{
"rockthevote",
"rock the vote",
"rtv",
"/rockthevote",
"/rock the vote",
"/rtv"
}
new say_commands2[][32] =
{
"nominate",
"/nominate"
}
new lastmap[32]
new lastlastmap[32]
new currentmap[32]
public plugin_init()
{
register_plugin("Custom NextMap Chooser",VERSION,"GHW_Chronic")
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps.ini",configfile)
register_cvar("map_enabled","1")
if(file_exists(configfile) && get_cvar_num("map_enabled"))
{
register_concmd("amx_nextmap_vote","cmd_nextmap",ADMIN_MAP,"Starts a vote for nextmap [1=allow extend(Default) | 0=Don't allow extend] [1=Change Now(Default) | 0=Change at End")
register_clcmd("say nextmap","saynextmap")
register_clcmd("say_team nextmap","saynextmap")
register_clcmd("say","say_hook")
register_clcmd("say_team","say_hook")
cstrike = cstrike_running()
if(cstrike) register_event("TeamScore", "team_score", "a")
register_menucmd(register_menuid("CustomNextMap"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"VoteCount")
set_task(15.0,"Check_Endround",1337,"",0,"b")
if(cstrike)
{
mp_winlimit = get_cvar_pointer("mp_winlimit")
mp_maxrounds = get_cvar_pointer("mp_maxrounds")
}
mp_timelimit = get_cvar_pointer("mp_timelimit")
extended_pcvar = register_cvar("map_extend_max","3")
extendtime_pcvar = register_cvar("map_extend_time","5")
lastmap_pcvar = register_cvar("map_lastmap_show","1")
lastlastmap_pcvar = register_cvar("map_lastlastmap_show","1")
showvotes_pcvar = register_cvar("map_show_votes","1")
rtv_percent_pcvar = register_cvar("map_rtv_percent","50")
rtv_wait_pcvar = register_cvar("map_rtv_wait","180")
lastmap_was_pcvar = register_cvar("qq_lastmap","")
lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","")
delay_time_pcvar = register_cvar("map_delay_time","6")
delay_tally_time_pcvar = register_cvar("map_tally_delay_time","15")
if(is_plugin_loaded("Nextmap Chooser")!=-1) pause("acd","mapchooser.amxx")
if(!cvar_exists("amx_nextmap")) register_cvar("amx_nextmap","")
get_pcvar_string(lastmap_was_pcvar,lastmap,31)
get_pcvar_string(lastlastmap_was_pcvar,lastlastmap,31)
get_mapname(currentmap,31)
}
}
public client_disconnect(id)
{
if(rtv[id])
{
rtv[id]=false
has_nominated[id]=false
rtvtotal--
}
}
public cmd_nextmap(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
{
return PLUGIN_HANDLED
}
if(!voting)
{
num = get_pcvar_num(delay_time_pcvar)
if(num<1) num=1
new arg1[8] = "1"
new arg2[8] = "1"
if(read_argc()>=2)
{
read_argv(1,arg1,7)
if(read_argc()>=3)
{
read_argv(2,arg2,7)
}
}
client_print(0,print_chat,"[AMXX] An admin has started a nextmap vote! Vote starting in %d seconds.",num)
if(str_to_num(arg2)) voterocked2=true
else voterocked2=false
make_menu(str_to_num(arg1))
}
else
{
client_print(id,print_chat,"[AMXX] There is already a nextmap vote in progress.")
}
return PLUGIN_HANDLED
}
public make_menu(add_extend)
{
num = get_pcvar_num(delay_time_pcvar)
if(num<1) num=1
for(new i=0;i<10;i++) votes=0
for(new i=0;i<9;i++) format(maps,31,"")
format(menu,1999,"^n")
new Fsize = file_size(configfile,1)
new read[32], trash, string[8]
new numbers[17]
for(new i=1;i<9;i++)
{
numbers=0
numbers[17-i]=0
for(new i2=0;i2<Fsize;i2++)
{
read_file(configfile,i2,read,31,trash)
format(string,7,"[%d]",i)
if(equali(read,string)) numbers=i2+1
format(string,7,"[/%d]",i)
if(equali(read,string)) numbers[17-i]=i2-1
}
}
new tries
keys = (1<<9)
new j
for(new i=1;i<9;i++)
{
format(maps,31,"")
if(numbers && numbers[17-i] && numbers[17-i]-numbers>=0)
{
tries=0
while(tries<MAX_TRIES)
{
read_file(configfile,random_num(numbers,numbers[17-i]),read,31,trash)
if(containi(read,"%nominated%")==0 && num_nominated>0) format(read,31,"%s",nominated[random_num(0,num_nominated - 1)])
if(is_map_valid(read) && !equali(read,currentmap) && (get_pcvar_num(lastmap_pcvar) || !equali(read,lastmap)) && (get_pcvar_num(lastlastmap_pcvar) || !equali(read,lastlastmap)))
{
for(j=1;j<i;j++)
{
if(equali(read,maps[j]))
{
j = 0
break;
}
}
if(!j) break;
format(maps,31,"%s",read)
format(menu,1999,"%s^n%d. %s",menu,i,read)
switch(i)
{
case 1: keys |= (1<<0)
case 2: keys |= (1<<1)
case 3: keys |= (1<<2)
case 4: keys |= (1<<3)
case 5: keys |= (1<<4)
case 6: keys |= (1<<5)
case 7: keys |= (1<<6)
case 8: keys |= (1<<7)
}
break;
}
tries++
}
}
}
if(add_extend)
{
new mapname[32]
get_mapname(mapname,31)
if(extended<get_pcvar_num(extended_pcvar))
{
format(menu,1999,"%s^n^n9. Extend %s",menu,mapname)
keys |= (1<<8)
}
}
format(menu,1999,"%s^n0. I don't care",menu)
set_hudmessage(255,0,0,0.03,0.40,0,6.0,1.0,0.0,0.0,3)
show_hudmessage(0,"Vote for Next Map in %d seconds:",num)
set_hudmessage(255,255,255,0.03,0.40,0,6.0,1.0,0.0,0.0,4)
show_hudmessage(0,menu)
set_task(1.0,"Send_Menu",0,"",0,"a",num)
set_task(get_pcvar_float(delay_tally_time_pcvar) + float(num),"VoteTally",0)
voting=true
voterocked=-1.0
}
public Send_Menu()
{
if(num!=1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,1.0,0.0,0.0,3)
show_hudmessage(0,"Vote for Next Map in %d seconds:",num-1)
set_hudmessage(255,255,255,0.03,0.40,0,6.0,1.0,0.0,0.0,4)
show_hudmessage(0,menu)
num--
}
else
{
client_cmd(0,"spk Gman/Gman_Choose2")
format(menu,1999,"Vote for Next Map:%s",menu)
show_menu(0,keys,menu,get_pcvar_num(delay_tally_time_pcvar),"CustomNextMap")
}
}
public saynextmap(id)
{
if(strlen(cur_nextmap)) client_print(0,print_chat,"[AMXX] --Nextmap: %s",cur_nextmap)
else client_print(0,print_chat,"[AMXX] --Nextmap not chosen yet.")
}
public say_hook(id)
{
new text[64]
read_args(text,63)
remove_quotes(text)
new string[32]
for(new i=0;i<sizeof(say_commands);i++)
{
format(string,31,"%s",say_commands)
if(containi(text,string)==0) return sayrockthevote(id);
}
for(new i=0;i<sizeof(say_commands2);i++)
{
format(string,31,"%s ",say_commands2)
if(containi(text,string)==0)
{
replace(text,63,string,"")
return saynominate(id,text);
}
}
if(is_map_valid2(text)) return saynominate(id,text);
return PLUGIN_CONTINUE
}
public sayrockthevote(id)
{
if(voterocked==-1.0)
{
client_print(id,print_chat,"[AMXX] Voting Currently in Process.")
}
else if((!voterocked && get_gametime()>get_pcvar_num(rtv_wait_pcvar)) || (get_gametime() - voterocked) > get_pcvar_num(rtv_wait_pcvar))
{
if(get_pcvar_num(rtv_percent_pcvar)>0 && get_pcvar_num(rtv_percent_pcvar)<=100)
{
if(rtv[id])
{
client_print(id,print_chat,"[AMXX] You have already voted to Rock the Vote.")
}
else
{
rtv[id]=true
rtvtotal++
new num2, players[32]
get_players(players,num2,"ch")
new name[32]
get_user_name(id,name,31)
new num3 = floatround((num2 * get_pcvar_float(rtv_percent_pcvar) / 100.0) - rtvtotal,floatround_ceil)
if(num3<=0)
{
client_print(0,print_chat,"[AMXX] %s has voted to Rock the Vote.",name)
client_print(0,print_chat,"[AMXX] The Vote has been Rocked!")
make_menu(1)
voterocked2=true
}
else
{
if(num3!=1) client_print(0,print_chat,"[AMXX] %s has voted to Rock the Vote. Need %d more players.",name,num3)
else client_print(0,print_chat,"[AMXX] %s has voted to Rock the Vote. Need 1 more player.",name)
}
}
}
else
{
client_print(id,print_chat,"[AMXX] Rock the Vote is disabled.")
}
}
else if(voterocked>0.0)
{
client_print(id,print_chat,"[AMXX] Cannot Rock the Vote again for another %d seconds.",get_pcvar_num(rtv_wait_pcvar) - (floatround(get_gametime()) - floatround(voterocked)))
}
else
{
client_print(id,print_chat,"[AMXX] Cannot Rock the Vote till %d seconds after map start. (%d more seconds)",get_pcvar_num(rtv_wait_pcvar),get_pcvar_num(rtv_wait_pcvar) - floatround(get_gametime()))
}
return PLUGIN_CONTINUE
}
public saynominate(id,nom_map[64])
{
if(has_nominated[id])
{
client_print(id,print_chat,"[AMXX] You have already nominated a map.")
}
else if(is_map_valid2(nom_map))
{
if(equali(nom_map,currentmap))
{
client_print(0,print_chat,"[AMXX] Cannot nominated the current map.")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastmap_pcvar) && equali(nom_map,lastmap))
{
client_print(0,print_chat,"[AMXX] Cannot nominated the previous map.")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastlastmap_pcvar) && equali(nom_map,lastlastmap))
{
client_print(0,print_chat,"[AMXX] Cannot nominated the previous to previous map.")
return PLUGIN_CONTINUE
}
for(new i=0;i<num_nominated;i++)
{
if(equali(nominated,nom_map))
{
client_print(0,print_chat,"[AMXX] That map has already been nominated.")
return PLUGIN_CONTINUE
}
}
format(nominated[num_nominated],31,"%s",nom_map)
num_nominated++
new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"[AMXX] %s nominated %s.",name,nom_map)
has_nominated[id] = true
}
else
{
client_print(0,print_chat,"[AMXX] That map does not exist on this server.")
}
return PLUGIN_CONTINUE
}
public is_map_valid2(map[])
{
if(is_map_valid(map) &&
containi(map,"<")==-1 &&
containi(map,"\")==-1 &&
containi(map,"/")==-1 &&
containi(map,">")==-1 &&
containi(map,"?")==-1 &&
containi(map,"|")==-1 &&
containi(map,"*")==-1 &&
containi(map,":")==-1 &&
containi(map,"^"")==-1
)
return 1;
return 0;
}
public Check_Endround()
{
if(voterocked==-1.0)
return ;
new bool:continuea=false
if(cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
if(winlimit)
{
new c = winlimit - 2
if(!((c> g_teamScore[0]) && (c>g_teamScore[1]) ))
{
continuea=true
}
}
new maxrounds = get_pcvar_num(mp_maxrounds)
if(maxrounds)
{
if(!((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1])))
{
continuea=true
}
}
}
new timeleft = get_timeleft()
if(!(timeleft < 1 || timeleft > 129))
{
continuea=true
}
if(!continuea)
return ;
remove_task(1337)
make_menu(1)
return ;
}
public VoteCount(id,key)
{
if(voting)
{
new name[32]
get_user_name(id,name,31)
if(key==8)
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"[AMXX] %s voted for map extension.",name)
votes[9]++
}
else if(key==9)
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"[AMXX] %s didn't vote.",name)
}
else if(strlen(maps[key+1]))
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"[AMXX] %s voted for %s.",name,maps[key+1])
votes[key+1]++
}
else
{
show_menu(id,keys,menu,-1,"CustomNextMap")
}
}
return PLUGIN_HANDLED
}
public VoteTally(num)
{
voting=false
new winner[2]
for(new i=1;i<10;i++)
{
if(votes>winner[1])
{
winner[0]=i
winner[1]=votes
}
votes=0
}
if(!winner[1])
{
if(!voterocked2)
{
new mapname[32]
get_cvar_string("qq_lastmap",mapname,31)
set_cvar_string("qq_lastlastmap",mapname)
get_mapname(mapname,31)
set_cvar_string("qq_lastmap",mapname)
client_print(0,print_chat,"[AMXX] No one voted. Random Map coming.")
}
else
{
client_print(0,print_chat,"[AMXX] No one voted.")
voterocked=get_gametime()
}
}
else if(winner[0]==9)
{
if(!voterocked2)
{
client_print(0,print_chat,"[AMXX] Map extending won. Extending map for %d minutes.",get_pcvar_num(extendtime_pcvar))
set_pcvar_float(mp_timelimit,get_pcvar_float(mp_timelimit) + get_pcvar_num(extendtime_pcvar))
set_task(15.0,"Check_Endround",1337,"",0,"b")
extended++
}
else
{
client_print(0,print_chat,"[AMXX] Map extending won. No new map.")
}
voterocked=get_gametime()
}
else
{
new mapname[32]
get_cvar_string("qq_lastmap",mapname,31)
set_cvar_string("qq_lastlastmap",mapname)
get_mapname(mapname,31)
set_cvar_string("qq_lastmap",mapname)
client_print(0,print_chat,"[AMXX] Voting Over. Nextmap will be %s!",maps[winner[0]])
if(!voterocked2)
{
set_cvar_string("amx_nextmap",maps[winner[0]])
set_task(1.0,"change_level",winner[0],"",0,"d")
}
else
{
set_task(5.0,"change_level",winner[0])
}
format(cur_nextmap,31,"%s",maps[winner[0]])
}
for(new i=0;i<=32;i++) rtv=false
voterocked2=false
}
public change_level(map)
{
server_cmd("amx_map %s",maps[map])
}
//From the AMXX nextmap base file
public team_score()
{
new team[2]
read_data(1,team,1)
g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
}
Последнее редактирование модератором: