03/02/2020, 11:08 PM
(Última modificación: 04/02/2020, 12:04 AM por DavidLG. Edited 2 times in total.)
Buenas les cuento un problemita un mod pug que ando probando que me a gustado ehhh el problema es este.
Cuando termina la primera mitad y al pasar de equipo no se reinicia el score ni nada simplemente se cambian aja se quedan alli y no empieza nada de nada fui a la consola del panel y me salio esto. ->
Aca esta el code:
EDIT:
Al poner debug
Cuando termina la primera mitad y al pasar de equipo no se reinicia el score ni nada simplemente se cambian aja se quedan alli y no empieza nada de nada fui a la consola del panel y me salio esto. ->
Código:
L 02/03/2020 - 21:58:50: [ReAPI] SetHookChainReturn: trying to set return value with incompatible type, expected 'ATYPE_BOOL'; got 'ATYPE_INTEGER'
L 02/03/2020 - 21:58:50: [AMXX] Run time error 10 (plugin "ModPug2.amxx") (native "SetHookChainReturn") - debug not enabled!
L 02/03/2020 - 21:58:50: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
Aca esta el code:
Código PHP:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <reapi>
#include <celltrie>
#define PLUGIN "RePUG"
#define VERSION "1.36"
#define AUTHOR "by Sugisaki & Flys Modifle By Alejandro-."
#define END_ROUND_KNIFE_FIX
#define MAXPLAYERS 15
#define TASK_1 61235
#define get_user_team(%i) get_member(%i, m_iTeam)
new TASK_HUD_READY = 552214
new TASK_HUD_VOTE = 996541
new TASK_END_VOTE = 441017
new TASK_PUG_END = 778745
new TASK_HUD_MONEY = 12412
new captainrun
new const TAG[] = "^4[GAMERSintronycz]^1"
enum _:PUGSTATE
{
NO_ALIVE = 0,
ALIVE,
COMMENCING
}
enum _:PUG_ROUND
{
TT = 0,
CT
}
new bool:RoundRestart
new Trie:t_Command
new Trie:t_Command_Plugin
new pug_state
new g_PluginId
new iMaxPlayers
new bool:ready[MAXPLAYERS]
new ready_count
new HamHook:SpawnWeapon
new HamHook:DefuseKit
new HamHook:PlayerPostink
new HamHook:PlayerSpawn
new bool:vote_map
new bool:vote_knife
new g_vote_id
new g_pcvar_votemap
new g_vote_countdown
new bool:private
new Trie:g_private
new bool:round_knife
new bool:half_time
new team_check_id
new team_check_time
new Float:last_damage[MAXPLAYERS][MAXPLAYERS]
new bool:round_start
new g_forward
new g_forward_round_end
new bool:round_knife_start_vote
new bool:torneo_limit
new ct
new tt
new Sync[4]
new pcvar_max_players
new g_iDmg[MAXPLAYERS][MAXPLAYERS]
new g_iHits[MAXPLAYERS][MAXPLAYERS]
new Array:g_maps
new g_votes[32]
new g_iRound_team[2]
new g_iRounds
new g_iFrags[MAXPLAYERS]
new g_iDeaths[MAXPLAYERS]
new kick_time[33]
new g_vote_count
new g_VoteMenu
new gMsgStatusIcon
new gMsgRegisterStatusIcon
new gMsgServerName
new gMsgTextMsg
new gMsgScoreInfo
new gMsgTeamScore
new bool:is_intermission
new SND_MUSIC[][] =
{
"sound/pug/wonround1.mp3"
}
new SND_COUNTER_BEEP[] = "sound/UI/buttonrollover.wav"
new SND_STINGER[] = "sound/pug/Pug_cs_stinger.wav"
enum _:CMDS
{
COMMAND[40],
VALUE[10]
}
new Pregame_Cmds[][CMDS] =
{
{"mp_forcerespawn", "1"},
{"mp_round_infinite", "acdefg"},
{"mp_auto_reload_weapons", "1"},
{"mp_auto_join_team", "0"},
{"mp_autoteambalance", "0"},
{"mp_limitteams", "1"},
{"mp_freezetime", "0"},
{"mp_timelimit", "0"},
{"mp_refill_bpammo_weapons", "3"},
{"mp_startmoney", "16000"},
{"sv_alltalk", "1"},
{"mp_buytime", "-1"},
{"mp_consistency", "1"},
{"mp_flashlight", "0"},
{"mp_forcechasecam", "0"},
{"mp_forcecamera", "0"},
{"mp_item_staytime", "0"},
{"mp_roundtime", "0"},
{"allow_spectators", "1"},
{"mp_friendlyfire", "0"},
{"mp_respawn_immunitytime", "5"},
{"mp_roundrespawn_time", "0"},
{"sv_timeout", "20"},
{"sv_rehlds_stringcmdrate_burst_punish", "-1"},
{"sv_rehlds_stringcmdrate_avg_punish ", "-1"},
{"sv_rehlds_movecmdrate_burst_punish", "-1"},
{"sv_rehlds_movecmdrate_avg_punish", "-1"},
{"sv_rehlds_force_dlmax", "1"}
}
new PugStartCmds[][CMDS] =
{
{"mp_forcerespawn", "0"},
{"mp_startmoney", "800"},
{"sv_alltalk", "2"},
{"mp_limitteams", "0"},
{"mp_refill_bpammo_weapons", "0"},
{"mp_buytime", ".25"},
{"mp_forcechasecam", "2"},
{"mp_item_staytime", "300"},
{"mp_forcecamera", "2"},
{"mp_freezetime", "12"},
{"mp_roundtime", "1.75"},
{"mp_respawn_immunitytime", "0"},
{"mp_roundrespawn_time", "10"},
{"mp_auto_join_team", "0"}
}
public plugin_init()
{
g_PluginId = register_plugin(PLUGIN, VERSION, AUTHOR)
pug_state = NO_ALIVE
register_clcmd("say", "pfn_Hook_Say")
register_clcmd("say_team", "pfn_Hook_Say")
SpawnWeapon = RegisterHam(Ham_Spawn, "weaponbox", "pfn_remove_weapon", 1)
PlayerPostink = RegisterHam(Ham_Player_PostThink, "player", "pfn_postink", 1)
PlayerSpawn = RegisterHam(Ham_Spawn, "player", "pfn_player_spawn", 1)
DisableHamForward(PlayerSpawn)
DisableHamForward(PlayerPostink)
register_event("Money", "pfn_money", "b");
DefuseKit = RegisterHam(Ham_Spawn, "item_thighpack", "pfn_remove_weapon", 1)
g_private = TrieCreate()
g_pcvar_votemap = register_cvar("pug_votemap", "1")
t_Command = TrieCreate()
t_Command_Plugin = TrieCreate()
g_maps = ArrayCreate(32)
iMaxPlayers = get_maxplayers();
Sync[0] = CreateHudSyncObj()
Sync[1] = CreateHudSyncObj()
Sync[2] = CreateHudSyncObj()
Sync[3] = CreateHudSyncObj()
gMsgStatusIcon = get_user_msgid("StatusIcon")
gMsgServerName = get_user_msgid("ServerName")
gMsgTextMsg = get_user_msgid("TextMsg")
gMsgScoreInfo = get_user_msgid("ScoreInfo")
gMsgTeamScore = get_user_msgid("TeamScore")
g_forward = CreateMultiForward("pug_end", ET_STOP, FP_CELL)
g_forward_round_end = CreateMultiForward("pug_round_end", ET_STOP, FP_CELL)
register_message(gMsgTeamScore, "pfn_TeamScore")
pcvar_max_players = register_cvar("pug_players", "10")
register_event("HLTV", "EV_new_round", "a", "1=0", "2=0")
set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
register_message(get_user_msgid("TextMsg"), "message_textmsg")
RegisterHookChain(RG_RoundEnd, "pfn_Round_End_Hook")
RegisterHookChain(RG_HandleMenu_ChooseTeam, "pfn_Hook_ChooseTeam")
register_event("Damage", "pfn_EVENT_damage", "b")
register_message(gMsgTextMsg, "pfn_TextMsg")
register_message(gMsgScoreInfo, "pfn_ScoreInfo")
register_message(get_user_msgid("SendAudio"), "pfnSendAudioHook")
register_event("DeathMsg", "pfn_PlayerDeath", "a")
pug_register_command(".ready", "pfn_ready", g_PluginId)
pug_register_command(".listo", "pfn_ready", g_PluginId)
pug_register_command(".gaben", "pfn_ready", g_PluginId)
pug_register_command(".notready", "pfn_unready", g_PluginId)
pug_register_command(".noready", "pfn_unready", g_PluginId)
pug_register_command(".nolisto", "pfn_unready", g_PluginId)
pug_register_command(".unready", "pfn_unready", g_PluginId)
pug_register_command(".start", "pfn_force_start_pug", g_PluginId)
pug_register_command(".forceready", "pfn_forceready", g_PluginId)
pug_register_command(".cancel", "pfn_force_cancel", g_PluginId)
pug_register_command(".dmg", "cmd_dmg", g_PluginId)
pug_register_command(".rr", "cmd_restart", g_PluginId)
pug_register_command(".hp", "cmd_hp", g_PluginId)
set_task(1.0, "start_pregame")
read_maps()
}
public pfnSendAudioHook(m, e, id)
{
new sz[20]
get_msg_arg_string(2, sz, charsmax(sz))
if(equal(sz, "%!MRAD_ctwin") || equal(sz, "%!MRAD_terwin") || equal(sz, "%!MRAD_BOMBDEF"))
{
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public pfn_player_spawn(id)
{
if(!is_user_alive(id))
{
return
}
if(round_knife)
{
rg_remove_all_items(id)
rg_give_item(id, "weapon_knife")
set_member(id, m_iAccount, 1)
}
}
public pfn_money(id)
{
if(round_knife)
{
set_member(id, m_iAccount, 1)
return
}
if(pug_state == ALIVE)
{
if(get_member_game(m_bFreezePeriod))
{
update_team_money(get_user_team(id))
}
return
}
set_member(id, m_iAccount, 16000)
}
public pfn_PlayerDeath()
{
if(pug_state == ALIVE && !is_intermission && !round_knife )
{
new v = read_data(2)
new k = read_data(1)
if(get_user_team(v) == get_user_team(k) || v == k) // victima es mismo equipo que asesina ó es victima es igual al asesino
{
g_iDeaths[v]++
g_iFrags[k]-- // le restamos 1 frag al asesino
}
else //si no..
{
g_iFrags[k]++
g_iDeaths[v]++
}
if(!torneo_limit){
cmd_dmg(v)
}
}
}
public pfn_ScoreInfo(m, s, id)
{
static _score_player_id
_score_player_id = get_msg_arg_int(1)
if(pug_state == ALIVE && !round_knife)
{
set_msg_arg_int(2, ARG_SHORT, g_iFrags[_score_player_id])
set_msg_arg_int(3, ARG_SHORT, g_iDeaths[_score_player_id])
}
}
public cmd_hp(id)
{
if(pug_state != ALIVE || is_user_alive(id))
{
client_print_color(id, id, "%s No puedes usar este comando en este momento", TAG)
return
}
if(torneo_limit){
client_print_color(id, id, "%s Accion no permitida en modo torneo", TAG)
return;
}
new team = get_user_team(id)
new name[32]
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(team == get_user_team(i) || !is_user_alive(i)) continue
get_user_name(i, name, 32)
client_print_color(id, id, "%s ^x3%s ^x4(^x1HP:^x3%i^x4)", TAG, name, get_user_health(i))
}
}
public pfn_EVENT_damage(id)
{
new a = get_user_attacker(id)
new damage = read_data(2)
if(pug_state != ALIVE || !is_user_alive(a) || !(1 <= a <= iMaxPlayers) || a == id || damage <= 0)
{
return
}
g_iDmg[id][a] += damage
g_iHits[id][a] += 1
last_damage[id][a] = get_gametime() + 0.5
}
public cmd_dmg(id)
{
if(pug_state != ALIVE || (is_user_alive(id) && round_start))
{
client_print_color(id, id, "%s No puedes usar este comando en este momento", TAG)
return
}
new tmp_name[32], count
client_print(id, print_console, "===========[ DMG ]===========")
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(g_iHits[i][id] > 0)
{
if(!is_user_connected(i))
{
continue;
}
get_user_name(i, tmp_name, charsmax(tmp_name))
client_print_color(id, id, "%s ^x3%s ^x4(^1Daño:^x3%i ^x1- Hits:^x3%i^x4)", TAG, tmp_name, g_iDmg[i][id], g_iHits[i][id])
client_print(id, print_console, "%s | Dmg: %i | Hits: %i", tmp_name, g_iDmg[i][id], g_iHits[i][id])
count++
}
}
if(!count)
{
client_print_color(id, id, "%s No Le diste a nadie en esta ronda", TAG)
console_print(id, "%s No Le diste a nadie en esta ronda", TAG)
}
client_print(id, print_console, "=============================")
}
public cmd_rdmg(id)
{
if(pug_state != ALIVE || (is_user_alive(id) && round_start))
{
client_print_color(id, id, "%s No puedes usar este comando en este momento", TAG)
return
}
new tmp_name[32], count
client_print(id, print_console, "^4===========[ R.DMG ]===========")
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(g_iHits[id][i] > 0)
{
if(!is_user_connected(i))
{
continue;
}
get_user_name(i, tmp_name, charsmax(tmp_name))
client_print_color(id, id, "%s ^x3%s ^x4(^1Daño Recibido:^x3%i ^x1- Hits:^x3%i^x4)", TAG, tmp_name, g_iDmg[id][i], g_iHits[id][i])
client_print(id, print_console, "%s | R.Dmg: %i | Hits: %i", tmp_name, g_iDmg[id][i], g_iHits[id][i])
count++
}
}
if(!count)
{
client_print_color(id, id, "%s No recibistes daño en esta ronda", TAG)
console_print(id, "%s No recibiste daño en esta ronda", TAG)
}
client_print(id, print_console, "=============================")
}
public pfn_TeamScore(m, e, id)
{
static _____team_score[2]
get_msg_arg_string(1, _____team_score, charsmax(_____team_score))
switch(_____team_score[0])
{
case 'T' : set_msg_arg_int(2, ARG_SHORT, g_iRound_team[TT])
case 'C' : set_msg_arg_int(2, ARG_SHORT, g_iRound_team[CT])
}
}
public newRound(id)
{
fn_update_server_name(id)
}
public pfn_Round_End_Hook(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
{
if(pug_state == NO_ALIVE || event == ROUND_GAME_RESTART || event == ROUND_GAME_COMMENCE || status == WINSTATUS_DRAW)
{
return HC_CONTINUE
}
else if(is_intermission)
{
SetHookChainReturn(ATYPE_INTEGER, 1)
return HC_SUPERCEDE
}
if(round_knife)
{
client_print_color(0, 0, "%s Ronda cuchillo finalizada, elegiran equipo los ^x3%s", TAG, status == WINSTATUS_CTS ? "Anti-Terroristas" : "Terroristas")
round_knife = false
#if defined END_ROUND_KNIFE_FIX
set_cvar_num(Pregame_Cmds[1][COMMAND], 1)
#endif
DisableHamForward(PlayerSpawn)
Send_TextMsg(status == WINSTATUS_TERRORISTS ? "#Terrorists_Win" : status == WINSTATUS_CTS ? "#CTs_Win" : "")
start_vote_win_team_knife(status == WINSTATUS_TERRORISTS ? 1 : 2)
DisableHamForward(SpawnWeapon)
unregister_message(gMsgStatusIcon, gMsgRegisterStatusIcon)
rg_send_audio(0, status == WINSTATUS_TERRORISTS ? "%!MRAD_terwin" : status == WINSTATUS_CTS ? "%!MRAD_ctwin" : "%!MRAD_rounddraw", PITCH_NORM)
SetHookChainReturn(ATYPE_INTEGER, 1)
return HC_SUPERCEDE
}
round_start = false
if(status == WINSTATUS_CTS)
{
g_iRound_team[CT]++
emessage_begin(MSG_ALL, gMsgTeamScore)
ewrite_string("CT")
ewrite_short(g_iRound_team[CT])
emessage_end()
if(event == ROUND_BOMB_DEFUSED)
{
client_cmd(0, "spk ^"radio/bombdef ctwin^"")
}
else
{
client_cmd(0, "spk radio/ctwin")
}
ExecuteForward(g_forward_round_end, _, 2)
}
else if(status == WINSTATUS_TERRORISTS)
{
client_cmd(0, "spk radio/terwin")
g_iRound_team[TT]++
emessage_begin(MSG_ALL, gMsgTeamScore)
ewrite_string("TERRORIST")
ewrite_short(g_iRound_team[TT])
emessage_end()
ExecuteForward(g_forward_round_end, _, 1)
}
fn_update_server_name(0)
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(is_user_alive(i))
{
set_task(0.1, "cmd_rdmg", i)
}
}
if(g_iRounds == 15 && !half_time)
{
EnableHamForward(PlayerPostink)
client_cmd(0, "+strafe")
g_vote_countdown = 11
set_task(14.0, "Hud2", 0)
set_task(1.0, "pfn_intermission_count", TASK_HUD_READY, _, _, "b")
rg_round_end(float(g_vote_countdown) + 0.5, WINSTATUS_DRAW, ROUND_NONE, "", "")
is_intermission = true
half_time = true
Send_TextMsg(status == WINSTATUS_TERRORISTS ? "#Terrorists_Win" : status == WINSTATUS_CTS ? "#CTs_Win" : "")
client_cmd(0, "mp3 play ^"%s^"", SND_MUSIC[random_num(0, charsmax(SND_MUSIC))])
cmdDirector(0, "MP3FadeTime 0.5")
SetHookChainReturn(ATYPE_INTEGER, 1)
return HC_SUPERCEDE
}
else if(g_iRounds == 30 || g_iRound_team[CT] >= 16 || g_iRound_team[TT] >= 16)
{
EnableHamForward(PlayerPostink)
client_cmd(0, "+strafe")
g_vote_countdown = 15
set_task(1.0, "pfn_pug_end_countdown", TASK_PUG_END, _, _, "b")
is_intermission = true
ExecuteForward(g_forward, _, status == WINSTATUS_TERRORISTS ? 1 : status == WINSTATUS_CTS ? 2 : 0)
Send_TextMsg(status == WINSTATUS_TERRORISTS ? "#Terrorists_Win" : status == WINSTATUS_CTS ? "#CTs_Win" : "")
client_cmd(0, "mp3 play ^"%s^"", SND_MUSIC[random_num(0, charsmax(SND_MUSIC))])
cmdDirector(0, "MP3FadeTime 0.5")
SetHookChainReturn(ATYPE_INTEGER, 1)
return HC_SUPERCEDE
}
return HC_CONTINUE
}
public start_vote_win_team_knife(team)
{
arrayset(g_votes, 0, sizeof(g_votes))
g_vote_count = 0
set_task(5.0, "end_vote_team_win_knife", TASK_END_VOTE)
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(get_user_team(i) == team)
{
make_vote_win_team_knife(i);
}
}
}
make_vote_win_team_knife(id)
{
round_knife_start_vote = true
new menu = menu_create("\r¿Cambiar el equipo actual?", "mh_vote_team_win_knife")
menu_additem(menu, "Si")
menu_additem(menu, "No")
menu_setprop(menu, MPROP_EXIT, MEXIT_NEVER)
menu_display(id, menu, 0, 5)
}
public mh_vote_team_win_knife(id, menu, item)
{
if(item == MENU_EXIT || !round_knife_start_vote)
{
menu_destroy(menu)
return
}
menu_destroy(menu)
if(item > 2)
{
return
}
g_votes[item] += 1
g_vote_count += 1
if(g_vote_count >= get_team_num(get_user_team(id)))
{
end_vote_team_win_knife(TASK_END_VOTE)
}
return
}
public end_vote_team_win_knife(task)
{
remove_task(task)
new w = 0;
for(new i = 0 ; i < sizeof (g_votes) ; i++)
{
if(g_votes[w] > g_votes[i])
{
w = i
}
}
if(g_vote_count <= 0)
{
w = 0;
}
if(w)
{
for(new i = 1 ; i <= get_pcvar_num(pcvar_max_players) ; i++)
{
if(!is_user_connected(i))
{
continue;
}
rg_switch_team(i)
}
}
arrayset(g_votes, 0, sizeof(g_votes))
g_vote_count = 0;
round_knife_start_vote = false
set_cvar_num("sv_restart", 1)
}
get_team_num(team)
{
new count = 0
for(new i = 1 ; i <= get_playersnum() ;i++)
{
if(!is_user_connected(i))
{
continue
}
if(get_user_team(i) == team)
{
count += 1
}
}
return count
}
public end_dmg()
{
for(new i = 1; i <= get_playersnum() ; i++)
{
if(is_user_alive(i) && !torneo_limit)
{
cmd_dmg(i);
}
}
}
stock Send_TextMsg(msg[])
{
message_begin(MSG_BROADCAST, gMsgTextMsg)
write_byte(4)
write_string(msg)
message_end()
}
public pfn_pug_end_countdown(task)
{
g_vote_countdown--
if(g_vote_countdown > 0)
{
if(g_iRound_team[CT] == g_iRound_team[TT])
{
send_server_name(0, "Empate 00:%02i", g_vote_countdown)
}
else if(g_iRound_team[CT] >= g_iRound_team[TT])
{
send_server_name(0, "Anti-Terroristas Ganan 00:%02i", g_vote_countdown)
}
else
{
send_server_name(0, "Los Terroristas Ganan 00:%02i", g_vote_countdown)
}
}
else
{
DisableHamForward(PlayerPostink)
client_cmd(0, "-strafe")
remove_task(task)
start_pregame()
client_cmd(0, "-showscores")
cmdDirector(0, "MP3FadeTime 0.5")
cmdDirector(0, "cd fadeout")
fn_update_server_name(0)
}
}
send_server_name(id, msg[], any:...)
{
new fmt[33]
vformat(fmt, charsmax(fmt), msg, 3)
message_begin(id ? MSG_ONE_UNRELIABLE : MSG_ALL, gMsgServerName, _, id)
write_string(fmt)
message_end()
message_begin(MSG_ALL, gMsgScoreInfo)
write_byte(33)
write_short(0)
write_short(0)
write_short(0)
write_short(0)
message_end()
}
public pfn_intermission_count(task)
{
g_vote_countdown--
if(g_vote_countdown > 0)
{
send_server_name(0, "Cambio de equipos 00:%02i", g_vote_countdown)
}
else
{
cmdDirector(0, "MP3FadeTime 0.5")
cmdDirector(0, "cd fadeout")
remove_task(task)
DisableHamForward(PlayerPostink)
client_cmd(0, "-strafe")
new temp = g_iRound_team[CT]
g_iRound_team[CT] = g_iRound_team[TT]
g_iRound_team[TT] = temp
for(new i = 1 ; i<= iMaxPlayers ;i++)
{
if(!is_user_connected(i) || !(1<= get_user_team(i) <= 2))
{
continue
}
rg_switch_team(i)
set_member(i, m_iAccount, 800);
if(is_user_alive(i))
{
rg_set_user_armor(i, 0, ARMOR_NONE)
rg_give_default_items(i)
if(get_member(i, m_bHasC4))
{
rg_give_item(i, "weapon_c4", GT_REPLACE)
}
}
}
fn_update_server_name(0)
client_cmd(0, "-showscores")
Reset_Scores()
}
}
fn_update_server_name(id)
{
new szFmt[40]
if(round_knife)
{
formatex(szFmt, charsmax(szFmt), "Ronda de cuchillos")
}
else if(pug_state != NO_ALIVE)
{
if(g_iRound_team[CT] == g_iRound_team[TT]){
formatex(szFmt, charsmax(szFmt), "Ronda: %i/30 | CT: %i Vs TT: %i", g_iRounds, g_iRound_team[CT], g_iRound_team[TT])
}
else if(g_iRound_team[CT] > g_iRound_team[TT]){
formatex(szFmt, charsmax(szFmt), "Ronda: %i/30 | CT: %i Vs TT: %i", g_iRounds, g_iRound_team[CT], g_iRound_team[TT])
}
else{
formatex(szFmt, charsmax(szFmt), "Ronda: %i/30 | TT: %i Vs CT: %i", g_iRounds, g_iRound_team[TT], g_iRound_team[CT])
}
}
else
{
formatex(szFmt, charsmax(szFmt), "Esperando Jugadores")
}
send_server_name(id, szFmt)
if(pug_state != NO_ALIVE)
{
if(round_knife)
{
formatex(szFmt, charsmax(szFmt), "Ronda de cuchillos")
}
else if(g_iRound_team[CT] == g_iRound_team[TT])
{
formatex(szFmt, charsmax(szFmt), "Ronda: %i/30 | CT: %i Vs TT: %i", g_iRounds, g_iRound_team[CT], g_iRound_team[TT])
}
else if(g_iRound_team[CT] > g_iRound_team[TT])
{
formatex(szFmt, charsmax(szFmt), "Ronda: %i/30 | CT: %i Vs TT: %i", g_iRounds, g_iRound_team[CT], g_iRound_team[TT])
}
else
{
formatex(szFmt, charsmax(szFmt), "Ronda: %i/30 | TT: %i Vs CT: %i", g_iRounds, g_iRound_team[TT], g_iRound_team[CT])
}
set_member_game(m_GameDesc, szFmt)
}
else
{
set_member_game(m_GameDesc, "Esperando Jugadores")
}
}
public pfn_show_money(tid)
{
update_team_money(1)
update_team_money(2)
}
update_team_money(team)
{
new hud[256], name[32]
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(!is_user_connected(i) || get_user_team(i) != team)
{
continue
}
get_user_name(i, name, 31)
format(hud, charsmax(hud), "%s%s - $%i^n", hud, name, get_member(i, m_iAccount))
}
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(!is_user_connected(i) || get_user_team(i) != team)
{
continue
}
}
}
public EV_new_round()
{
if(pug_state == NO_ALIVE)
{
return
}
else if(pug_state == COMMENCING)
{
set_cvar_num("mp_round_infinite", 0);
pug_state = ALIVE;
}
if(is_intermission)
{
is_intermission = false
g_iRounds += 1
}
else if(!RoundRestart)
{
g_iRounds += 1
}
else
{
if(g_iRounds < 13){
g_iRounds = 1
g_iRound_team[TT] = 0
g_iRound_team[CT] = 0
}
RoundRestart = false
}
round_start = true
if(round_knife)
{
fn_update_server_name(0)
client_print_color(0, 0, "%s Ronda cuchillo, el equipo ganador elegira equipo", TAG)
return
}
if(team_check_id > 0)
{
new count = 0
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(!is_user_connected(i) ||get_user_team(i) != team_check_id)
{
continue
}
count++
}
if(count <= 2)
{
if(get_systime() >= team_check_time)
{
client_print_color(0, 0, "%s Partida cancelada por falta de jugadores", TAG)
client_print_color(0, 0, "%s En el equipo ^x3%s", TAG, team_check_id == 1 ? "Terrorista" : "Anti-Terrorista")
team_check_id = 0
start_pregame()
return
}
else
{
new p_time = ((team_check_time - get_systime()) / 60) + 1
client_print_color(0, team_check_id == 1 ? print_team_red : print_team_blue, "%s Esperando minimo de judadores del equipo ^x3%s", TAG, team_check_id == 1 ? "Terrorista" : "Anti-Terrorista")
client_print_color(0, team_check_id == 1 ? print_team_red : print_team_blue, "%s La partida se cancelara en ^x3%i ^x1minuto%s", TAG, p_time, p_time > 1 ? "s" : "")
}
}
else
{
team_check_id = 0
}
}
if(team_check_id == 0)
{
new t_count = 0
new ct_count = 0
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(!is_user_connected(i))
{
continue;
}
switch(get_user_team(i))
{
case 1 : t_count++
case 2 : ct_count++
}
}
if(t_count <= 2 || ct_count <= 2)
{
team_check_id = t_count <= 2 ? 1 : 2
team_check_time = get_systime() + 180
client_print_color(0, team_check_id == 1 ? print_team_red : print_team_blue, "%s Esperando minimo de judadores del equipo ^x3%s", TAG, team_check_id == 1 ? "Terrorista" : "Anti-Terrorista")
client_print_color(0, team_check_id == 1 ? print_team_red : print_team_blue, "%s La partida se cancelara en^x3 3 ^x1minutos", TAG)
}
}
set_task(1.0, "pfn_show_money", TASK_HUD_MONEY, "", 0, "a", get_cvar_num("mp_freezetime"))
#if defined END_ROUND_KNIFE_FIX
if(g_iRounds == 1)
{
set_cvar_num(Pregame_Cmds[1][COMMAND], 0)
arrayset(g_iFrags, 0, MAXPLAYERS)
arrayset(g_iDeaths, 0, MAXPLAYERS)
}
#endif
if(g_iRounds == 15 || g_iRound_team[CT] == 15 || g_iRound_team[TT] == 15)
{
client_cmd(0, "spk ^"%s^"; spk ^"%s^"", SND_STINGER[6], SND_STINGER[6])
set_dhudmessage(255, 255, 255, -1.0, 0.3, 2, 1.0, 1.5)
if(g_iRounds == 30)
{
show_dhudmessage(0, "Ronda Final")
}
else
{
show_dhudmessage(0, "Punto de partido")
}
}
fn_update_server_name(0)
fn_score(0)
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
arrayset(g_iDmg[i], 0, sizeof(g_iDmg))
arrayset(g_iHits[i], 0, sizeof(g_iHits))
}
return
}
public plugin_end()
{
TrieDestroy(t_Command)
TrieDestroy(t_Command_Plugin)
ArrayDestroy(g_maps)
}
stock is_user_admin(id)
{
new __flags=get_user_flags(id);
return (__flags>0 && !(__flags&ADMIN_USER));
}
read_maps()
{
new file[32]
new curmap[32]
ArrayPushString(g_maps, "Jugar Este Mapa")
get_mapname(curmap, charsmax(curmap))
if(!file_exists("mapcycle.txt"))
{
log_amx("%s Mapcycle.txt no existe", TAG)
return
}
new fh = fopen("mapcycle.txt", "r")
if(!fh)
{
log_amx("%s error con Mapcycle.txt", TAG)
return
}
while(!feof(fh))
{
fgets(fh, file, charsmax(file))
trim(file)
if(!file[0] || file[0] == ';' || equali(curmap, file))
{
continue;
}
ArrayPushString(g_maps, file)
}
fclose(fh)
}
stock bool:check_bsp_file(file[])
{
if(equal(file[strlen(file)-4], ".bsp"))
{
return true
}
return false
}
public pfn_postink(id)
{
if(!(1 <= get_user_team(id) <= 2))
{
return
}
set_pev(id, pev_maxspeed, 0.1)
if(pug_state == ALIVE)
{
client_cmd(id, "+showscores")
}
if(is_user_alive(id))
{
new ent = get_member(id, m_pActiveItem)
set_member(ent, m_Weapon_flNextPrimaryAttack, 2.0)
set_member(ent, m_Weapon_flNextSecondaryAttack, 2.0)
}
}
public pfn_remove_weapon(ent)
{
if(pug_state == ALIVE && !round_knife)
{
DisableHamForward(SpawnWeapon)
return
}
set_pev(ent, pev_flags, FL_KILLME)
}
reset_user_vars()
{
arrayset(ready, false, sizeof(ready))
ready_count = 0
g_vote_id = 0;
round_knife = false
half_time = false
RoundRestart = false
g_iRound_team[TT] = 0
g_iRound_team[CT] = 0
Reset_Scores()
}
Reset_Scores()
{
arrayset(g_iFrags, 0, MAXPLAYERS)
arrayset(g_iDeaths, 0, MAXPLAYERS)
}
stock pug_register_command(Command[], Function[], Plugin)
{
new funcid = get_func_id(Function, Plugin)
if(!funcid)
{
server_print("Funcion: ^"%s^" No encontrada", Function)
return
}
else if(TrieKeyExists(t_Command, Command))
{
server_print("Funcion ^"%s^" ya existente", Command)
return
}
TrieSetCell(t_Command, Command, Plugin)
TrieSetCell(t_Command_Plugin, Command, funcid)
}
public start_pregame()
{
for(new i = 0 ; i < sizeof(Pregame_Cmds) ; i++)
{
set_cvar_string(Pregame_Cmds[i][COMMAND], Pregame_Cmds[i][VALUE])
}
for(new c=1; c<=iMaxPlayers; c++){
if(!is_user_connected(c)) continue
kick_time[c] = 120
}
torneo_limit = false
is_intermission = false
pug_state = NO_ALIVE
gMsgRegisterStatusIcon = register_message(gMsgStatusIcon, "pfn_StatusIcon")
set_cvar_num("sv_restart", 1)
EnableHamForward(SpawnWeapon)
EnableHamForward(DefuseKit)
reset_user_vars()
fn_update_server_name(0)
if(get_pcvar_num(g_pcvar_votemap) == 1)
{
set_task(1.0, "pfn_Hud_Ready", TASK_HUD_READY, _, _, "b")
}
else
{
g_vote_countdown = 60
set_task(1.0, "pfn_waiting_players", TASK_HUD_READY, _, _, "b")
}
if(private)
{
set_cvar_string(Pregame_Cmds[3][COMMAND], "0")
}
}
public pfn_StatusIcon(m, e, id)
{
if(pug_state == ALIVE && !round_knife)
{
unregister_message(gMsgStatusIcon, gMsgRegisterStatusIcon)
return PLUGIN_CONTINUE
}
new arg[4]
get_msg_arg_string(2, arg, charsmax(arg))
if(equal(arg, "c4"))
{
client_cmd(id, "drop weapon_c4")
}
return PLUGIN_CONTINUE
}
public pfn_Hud_Ready(id)
{
set_hudmessage(242, 195, 43, 0.69, 0.04, 0, 0.0, 1.0, 0.01, 0.1)
new i;
new __pcount = 0
for(i = 1 ; i <= iMaxPlayers ;i++ )
{
if(!is_user_connected(i) || !(1 <= get_user_team(i) <= 2))
{
continue;
}
__pcount += 1
}
if(!task_exists(TASK_1))
{
set_task(1.0, "CountReadyKick", TASK_1, .flags="b")
}
ShowSyncHudMsg(0, Sync[0], "[SintronyczGamers]", __pcount , get_pcvar_num(pcvar_max_players))
new fmt[33 * 33], name[14];
copy(fmt, charsmax(fmt), "")
for(i = 1 ; i <= iMaxPlayers ;i++ )
{
if(!is_user_connected(i) || !(1 <= get_user_team(i) <= 2))
{
continue;
}
if(ready[i]){
get_user_name(i, name, charsmax(name))
format(fmt, charsmax(fmt), "%s%s^n", fmt, name)
}
else{
get_user_name(i, name, charsmax(name))
format(fmt, charsmax(fmt), "%s%s^n", fmt, name)
}
}
set_hudmessage(255, 255, 255, 0.68, 0.09, 0, 0.0, 1.0, 0.01, 0.1)
ShowSyncHudMsg(0, Sync[1], fmt)
copy(fmt, charsmax(fmt), "")
for(i = 1 ; i <= iMaxPlayers ;i++ )
{
if(!is_user_connected(i) || !(1 <= get_user_team(i) <= 2))
{
continue;
}
if(ready[i]){
format(fmt, charsmax(fmt), "%s - Listo^n", fmt)
}
else{
new formato[12]
format(formato, charsmax(formato), "(%02i:%02i) %s.", kick_time[i] / 60, kick_time[i] % 60, kick_time[i]>59?"min":"seg")
format(fmt, charsmax(fmt), "%s - %s^n", fmt, formato)
}
}
set_hudmessage(random_num(1, 255), random_num(1, 255), random_num(1, 255), 0.85, 0.09, 2, 0.0, 1.0, 0.01, 0.1)
ShowSyncHudMsg(0, Sync[2], fmt)
center_print(0, "Esperando jugadores (%d/%d)^n^n^n^n^n^n", __pcount, get_pcvar_num(pcvar_max_players))
}
public CountReadyKick()
{
for(new k=1; k<=iMaxPlayers; k++){
if(ready[k] || !is_user_connected(k) || !(1 <= get_user_team(k) <= 2)) continue
if(pug_state == ALIVE)
{
if(task_exists(TASK_1))
{
remove_task(TASK_1)
}
}
if(kick_time[k] < 1){
server_cmd("kick ^"#%d^" 'Fuistes expulsado por no dar .ready'", get_user_userid(k))
new nf[20]
get_user_name(k, nf, charsmax(nf))
client_print_color(0, 0, "%s El jugador ^x3%s^x1 fue expulsado por no usar ^x3.ready", TAG, nf)
}
else{
kick_time[k]--
if(kick_time[k] <= 10){
client_print_color(k, k,"%s Seras expulsado en ^x3%i ^x1segundos", TAG, kick_time[k])
}
}
}
}
public plugin_natives()
{
register_native("pug_register_command", "native_register_command", .style=0)
register_native("pug_get_state", "native_pug_get_state")
register_native("pug_is_ready", "native_is_ready")
}
public native_is_ready(pl, pr)
{
new u = get_param(1)
if(!(1 <= u <= iMaxPlayers))
{
return false
}
return ready[u]
}
public native_pug_get_state(pl, pr)
{
return pug_state;
}
public native_register_command(pl, pr)
{
new szCommand[20], szForward[32]
get_string(1, szCommand, charsmax(szCommand))
get_string(2, szForward, charsmax(szForward))
pug_register_command(szCommand, szForward, pl)
}
public pfn_Hook_Say(id)
{
if(!is_user_connected(id))
{
return PLUGIN_CONTINUE
}
static said[32]
read_argv(1, said, charsmax(said))
remove_quotes(said)
trim(said)
if(TrieKeyExists(t_Command, said))
{
new iPlugin, iFunc
TrieGetCell(t_Command, said, iPlugin)
TrieGetCell(t_Command_Plugin, said, iFunc)
callfunc_begin_i(iFunc, iPlugin)
callfunc_push_int(id)
callfunc_end()
return PLUGIN_HANDLED_MAIN
}
return PLUGIN_CONTINUE
}
public pfn_ready(id)
{
if(pug_state != NO_ALIVE || !(1 <= get_user_team(id) <= 2))
{
client_print_color(id, id, "%s No puedes usar este comando en este momento", TAG)
return PLUGIN_HANDLED
}
else if(ready[id])
{
client_print_color(id, id, "%s Ya estas listo", TAG)
return PLUGIN_HANDLED
}
new name[32]
get_user_name(id, name, charsmax(name))
client_print_color(0, 0, "%s ^x3%s^x1 Esta Listo", TAG, name)
ready[id] = true
ready_count ++
if(ready_count == get_pcvar_num(pcvar_max_players))
{
start_vote()
}
return PLUGIN_HANDLED
}
public pfn_unready(id)
{
if(pug_state != NO_ALIVE)
{
client_print_color(id, id, "%s No puedes usar este comando en este momento", TAG)
return PLUGIN_HANDLED
}
else if(!ready[id])
{
client_print_color(id, id, "%s Aun no estas listo", TAG)
return PLUGIN_HANDLED
}
new name[32]
get_user_name(id, name, charsmax(name))
client_print_color(0, 0, "%s ^x3%s^x1 Dejo de estar Listo", TAG, name)
ready[id] = false;
ready_count --
kick_time[id] = 120
return PLUGIN_HANDLED
}
public pfn_TextMsg(m, e, id)
{
static msg[23]
get_msg_arg_string(2, msg, charsmax(msg))
if(equal(msg, "#Game_will_restart_in"))
{
if(pug_state == ALIVE)
{
if(round_knife)
{
round_knife = false
}
RoundRestart = true
}
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public pfn_Hook_ChooseTeam(id, _:slot)
{
if(captainrun || is_intermission || round_knife || round_knife_start_vote){
center_print(id, "No puedes elegir equipo en este momento^n^n^n^n^n")
SetHookChainReturn(ATYPE_INTEGER, 0)
return HC_BREAK
}
new players[32], count_t, count_ct
get_players(players, count_t, "e", "TERRORIST")
get_players(players, count_ct, "e", "CT")
if(!(1 <= slot <= 2))
{
if(slot == 5)
{
if(count_t >= (get_pcvar_num(pcvar_max_players) / 2) && count_ct >= (get_pcvar_num(pcvar_max_players) / 2) )
{
client_print_color(id, id, "%s Todos los equipos se encuentran llenos", TAG)
SetHookChainReturn(ATYPE_INTEGER, 0)
return HC_BREAK
}
}
else{
client_print_color(id, id, "%s Modo Espectador no permitido", TAG)
SetHookChainReturn(ATYPE_INTEGER, 0)
return HC_BREAK
}
return HC_CONTINUE
}
else if((1 <= slot <= 2) && (1 <= get_user_team(id) <= 2) && pug_state == ALIVE)
{
client_print_color(id, id, "%s No puedes hacer un cambio de equipos estando una partida en curso", TAG)
SetHookChainReturn(ATYPE_INTEGER, 0)
return HC_BREAK
}
new count
get_players(players, count, "e", slot == 1 ? "TERRORIST" : "CT")
if(count >= (get_pcvar_num(pcvar_max_players) / 2) )
{
center_print(id, "Este Equipo esta lleno^n^n^n^n^n")
SetHookChainReturn(ATYPE_INTEGER, 0)
return HC_BREAK
}
return HC_CONTINUE
}
stock center_print(id, const msg[], any:...)
{
new arg[70]
vformat(arg, charsmax(arg), msg, 3)
if(id == 0)
{
for(new z = 1 ; z <= iMaxPlayers ; z++)
{
if(!is_user_connected(z))
{
continue
}
engfunc(EngFunc_ClientPrintf, z, 1, arg)
}
}
else
{
engfunc(EngFunc_ClientPrintf, id, 1, arg)
}
}
public client_putinserver(id)
{
if(ready[id])
{
ready[id] = false
ready_count--
}
g_iFrags[id] = 0
g_iDeaths[id] = 0
fn_update_server_name(id)
if(private && pug_state != ALIVE)
{
set_task(1.0, "pfn_set_team", id + 666)
}
}
public pfn_set_team(id)
{
id -= 666
if(!is_user_connected(id))
return
static _c_team, _sz__steam_id_put[32]
get_user_authid(id, _sz__steam_id_put, charsmax(_sz__steam_id_put))
if(TrieKeyExists(g_private, _sz__steam_id_put))
{
TrieGetCell(g_private, _sz__steam_id_put, _c_team)
if(!(1<= _c_team <= 3))
{
return
}
if(_c_team == 3)
{
rg_join_team(id, TEAM_SPECTATOR)
return
}
if(get_user_team(id) == _c_team)
{
return
}
rg_set_user_team(id, _c_team == 1 ? TEAM_TERRORIST : TEAM_CT)
ExecuteHam(Ham_CS_RoundRespawn, id)
}
}
public client_connect(id)
{
kick_time[id] = 120
}
public client_disconnected(id)
{
if(is_intermission)
{
return
}
if(ready[id])
{
ready[id] = false
ready_count--
}
new team = get_user_team(id)
if(pug_state == ALIVE && (1 <= team <= 2))
{
if(captainrun){
if(id == tt || id == ct){
captainrun = false
fnTeamsRandomize()
}
}
new team = get_user_team(id)
new count = 0
for(new i = 1 ; i <= iMaxPlayers ;i++)
{
if(!is_user_connected(i) || i == id || get_user_team(i) != team)
{
continue
}
count++
}
if(count <= 2)
{
if(count == 0)
{
client_print_color(0, 0, "%s Partida cancelada por ausencia de jugadores en el equipo ^x3%s", TAG, team == 1 ? "Terrorista" : "Anti-Terrorista")
start_pregame()
return
}
if(team_check_id)
{
return
}
team_check_id = team
team_check_time = get_systime() + 180
client_print_color(0, 0, "%s Esperando minimo de judadores del equipo ^x3%s", TAG, team == 1 ? "Terrorista" : "Anti-Terrorista")
client_print_color(0, 0, "%s La partida se cancelara en^x3 3 ^x1minutos", TAG)
}
}
}
fn_score(id=0)
{
if(pug_state == NO_ALIVE)
{
client_print_color(id, id, "%s No puedes usar este comando en este momento", TAG)
return
}
if(g_iRound_team[CT] == g_iRound_team[TT])
{
client_print_color(0, 0, "%s Anti-Terroristas: ^x3%i ^x1- Terroristas: ^x3%i", TAG, g_iRound_team[CT], g_iRound_team[TT])
}
else
{
client_print_color(0, 0, "%s ^x1%s: ^x3%i ^x1- %s: ^x3%i ", TAG, g_iRound_team[CT] > g_iRound_team[TT] ? "Anti-Terroristas" : "Terroristas", g_iRound_team[CT] > g_iRound_team[TT] ? g_iRound_team[CT] : g_iRound_team[TT], g_iRound_team[CT] < g_iRound_team[TT] ? "Anti-Terroristas" : "Terroristas", g_iRound_team[CT] < g_iRound_team[TT] ? g_iRound_team[CT] : g_iRound_team[TT] )
}
}
public pfn_score(id)
{
fn_score(id)
}
public start_vote()
{
remove_task(TASK_HUD_READY)
remove_task(TASK_1)
g_vote_id = 0
next_vote()
}
make_hud_title(msg[], any:...)
{
new fmt[50]
vformat(fmt, charsmax(fmt), msg, 2)
set_hudmessage(0, 255, 0, -1.0, 0.0, 0, 1.0, 1.1)
ShowSyncHudMsg(0, Sync[0], fmt)
}
make_hud_body(msg[], any:...)
{
new fmt[512]
vformat(fmt, charsmax(fmt), msg, 2)
set_hudmessage(255, 255, 255, -1.0, 0.03, 0, 1.0, 1.1)
ShowSyncHudMsg(0, Sync[1], fmt)
}
public next_vote()
{
remove_task(TASK_HUD_VOTE)
remove_task(TASK_END_VOTE)
g_vote_id++
switch(g_vote_id)
{
case 1 :
{
if(get_pcvar_num(g_pcvar_votemap) == 1)
{
set_task(1.0, "pfn_hud_votemap", TASK_HUD_VOTE, _, _, "b")
set_task(11.0, "pfn_vote_map_end", TASK_END_VOTE)
g_vote_countdown = 10
start_vote_map()
}
else
{
set_pcvar_num(g_pcvar_votemap, 1)
next_vote();
}
}
case 2 :
{
set_task(1.0, "pfn_hud_vote_knife", TASK_HUD_VOTE, _, _, "b")
set_task(11.0, "pfn_vote_knife_end", TASK_END_VOTE)
g_vote_countdown = 10
start_vote_knife()
}
default :
{
start_countdown()
}
}
}
start_vote_knife()
{
g_vote_count = 0
vote_knife = true
set_task(1.0, "make_vote_knife")
}
public make_vote_knife()
{
arrayset(g_votes, 0, sizeof(g_votes))
g_VoteMenu = menu_create("\r[GAMERSintronycz] \wSorteo de Equipos", "mh_mode_vote")
menu_additem(g_VoteMenu, "Sin Sorteo")
menu_additem(g_VoteMenu, "Aleatorio")
menu_setprop(g_VoteMenu, MPROP_EXIT, MEXIT_ALL)
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(!is_user_connected(i))
{
continue
}
if( 1 <= get_user_team(i) <= 2)
{
menu_display(i, g_VoteMenu)
}
}
}
public mh_mode_vote(id, menu, item)
{
if(item == MENU_EXIT || !vote_knife)
{
return
}
if(item > 3)
{
return
}
g_votes[item]++
g_vote_count++
update_knife_hud()
if(g_vote_count >= get_playersnum())
{
remove_task(TASK_HUD_VOTE)
remove_task(TASK_END_VOTE)
pfn_vote_knife_end(TASK_END_VOTE)
}
}
public pfn_vote_knife_end(task)
{
remove_task(task)
new winner = 0
for(new i = 0 ; i < 4 ; i++)
{
if(g_votes[i] > g_votes[winner])
{
winner = i
}
}
switch(winner){
case 0: {
EnableHamForward(PlayerSpawn)
next_vote()
}
case 1: {
fnTeamsRandomize()
}
}
vote_knife = false
}
public pfn_hud_vote_knife(task)
{
if(g_vote_countdown-- > 0)
{
update_knife_hud()
}
else
{
remove_task(task)
}
}
update_knife_hud()
{
make_hud_title("Votacion de Equipos: (%i)", g_vote_countdown)
new _hud[100],c
for(new i = 0 ; i< sizeof g_votes ; i++)
{
if(g_votes[i] <= 0)
{
continue
}
switch(i)
{
case 0 :
{
format(_hud, charsmax(_hud), "%sSin Sorteo: %i voto%s^n", _hud, g_votes[i], g_votes[i] > 1 ? "s" : "")
c++
}
case 1 :
{
format(_hud, charsmax(_hud), "%sAleatorio: %i voto%s^n", _hud, g_votes[i], g_votes[i] > 1 ? "s" : "")
c++
}
}
}
if(c>0)
{
make_hud_body(_hud)
}
else
{
make_hud_body("No hay votos")
}
}
public start_countdown()
{
EnableHamForward(PlayerPostink)
client_cmd(0, "+strafe")
g_vote_countdown = 4
set_task(1.0, "pfn_starting_game", TASK_HUD_READY, _, _, "b")
pfn_starting_game(TASK_HUD_READY)
set_pcvar_num(g_pcvar_votemap, 1)
}
public start_pug()
{
set_cvar_num("sv_restart", 1)
for(new i = 0 ; i < sizeof(PugStartCmds) ;i++)
{
set_cvar_string(PugStartCmds[i][COMMAND], PugStartCmds[i][VALUE])
}
g_iRounds = 0;
arrayset(g_iRound_team, 0, 2)
arrayset(g_iFrags, 0, MAXPLAYERS)
arrayset(g_iDeaths, 0, MAXPLAYERS)
is_intermission = false
DisableHamForward(DefuseKit)
}
public pfn_hud_votemap()
{
if(g_vote_countdown-- <= 0)
{
g_vote_countdown = 0
}
fn_update_vote_map_hud()
}
fn_update_vote_map_hud()
{
make_hud_title("Votacion de Mapa: (%i)", g_vote_countdown)
new count
new hud[512]
new temp
for(new i = 0 ; i < ArraySize(g_maps) ; i++)
{
temp = g_votes[i]
if(temp >= 1)
{
count++
format(hud, charsmax(hud), "%s%a: %i %s^n", hud, ArrayGetStringHandle(g_maps, i), temp, temp > 1 ? "votos" : "voto")
}
}
if(!count)
{
formatex(hud, charsmax(hud), "No hay votos")
}
make_hud_body(hud)
}
public start_vote_map()
{
vote_map = true
g_vote_count = 0
set_task(1.0, "make_menu_votemap")
}
public make_menu_votemap()
{
g_VoteMenu = menu_create("\r[GAMERSintronycz] \wVotacion de Mapa", "mh_vote_map")
new map[32]
new i
for(i = 0 ; i < ArraySize(g_maps) ;i++)
{
ArrayGetString(g_maps, i, map, charsmax(map))
menu_additem(g_VoteMenu, map)
arrayset(g_votes, 0, sizeof(g_votes))
}
menu_setprop(g_VoteMenu, MPROP_EXIT, MEXIT_ALL)
for(i = 1 ; i <= iMaxPlayers ;i++ )
{
if(!is_user_connected(i) || !( 1 <= get_user_team(i) <= 2))
{
continue
}
menu_display(i, g_VoteMenu, .page=0)
}
}
public mh_vote_map(id, menu, item)
{
if(!vote_map)
{
return
}
if(item == MENU_EXIT)
{
g_votes[0]++
fn_update_vote_map_hud()
check_votes(vote_map);
return
}
g_votes[item]++
g_vote_count++
fn_update_vote_map_hud()
check_votes(vote_map);
}
public check_votes(bool:active)
{
if(!active)
{
return
}
if(g_vote_count == get_pcvar_num(pcvar_max_players))
{
remove_task(TASK_HUD_VOTE)
remove_task(TASK_END_VOTE)
pfn_vote_map_end();
}
}
public pfn_vote_map_end()
{
vote_map = false
client_cmd(0, "slot10")
menu_destroy(g_VoteMenu)
new winner, temp
for(new i = 0 ; i < sizeof (g_votes) ; i++)
{
if(temp < g_votes[i])
{
temp = g_votes[i]
winner = i
}
}
if(!winner)
{
client_print_color(0, 0, "%s Se decidio ^x3%a", TAG, ArrayGetStringHandle(g_maps, 0))
next_vote();
}
else
{
set_pcvar_num(g_pcvar_votemap, 0)
server_cmd("changelevel ^"%a^"", ArrayGetStringHandle(g_maps, winner))
}
}
public pfn_force_start_pug(id)
{
if(!(get_user_flags(id) & ADMIN_RCON))
{
client_print_color(id, id, "%s No tienes acceso a este comando", TAG)
return
}
else if(pug_state != NO_ALIVE)
{
client_print_color(id, id, "%s Pug ya iniciado", TAG)
return
}
new name[32]
get_user_name(id, name, charsmax(name))
client_print_color(0, 0, "%s Admin ^x3%s ^x1Ha iniciado la partida", TAG, name)
start_vote()
}
public pfn_force_cancel(id)
{
if(!is_user_admin(id))
{
client_print_color(id, id, "%s No tienes acceso a este comando", TAG)
return
}
else if(pug_state != ALIVE)
{
client_print_color(id, id, "%s Pug no iniciado", TAG)
return
}
new name[32]
get_user_name(id, name, charsmax(name))
client_print_color(0, 0, "%s ADMIN: ^x3%s ^x1Ha cancelado la partida", TAG, name)
start_pregame()
}
public cmd_restart(id)
{
if (!is_user_admin(id))
{
client_print_color(id, id, "%s No tienes acceso a este comando", TAG)
return
}
new name[32]
get_user_name(id, name, charsmax(name))
client_print_color(0, 0, "%s Admin ^x3%s ^x1Ha reiniciado la partida", TAG, name)
set_cvar_num("sv_restart", 1)
g_iRounds = 0;
arrayset(g_iRound_team, 0, 2)
arrayset(g_iFrags, 0, iMaxPlayers)
arrayset(g_iDeaths, 0, iMaxPlayers)
}
public pfn_forceready(id)
{
if(!is_user_admin(id))
{
client_print_color(id, id, "%s No tienes acceso a este comando", TAG)
return
}
else if(pug_state != NO_ALIVE)
{
client_print_color(id, id, "%s Pug ya iniciado", TAG)
return
}
new name[32]
get_user_name(id, name, charsmax(name))
client_print_color(0, 0, "%s Admin ^x3%s ^x1Ha forzado a estar Listo", TAG, name)
fn_forceready()
}
fn_forceready()
{
for(new i = 1 ; i<= iMaxPlayers ; i++)
{
if(!is_user_connected(i) || !(1<= get_user_team(i) <= 2) || ready[i])
{
continue
}
ready[i] = true;
ready_count++
if(ready_count == get_pcvar_num(pcvar_max_players))
{
start_vote()
}
}
}
public pfn_waiting_players(task)
{
new pcount = 0
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(!is_user_connected(i) || !(1 <= get_user_team(i) <= 2))
{
continue;
}
pcount++
}
if(g_vote_countdown -- > 0)
{
if(pcount == get_pcvar_num(pcvar_max_players))
{
center_print(0, "Calentamiento 00:%02i^n^n^n^n", g_vote_countdown)
if(g_vote_countdown < 5)
{
client_cmd(0, "spk ^"%s^"", SND_COUNTER_BEEP[6])
}
}
else
{
center_print(0, "Esperando jugadores 00:%02i^n^n^n^n", g_vote_countdown)
if(g_vote_countdown < 5)
{
client_cmd(0, "spk ^"%s^"", SND_COUNTER_BEEP[6])
}
}
remove_task(TASK_1)
}
else if(g_vote_countdown <= 0 && pcount == get_pcvar_num(pcvar_max_players))
{
remove_task(task)
next_vote()
}
else
{
set_pcvar_num(g_pcvar_votemap, 1)
remove_task(task)
start_pregame()
fn_forceready();
client_print_color(0, 0, "%s Partida no iniciada por la ausencia de jugadores", TAG)
}
}
public pfn_starting_game(task){
if(g_vote_countdown == 1){
start_pug()
pug_state = COMMENCING
}
if(g_vote_countdown -- > 0){
center_print(0, "Empezando Partida: %i^n^n^n^n", g_vote_countdown)
if(g_vote_countdown < 5)
{
client_cmd(0, "spk ^"%s^"", SND_COUNTER_BEEP[6])
}
}
else {
DisableHamForward(PlayerPostink)
client_cmd(0, "-strafe")
remove_task(task)
set_task(3.0, "Hud", 0)
}
}
public plugin_precache()
{
precache_generic(SND_COUNTER_BEEP)
precache_generic(SND_STINGER)
for(new i = 0 ; i < sizeof(SND_MUSIC) ; i++)
{
precache_generic(SND_MUSIC[i])
}
}
fnTeamsRandomize()
{
new iPlayers[MAX_PLAYERS],iNum;
get_players(iPlayers,iNum);
for(new i;i < iNum;i++)
{
if(!(1 <= get_user_team(iPlayers[i]) <= 2))
{
iPlayers[i--] = iPlayers[--iNum];
}
}
new iTeam = random(2) ? 1 : 2;
new iPlayer,iRandom;
while(iNum)
{
iRandom = random(iNum);
iPlayer = iPlayers[iRandom];
rg_set_user_team(iPlayer, iTeam == 1 ? TEAM_TERRORIST : TEAM_CT)
iPlayers[iRandom] = iPlayers[--iNum];
iTeam = ((_:iTeam) % 2 + 1);
}
EnableHamForward(PlayerSpawn)
next_vote()
}
stock cmdDirector(id, cmd[])
{
message_begin(id > 0 ? MSG_ONE : MSG_ALL, SVC_DIRECTOR, _, id > 0 ? id : 0)
write_byte(strlen(cmd) + 2)
write_byte(10)
write_string(cmd)
message_end()
}
public bomb_explode(planter)
{
if(pug_state == ALIVE){
g_iFrags[planter] += 3
}
}
public bomb_defused(defuser)
{
if(pug_state == ALIVE){
g_iFrags[defuser] += 3
}
}
public Hud(id)
{
set_dhudmessage(255, 255, 255, -1.0, -1.0, 1, 6.0, 7.0)
show_dhudmessage(0, "PRIMERA RONDA INICIANDO...")
}
public Hud2(id)
{
set_dhudmessage(255, 255, 255, -1.0, -1.0, 1, 6.0, 7.0)
show_dhudmessage(0, "SEGUNDA RONDA INICIANDO..")
}
public message_textmsg()
{
static textmsg[22]
get_msg_arg_string(2, textmsg, charsmax(textmsg))
if (get_msg_args() != 5) return PLUGIN_CONTINUE;
get_msg_arg_string(5, textmsg, charsmax(textmsg))
if (equal(textmsg, "#Fire_in_the_hole") || equal(textmsg, "%s (RADIO): Fire in the hole!"))
{
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
EDIT:
Al poner debug
Código:
L 02/03/2020 - 23:00:02: [ReAPI] SetHookChainReturn: trying to set return value with incompatible type, expected 'ATYPE_BOOL'; got 'ATYPE_INTEGER'
L 02/03/2020 - 23:00:02: [AMXX] Displaying debug trace (plugin "ModPug2.amxx", version "1.36")
L 02/03/2020 - 23:00:02: [AMXX] Run time error 10: native error (native "SetHookChainReturn")
L 02/03/2020 - 23:00:02: [AMXX] [0] ModPug2.sma::pfn_Round_End_Hook (line 500)
L 02/03/2020 - 23:00:08: [ReAPI] SetHookChainReturn: trying to set return value with incompatible type, expected 'ATYPE_BOOL'; got 'ATYPE_INTEGER'
L 02/03/2020 - 23:00:08: [AMXX] Displaying debug trace (plugin "ModPug2.amxx", version "1.36")
L 02/03/2020 - 23:00:08: [AMXX] Run time error 10: native error (native "SetHookChainReturn")
L 02/03/2020 - 23:00:08: [AMXX] [0] ModPug2.sma::pfn_Round_End_Hook (line 515)
SI NO VAS AYUDAR, POR FAVOR NO COMENTAR