Enviar respuesta 
[Poder expectar solo los admins] MOD-PUG
Autor Mensaje
DavidLG Sin conexión
Miembro Sr.


Mensajes: 403
Registro en: Mar 2019
Reputación: 0
Mensaje: #1
[Poder expectar solo los admins] MOD-PUG
Buenas tardes a todos venia a ver si podrian ayudarme en este mod pug que ando usando, nadie puede expectiar a los jugadores ni los administradores entonces quisiera saber que hacer o que colocar para que solo los admin puedan expectiar a los jugadores!

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/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(PLUGINVERSIONAUTHOR)
    
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_STOPFP_CELL)
    
g_forward_round_end CreateMultiForward("pug_round_end"ET_STOPFP_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(meid)
{
    new 
sz[20]
    
get_msg_arg_string(2szcharsmax(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(idm_iAccount1)
    }
}
public 
pfn_money(id)
{
    if(
round_knife)
    {
        
set_member(idm_iAccount1)
        return
    }
    if(
pug_state == ALIVE)
    {
        if(
get_member_game(m_bFreezePeriod))
        {
            
update_team_money(get_user_team(id))
        }
        return 
    }
    
set_member(idm_iAccount16000)
}
public 
pfn_PlayerDeath()
{
    if(
pug_state == ALIVE && !is_intermission && !round_knife )
    {
        new 
read_data(2)
        new 
read_data(1)
        if(
get_user_team(v) == get_user_team(k) || == 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(msid)
{
    static 
_score_player_id
    _score_player_id 
get_msg_arg_int(1)
    if(
pug_state == ALIVE && !round_knife)
    {
        
set_msg_arg_int(2ARG_SHORTg_iFrags[_score_player_id])
        
set_msg_arg_int(3ARG_SHORTg_iDeaths[_score_player_id])
    }
}
public 
cmd_hp(id)
{
    if(
pug_state != ALIVE || is_user_alive(id))
    {
        
client_print_color(idid"%s No puedes usar este comando en este momento"TAG)
        return
    }
    if(
torneo_limit){
        
client_print_color(idid"%s Accion no permitida en modo torneo"TAG)
        return;
    }
    new 
team get_user_team(id)
    new 
name[32]
    for(new 
<= iMaxPlayers i++)
    {
        if(
team == get_user_team(i) || !is_user_alive(i)) continue
 
        
get_user_name(iname32)
        
client_print_color(idid"%s ^x3%s ^x4(^x1HP:^x3%i^x4)"TAGnameget_user_health(i))
    }
}
public 
pfn_EVENT_damage(id)
{
    new 
get_user_attacker(id)
    new 
damage read_data(2)
 
    if(
pug_state != ALIVE || !is_user_alive(a) || !(<= <= iMaxPlayers) || == 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(idid"%s No puedes usar este comando en este momento"TAG)
        return
    }
    new 
tmp_name[32], count
    client_print
(idprint_console"===========[ DMG ]===========")
    for(new 
<= iMaxPlayers i++)
    {
        if(
g_iHits[i][id] > 0)
        {
            if(!
is_user_connected(i))
            {
                continue;
            }
            
get_user_name(itmp_namecharsmax(tmp_name))
 
            
client_print_color(idid"%s ^x3%s ^x4(^1Daño:^x3%i ^x1- Hits:^x3%i^x4)"TAGtmp_nameg_iDmg[i][id], g_iHits[i][id])
            
client_print(idprint_console"%s | Dmg: %i | Hits: %i"tmp_nameg_iDmg[i][id], g_iHits[i][id])
 
            
count++
        }
    }
 
    if(!
count)
    {
        
client_print_color(idid"%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(idprint_console"=============================")
}
public 
cmd_rdmg(id)
{
    if(
pug_state != ALIVE || (is_user_alive(id) && round_start))
    {
        
client_print_color(idid"%s No puedes usar este comando en este momento"TAG)
        return
    }
    new 
tmp_name[32], count
    client_print
(idprint_console"^4===========[ R.DMG ]===========")
    for(new 
<= iMaxPlayers i++)
    {
        if(
g_iHits[id][i] > 0)
        {
            if(!
is_user_connected(i))
            {
                continue;
            }
            
get_user_name(itmp_namecharsmax(tmp_name))
 
            
client_print_color(idid"%s ^x3%s ^x4(^1Daño Recibido:^x3%i ^x1- Hits:^x3%i^x4)"TAGtmp_nameg_iDmg[id][i], g_iHits[id][i])
            
client_print(idprint_console"%s | R.Dmg: %i | Hits: %i"tmp_nameg_iDmg[id][i], g_iHits[id][i])
 
            
count++
        }
    }
    if(!
count)
    {
        
client_print_color(idid"%s No recibistes daño en esta ronda"TAG)
        
console_print(id"%s No recibiste daño en esta ronda"TAG)
    }
    
client_print(idprint_console"=============================")
}
public 
pfn_TeamScore(meid)
{
    static 
_____team_score[2]
    
get_msg_arg_string(1_____team_scorecharsmax(_____team_score))
    switch(
_____team_score[0])
    {
        case 
'T' set_msg_arg_int(2ARG_SHORTg_iRound_team[TT])
        case 
'C' set_msg_arg_int(2ARG_SHORTg_iRound_team[CT])
    }
}
public 
newRound(id)
{
    
fn_update_server_name(id)
}
public 
pfn_Round_End_Hook(WinStatus:statusScenarioEventEndRound:eventFloat: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_INTEGER1)
        return 
HC_SUPERCEDE
    
}
    if(
round_knife)
    {
        
client_print_color(00"%s Ronda cuchillo finalizada, elegiran equipo los ^x3%s"TAGstatus == 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 2)
 
        
DisableHamForward(SpawnWeapon)
        
unregister_message(gMsgStatusIcongMsgRegisterStatusIcon)
        
rg_send_audio(0status == WINSTATUS_TERRORISTS "%!MRAD_terwin" status == WINSTATUS_CTS "%!MRAD_ctwin" "%!MRAD_rounddraw"PITCH_NORM)
        
SetHookChainReturn(ATYPE_INTEGER1)
        return 
HC_SUPERCEDE
    
}
    
round_start false
    
if(status == WINSTATUS_CTS)
    {
        
g_iRound_team[CT]++
        
emessage_begin(MSG_ALLgMsgTeamScore)
        
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_ALLgMsgTeamScore)
        
ewrite_string("TERRORIST")
        
ewrite_short(g_iRound_team[TT])
        
emessage_end()
        
ExecuteForward(g_forward_round_end_1)
    }
    
fn_update_server_name(0)
 
    for(new 
<= 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.5WINSTATUS_DRAWROUND_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(0charsmax(SND_MUSIC))])
        
cmdDirector(0"MP3FadeTime 0.5")
        
SetHookChainReturn(ATYPE_BOOL1)
        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 status == WINSTATUS_CTS 0)
        
Send_TextMsg(status == WINSTATUS_TERRORISTS "#Terrorists_Win" status == WINSTATUS_CTS "#CTs_Win" "")
        
client_cmd(0"mp3 play ^"%s^""SND_MUSIC[random_num(0charsmax(SND_MUSIC))])
        
cmdDirector(0"MP3FadeTime 0.5")
        
SetHookChainReturn(ATYPE_BOOL1)
        return 
HC_SUPERCEDE
    
}
 
    return 
HC_CONTINUE
 
}
 
public 
start_vote_win_team_knife(team)
{
    
arrayset(g_votes0sizeof(g_votes))
    
g_vote_count 0
    set_task
(5.0"end_vote_team_win_knife"TASK_END_VOTE)
    for(new 
<= 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(menuMPROP_EXITMEXIT_NEVER)
    
menu_display(idmenu05)
}
public 
mh_vote_team_win_knife(idmenuitem)
{
    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 
0;
    for(new 
sizeof (g_votes) ; i++)
    {
        if(
g_votes[w] > g_votes[i])
        {
            
i
        
}
    }
    if(
g_vote_count <= 0)
    {
        
0;
    }
    if(
w)
    {
        for(new 
<= get_pcvar_num(pcvar_max_players) ; i++)
        {
            if(!
is_user_connected(i))
            {
                continue;
            }
            
rg_switch_team(i)
        }
    }
    
arrayset(g_votes0sizeof(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 <= get_playersnum() ;i++)
    {
        if(!
is_user_connected(i))
        {
            continue
        }
        if(
get_user_team(i) == team)
        {
            
count += 1
        
}
    }
    return 
count
}
public 
end_dmg()
{
    for(new 
1<= get_playersnum() ; i++)
    {
        if(
is_user_alive(i) && !torneo_limit)
        {
            
cmd_dmg(i);
        }
    }
}
 
stock Send_TextMsg(msg[])
{
    
message_begin(MSG_BROADCASTgMsgTextMsg)
    
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(idmsg[], any:...)
{
    new 
fmt[33]
    
vformat(fmtcharsmax(fmt), msg3)
    
message_begin(id MSG_ONE_UNRELIABLE MSG_ALLgMsgServerName_id)
    
write_string(fmt)
    
message_end()
 
    
message_begin(MSG_ALLgMsgScoreInfo)
    
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<= iMaxPlayers ;i++)
        {
            if(!
is_user_connected(i) || !(1<= get_user_team(i) <= 2))
            {
                continue
            }
            
rg_switch_team(i)
            
set_member(im_iAccount800);
            if(
is_user_alive(i))
            {
                
rg_set_user_armor(i0ARMOR_NONE)
                
rg_give_default_items(i)
                if(
get_member(im_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(szFmtcharsmax(szFmt), "Ronda de cuchillos")
    }
    else if(
pug_state != NO_ALIVE)
    {
        if(
g_iRound_team[CT] == g_iRound_team[TT]){
            
formatex(szFmtcharsmax(szFmt), "Ronda: %i/30 | CT: %i Vs TT: %i"g_iRoundsg_iRound_team[CT], g_iRound_team[TT])
        }
        else if(
g_iRound_team[CT] > g_iRound_team[TT]){
            
formatex(szFmtcharsmax(szFmt), "Ronda: %i/30 | CT: %i Vs TT: %i"g_iRoundsg_iRound_team[CT], g_iRound_team[TT])
        }
        else{
            
formatex(szFmtcharsmax(szFmt), "Ronda: %i/30 | TT: %i Vs CT: %i"g_iRoundsg_iRound_team[TT], g_iRound_team[CT])
        }
    }
    else
    {
        
formatex(szFmtcharsmax(szFmt), "Esperando Jugadores")
    }
    
send_server_name(idszFmt)
    if(
pug_state != NO_ALIVE)
    {
 
        if(
round_knife)
        {
            
formatex(szFmtcharsmax(szFmt), "Ronda de cuchillos")
        }
        else if(
g_iRound_team[CT] == g_iRound_team[TT])
        {
            
formatex(szFmtcharsmax(szFmt), "Ronda: %i/30 | CT: %i Vs TT: %i"g_iRoundsg_iRound_team[CT], g_iRound_team[TT])
        }
        else if(
g_iRound_team[CT] > g_iRound_team[TT])
        {
            
formatex(szFmtcharsmax(szFmt), "Ronda: %i/30 | CT: %i Vs TT: %i"g_iRoundsg_iRound_team[CT], g_iRound_team[TT])
        }
        else
        {
            
formatex(szFmtcharsmax(szFmt), "Ronda: %i/30 | TT: %i Vs CT: %i"g_iRoundsg_iRound_team[TT], g_iRound_team[CT])
        }
        
set_member_game(m_GameDescszFmt)
    }
    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 
<= iMaxPlayers i++)
    {
        if(!
is_user_connected(i) || get_user_team(i) != team)
        {
            continue
        }
        
get_user_name(iname31)
        
format(hudcharsmax(hud), "%s%s - $%i^n"hudnameget_member(im_iAccount))
    }
 
 
    for(new 
<= 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(00"%s Ronda cuchillo, el equipo ganador elegira equipo"TAG)
        return
    }
 
    if(
team_check_id 0)
    {
        new 
count 0
        
for(new <= 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(00"%s Partida cancelada por falta de jugadores"TAG)
                
client_print_color(00"%s En el equipo ^x3%s"TAGteam_check_id == "Terrorista" "Anti-Terrorista")
                
team_check_id 0
                start_pregame
()
                return
            }
            else
            {
                new 
p_time = ((team_check_time get_systime()) / 60) + 1
                client_print_color
(0team_check_id == print_team_red print_team_blue"%s Esperando minimo de judadores del equipo ^x3%s"TAGteam_check_id == "Terrorista" "Anti-Terrorista")
                
client_print_color(0team_check_id == print_team_red print_team_blue"%s La partida se cancelara en ^x3%i ^x1minuto%s"TAGp_timep_time "s" "")
            }
        }
        else
        {
            
team_check_id 0
        
}
    }
    if(
team_check_id == 0)
    {
        new 
t_count 0
        
new ct_count 0
        
for(new <= iMaxPlayers i++)
        {
            if(!
is_user_connected(i))
            {
                continue;
            }
            switch(
get_user_team(i))
            {
                case 
t_count++
                case 
ct_count++
            }
        }
        if(
t_count <= || ct_count <= 2)
        {
            
team_check_id t_count <= 2
            team_check_time 
get_systime() + 180
            client_print_color
(0team_check_id == print_team_red print_team_blue"%s Esperando minimo de judadores del equipo ^x3%s"TAGteam_check_id == "Terrorista" "Anti-Terrorista")
            
client_print_color(0team_check_id == 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_iFrags0MAXPLAYERS)
        
arrayset(g_iDeaths0MAXPLAYERS)
    }
    
#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(255255255, -1.00.321.01.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 
<= iMaxPlayers i++)
    {
        
arrayset(g_iDmg[i], 0sizeof(g_iDmg))
        
arrayset(g_iHits[i], 0sizeof(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>&& !(__flags&ADMIN_USER));
}
read_maps()
{
    new 
file[32]
    new 
curmap[32]
    
ArrayPushString(g_maps"Jugar Este Mapa")
    
get_mapname(curmapcharsmax(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(fhfilecharsmax(file))
        
trim(file)
        if(!
file[0] || file[0] == ';' || equali(curmapfile))
        {
            continue;
        }
        
ArrayPushString(g_mapsfile)
    }
    
fclose(fh)
 
}
stock bool:check_bsp_file(file[])
{
    if(
equal(file[strlen(file)-4], ".bsp"))
    {
        return 
true
    
}
 
    return 
false
}
public 
pfn_postink(id)
{
    if(!(
<= get_user_team(id) <= 2))
    {
        return
    }
    
set_pev(idpev_maxspeed0.1)
    if(
pug_state == ALIVE)
    {
        
client_cmd(id"+showscores")
    }
    if(
is_user_alive(id))
    {
        new 
ent get_member(idm_pActiveItem)
        
set_member(entm_Weapon_flNextPrimaryAttack2.0)
        
set_member(entm_Weapon_flNextSecondaryAttack2.0)
    }
}
public 
pfn_remove_weapon(ent)
{
    if(
pug_state == ALIVE && !round_knife)
    {
        
DisableHamForward(SpawnWeapon)
        return
    }
    
set_pev(entpev_flagsFL_KILLME)
}
 
reset_user_vars()
{
    
arrayset(readyfalsesizeof(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_iFrags0MAXPLAYERS)
    
arrayset(g_iDeaths0MAXPLAYERS)
}

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_CommandCommand))
    {
        
server_print("Funcion ^"%s^" ya existente"Command)
        return
    }
 
    
TrieSetCell(t_CommandCommandPlugin)
    
TrieSetCell(t_Command_PluginCommandfuncid)
}
public 
start_pregame()
{
    for(new 
sizeof(Pregame_Cmds) ; i++)
    {
        
set_cvar_string(Pregame_Cmds[i][COMMAND], Pregame_Cmds[i][VALUE])
    }
    for(new 
c=1c<=iMaxPlayersc++){
        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(meid)
{
    if(
pug_state == ALIVE && !round_knife)
    {
        
unregister_message(gMsgStatusIcongMsgRegisterStatusIcon)
        return 
PLUGIN_CONTINUE
    
}
    new 
arg[4]
    
get_msg_arg_string(2argcharsmax(arg))
    if(
equal(arg"c4"))
    {
        
client_cmd(id"drop weapon_c4")
    }
    return 
PLUGIN_CONTINUE
}
public 
pfn_Hud_Ready(id)
{
    
set_hudmessage(242195430.690.0400.01.00.010.1)
    new 
i;
    new 
__pcount 0
    
for(<= iMaxPlayers ;i++ )
    {
        if(!
is_user_connected(i) || !(<= get_user_team(i) <= 2))
        {
            continue;
        }
        
__pcount += 1
    
}
    if(!
task_exists(TASK_1))
    {
        
set_task(1.0"CountReadyKick"TASK_1, .flags="b")
    }
    
ShowSyncHudMsg(0Sync[0], "[SintronyczGamers]"__pcount get_pcvar_num(pcvar_max_players))
    new 
fmt[33 33], name[14];
 
    
copy(fmtcharsmax(fmt), "")
    for(
<= iMaxPlayers ;i++ )
    {
        if(!
is_user_connected(i) || !(<= get_user_team(i) <= 2))
        {
            continue;
        }
        if(
ready[i]){
            
get_user_name(inamecharsmax(name))
            
format(fmtcharsmax(fmt), "%s%s^n"fmtname)
        }
        else{
            
get_user_name(inamecharsmax(name))
            
format(fmtcharsmax(fmt), "%s%s^n"fmtname)
        }
    }
    
set_hudmessage(2552552550.680.0900.01.00.010.1)
    
ShowSyncHudMsg(0Sync[1], fmt)
 
    
copy(fmtcharsmax(fmt), "")
    for(
<= iMaxPlayers ;i++ )
    {
        if(!
is_user_connected(i) || !(<= get_user_team(i) <= 2))
        {
            continue;
        }
        if(
ready[i]){
            
format(fmtcharsmax(fmt), "%s - Listo^n"fmt)
        }
        else{
            new 
formato[12]
            
format(formatocharsmax(formato), "(%02i:%02i) %s."kick_time[i] / 60kick_time[i] % 60kick_time[i]>59?"min":"seg")
            
format(fmtcharsmax(fmt), "%s - %s^n"fmtformato)
        }
    }
    
set_hudmessage(random_num(1255), random_num(1255), random_num(1255), 0.850.0920.01.00.010.1)
    
ShowSyncHudMsg(0Sync[2], fmt)
    
center_print(0"Esperando jugadores (%d/%d)^n^n^n^n^n^n"__pcountget_pcvar_num(pcvar_max_players))
}
public 
CountReadyKick()
{
    for(new 
k=1k<=iMaxPlayersk++){
 
        if(
ready[k] || !is_user_connected(k) || !(<= 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(knfcharsmax(nf))
            
client_print_color(00"%s El jugador ^x3%s^x1 fue expulsado por no usar ^x3.ready"TAGnf)
        }
        else{
            
kick_time[k]--
 
            if(
kick_time[k] <= 10){
                
client_print_color(kk,"%s Seras expulsado en ^x3%i ^x1segundos"TAGkick_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(plpr)
{
    new 
get_param(1)
    if(!(
<= <= iMaxPlayers))
    {
        return 
false
    
}
    return 
ready[u]
}
public 
native_pug_get_state(plpr)
{
    return 
pug_state;
}
public 
native_register_command(plpr)
{
    new 
szCommand[20], szForward[32]
    
get_string(1szCommandcharsmax(szCommand))
    
get_string(2szForwardcharsmax(szForward))
    
pug_register_command(szCommandszForwardpl)
}
 
public 
pfn_Hook_Say(id)
{
    if(!
is_user_connected(id))
    {
        return 
PLUGIN_CONTINUE
    
}
    static 
said[32]
    
read_argv(1saidcharsmax(said))
    
remove_quotes(said)
    
trim(said)
    if(
TrieKeyExists(t_Commandsaid))
    {
        new 
iPluginiFunc
        TrieGetCell
(t_CommandsaidiPlugin)
        
TrieGetCell(t_Command_PluginsaidiFunc)
        
callfunc_begin_i(iFunciPlugin)
        
callfunc_push_int(id)
        
callfunc_end()
        return 
PLUGIN_HANDLED_MAIN
    
}
    return 
PLUGIN_CONTINUE
}
 
public 
pfn_ready(id)
{
    if(
pug_state != NO_ALIVE || !(<= get_user_team(id) <= 2))
    {
        
client_print_color(idid"%s No puedes usar este comando en este momento"TAG)
        return 
PLUGIN_HANDLED
    
}
    else if(
ready[id])
    {
        
client_print_color(idid"%s Ya estas listo"TAG)
        return 
PLUGIN_HANDLED
    
}
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    
client_print_color(00"%s ^x3%s^x1 Esta Listo"TAGname)
    
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(idid"%s No puedes usar este comando en este momento"TAG)
        return 
PLUGIN_HANDLED
    
}
    else if(!
ready[id])
    {
        
client_print_color(idid"%s Aun no estas listo"TAG)
        return 
PLUGIN_HANDLED
    
}
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    
client_print_color(00"%s ^x3%s^x1 Dejo de estar Listo"TAGname)
    
ready[id] = false;
    
ready_count --
    
kick_time[id] = 120
    
return PLUGIN_HANDLED
}
public 
pfn_TextMsg(meid)
{
    static 
msg[23]
    
get_msg_arg_string(2msgcharsmax(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_INTEGER0)
        return 
HC_BREAK
    
}
    new 
players[32], count_tcount_ct
    get_players
(playerscount_t"e""TERRORIST")
    
get_players(playerscount_ct"e""CT")
 
    if(!(
<= 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(idid"%s Todos los equipos se encuentran llenos"TAG)
                
SetHookChainReturn(ATYPE_INTEGER0)
                return 
HC_BREAK
            
}
        }
        else{
            
client_print_color(idid"%s Modo Espectador no permitido"TAG)
            
SetHookChainReturn(ATYPE_INTEGER0)
            return 
HC_BREAK
        
}
        return 
HC_CONTINUE
    
}
    else if((
<= slot <= 2) && (<= get_user_team(id) <= 2) && pug_state == ALIVE)
    {
        
client_print_color(idid"%s No puedes hacer un cambio de equipos estando una partida en curso"TAG)
        
SetHookChainReturn(ATYPE_INTEGER0)
        return 
HC_BREAK
    
}
    new 
count
    get_players
(playerscount"e"slot == "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_INTEGER0)
        return 
HC_BREAK
    
}
    return 
HC_CONTINUE
}
stock center_print(id, const msg[], any:...)
{
    new 
arg[70]
    
vformat(argcharsmax(arg), msg3)
    if(
id == 0)
    {
        for(new 
<= iMaxPlayers z++)
        {
            if(!
is_user_connected(z))
            {
                continue
            }
            
engfunc(EngFunc_ClientPrintfz1arg)
        }
    }
    else
    {
        
engfunc(EngFunc_ClientPrintfid1arg)
    }
}
 
 
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_putcharsmax(_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(idTEAM_SPECTATOR)
            return
        }
        if(
get_user_team(id) == _c_team)
        {
            return
        }
        
rg_set_user_team(id_c_team == TEAM_TERRORIST TEAM_CT)
        
ExecuteHam(Ham_CS_RoundRespawnid)
    }
}
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 && (<= team <= 2))
    {
        if(
captainrun){
            if(
id == tt || id == ct){
                
captainrun false
                fnTeamsRandomize
()
            }
        }
 
        new 
team get_user_team(id)
        new 
count 0
 
        
for(new <= iMaxPlayers ;i++)
        {
            if(!
is_user_connected(i) || == id || get_user_team(i) != team)
            {
                continue
            }
            
count++
        }
        if(
count <= 2)
        {
            if(
count == 0)
            {
                
client_print_color(00"%s Partida cancelada por ausencia de jugadores en el equipo ^x3%s"TAGteam == "Terrorista" "Anti-Terrorista")
                
start_pregame()
                return
            }
 
            if(
team_check_id)
            {
                return
            }
            
team_check_id team
            team_check_time 
get_systime() + 180
            client_print_color
(00"%s Esperando minimo de judadores del equipo ^x3%s"TAGteam == "Terrorista" "Anti-Terrorista")
            
client_print_color(00"%s La partida se cancelara en^x3 3 ^x1minutos"TAG)
        }
    }
}
 
fn_score(id=0)
{
    if(
pug_state == NO_ALIVE)
    {
        
client_print_color(idid"%s No puedes usar este comando en este momento"TAG)
        return
    }
    if(
g_iRound_team[CT] == g_iRound_team[TT])
    {
        
client_print_color(00"%s Anti-Terroristas: ^x3%i ^x1- Terroristas: ^x3%i"TAGg_iRound_team[CT], g_iRound_team[TT])
    }
    else
    {
        
client_print_color(00"%s ^x1%s: ^x3%i ^x1- %s: ^x3%i "TAGg_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(fmtcharsmax(fmt), msg2)
    
set_hudmessage(02550, -1.00.001.01.1)
    
ShowSyncHudMsg(0Sync[0], fmt)
}
make_hud_body(msg[], any:...)
{
    new 
fmt[512]
    
vformat(fmtcharsmax(fmt), msg2)
    
set_hudmessage(255255255, -1.00.0301.01.1)
    
ShowSyncHudMsg(0Sync[1], fmt)
}
public 
next_vote()
{
    
remove_task(TASK_HUD_VOTE)
    
remove_task(TASK_END_VOTE)
    
g_vote_id++
    switch(
g_vote_id)
    {
        case 
:
        {
            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_votemap1)
                
next_vote();
            }
        }
        case 
:
        {
            
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_votes0sizeof(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_VoteMenuMPROP_EXITMEXIT_ALL)
    for(new 
<= iMaxPlayers i++)
    {
        if(!
is_user_connected(i))
        {
            continue
        }
        if( 
<= get_user_team(i) <= 2)
        {
            
menu_display(ig_VoteMenu)
        }
    }
}
public 
mh_mode_vote(idmenuitem)
{
    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++)
    {
        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 isizeof g_votes i++)
    {
        if(
g_votes[i] <= 0)
        {
            continue
        }
        switch(
i)
        {
            case 
:
            {
                
format(_hudcharsmax(_hud), "%sSin Sorteo: %i voto%s^n"_hudg_votes[i], g_votes[i] > "s" "")
                
c++
            }
            case 
:
            {
                
format(_hudcharsmax(_hud), "%sAleatorio: %i voto%s^n"_hudg_votes[i], g_votes[i] > "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_votemap1)
 
}
 
public 
start_pug()
{
    
set_cvar_num("sv_restart"1)
    for(new 
sizeof(PugStartCmds) ;i++)
    {
        
set_cvar_string(PugStartCmds[i][COMMAND], PugStartCmds[i][VALUE])
    }
    
g_iRounds 0;
    
arrayset(g_iRound_team02)
    
arrayset(g_iFrags0MAXPLAYERS)
    
arrayset(g_iDeaths0MAXPLAYERS)
    
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 ArraySize(g_maps) ; i++)
    {
 
        
temp g_votes[i]
        if(
temp >= 1)
        {
            
count++
            
format(hudcharsmax(hud), "%s%a: %i %s^n"hudArrayGetStringHandle(g_mapsi), temptemp "votos" "voto")
        }    
    }
 
    if(!
count)
    {
        
formatex(hudcharsmax(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(ArraySize(g_maps) ;i++)
    {
        
ArrayGetString(g_mapsimapcharsmax(map))
        
menu_additem(g_VoteMenumap)
        
arrayset(g_votes0sizeof(g_votes))
    }
    
menu_setprop(g_VoteMenuMPROP_EXITMEXIT_ALL)
 
    for(
<= iMaxPlayers ;i++ )
    {
        if(!
is_user_connected(i) || !( <= get_user_team(i) <= 2))
        {
            continue
        }
        
menu_display(ig_VoteMenu, .page=0)
    }
}
public 
mh_vote_map(idmenuitem)
{
    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 
winnertemp
    
for(new sizeof (g_votes) ; i++)
    {
        if(
temp g_votes[i])
        {
            
temp g_votes[i]
            
winner i
        
}
    }
 
    if(!
winner)
    {
        
client_print_color(00"%s Se decidio ^x3%a"TAGArrayGetStringHandle(g_maps0))
        
next_vote();
    }
    else
    {
        
set_pcvar_num(g_pcvar_votemap0)
        
server_cmd("changelevel ^"%a^""ArrayGetStringHandle(g_mapswinner))
    }
}
public 
pfn_force_start_pug(id)
{
    if(!(
get_user_flags(id) & ADMIN_RCON))
    {
        
client_print_color(idid"%s No tienes acceso a este comando"TAG)
        return
    }
    else if(
pug_state != NO_ALIVE)
    {
        
client_print_color(idid"%s Pug ya iniciado"TAG)
        return
    }
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    
client_print_color(00"%s Admin ^x3%s ^x1Ha iniciado la partida"TAGname)
    
start_vote()
}
public 
pfn_force_cancel(id)
{
    if(!
is_user_admin(id))
    {
        
client_print_color(idid"%s No tienes acceso a este comando"TAG)
        return
    }
    else if(
pug_state != ALIVE)
    {
        
client_print_color(idid"%s Pug no iniciado"TAG)
        return
    }
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    
client_print_color(00"%s ADMIN: ^x3%s ^x1Ha cancelado la partida"TAGname)
    
start_pregame()
}
public 
cmd_restart(id)
{
    if (!
is_user_admin(id))
    {
        
client_print_color(idid"%s No tienes acceso a este comando"TAG)
        return
    }
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    
client_print_color(00"%s Admin ^x3%s ^x1Ha reiniciado la partida"TAGname)
    
set_cvar_num("sv_restart"1)
    
g_iRounds 0;
    
arrayset(g_iRound_team02)
    
arrayset(g_iFrags0iMaxPlayers)
    
arrayset(g_iDeaths0iMaxPlayers)
}
public 
pfn_forceready(id)
{
    if(!
is_user_admin(id))
    {
        
client_print_color(idid"%s No tienes acceso a este comando"TAG)
        return
    }
    else if(
pug_state != NO_ALIVE)
    {
        
client_print_color(idid"%s Pug ya iniciado"TAG)
        return
    }
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    
client_print_color(00"%s Admin ^x3%s ^x1Ha forzado a estar Listo"TAGname)
    
fn_forceready()
}
fn_forceready()
{
    for(new 
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 <= iMaxPlayers i++)
    {
        if(!
is_user_connected(i) || !(<= 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 <= && pcount == get_pcvar_num(pcvar_max_players))
    {
        
remove_task(task)
        
next_vote()
    }
    else
    {
        
set_pcvar_num(g_pcvar_votemap1)
        
remove_task(task)
        
start_pregame()
        
fn_forceready();
        
client_print_color(00"%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 
sizeof(SND_MUSIC) ; i++)
    {
        
precache_generic(SND_MUSIC[i])
    }
}
 
fnTeamsRandomize()
{
    new 
iPlayers[MAX_PLAYERS],iNum;
    
get_players(iPlayers,iNum);
 
    for(new 
i;iNum;i++)
    {
        if(!(
<= get_user_team(iPlayers[i]) <= 2))
        {
            
iPlayers[i--] = iPlayers[--iNum];
        }
    }
 
    new 
iTeam random(2) ? 2;
 
    new 
iPlayer,iRandom;
 
    while(
iNum)
    {
        
iRandom random(iNum);
 
        
iPlayer iPlayers[iRandom];
 
        
rg_set_user_team(iPlayeriTeam == TEAM_TERRORIST TEAM_CT)
 
        
iPlayers[iRandom] = iPlayers[--iNum];
 
        
iTeam = ((_:iTeam) % 1);
    }
    
EnableHamForward(PlayerSpawn)
    
next_vote()
}
 
stock cmdDirector(idcmd[])
{
    
message_begin(id MSG_ONE MSG_ALLSVC_DIRECTOR_id 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(255255255, -1.0, -1.016.07.0)
    
show_dhudmessage(0"PRIMERA RONDA INICIANDO...")
    
client_print_color(idMaxClients"%s ^1GAMERSintronycz Empezando Pug!!!"TAG);
    
client_print_color(idMaxClients"%s ^1GAMERSintronycz Empezando Pug!!!"TAG);
    
client_print_color(idMaxClients"%s ^1Suerte!!!"TAG)
}
public 
Hud2(id)
{
    
set_dhudmessage(255255255, -1.0, -1.016.07.0)
    
show_dhudmessage(0"SEGUNDA RONDA INICIANDO..")
}
public 
message_textmsg()
{
    static 
textmsg[22]
    
get_msg_arg_string(2textmsgcharsmax(textmsg))
 
    if (
get_msg_args() != 5) return PLUGIN_CONTINUE;
    
get_msg_arg_string(5textmsgcharsmax(textmsg))
 
    if (
equal(textmsg"#Fire_in_the_hole") || equal(textmsg"%s (RADIO): Fire in the hole!"))
    {
        return 
PLUGIN_HANDLED;
    }
 
    return 
PLUGIN_CONTINUE;


Te lo agradeceria mucho de verdad..

SI NO VAS AYUDAR, POR FAVOR NO COMENTARLovepanda
09/02/2020 06:10 PM
Encuentra todos sus mensajes Cita este mensaje en tu respuesta
Enviar respuesta 


Salto de foro:


Usuario(s) navegando en este tema: 1 invitado(s)

Contáctanos | Allied Modders en español | Volver arriba | Volver al contenido | Archivo (Modo simple) | Sindicación RSS