logs al dar kills con la c4
#1
buenas estoy tratando de hacer que mi Competitive/Face it Pick Up Game (PUG) de kills al explotar o defusar la c4 trate con este code
Código PHP:
public bomb_explode(id)
{
    
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE
}

public 
bomb_defused(id)
{
    
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE

el problema esta en que si da las kills pero hay veces que no las da y esto es lo que me sale en los logs
Cita:L 12/10/2018 - 03:56:17: [AMXX] Displaying debug trace (plugin "pug_mod.amxx")

L 12/10/2018 - 03:56:17: [AMXX] Run time error 4: index out of bounds

L 12/10/2018 - 03:56:17: [AMXX] [0] pug_mod.sma::bomb_defused (line 1626)

este es el pug que utilizo
Código PHP:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <reapi>
#include <celltrie>

#define PLUGIN  "PUG MOD"
#define VERSION "1.21"
#define AUTHOR  "Sugisaki"

#define END_ROUND_KNIFE_FIX

#if AMXX_VERSION_NUM >= 183
    #define client_disconnect client_disconnected
#endif

new TASK_HUD_READY 552214
new TASK_HUD_VOTE 996541
new TASK_END_VOTE 441017
new TASK_PUG_END 778745

new const TAG[] = "[Pug Mod]"

enum _:PUGSTATE
{
    
NO_ALIVE 0,
    
ALIVE,
    
COMMENCING
}

enum _:PUG_ROUND
{
    
TT 0,
    
CT
}


new 
Trie:t_Command
new Trie:t_Command_Plugin
new pug_state
new g_PluginId
new iMaxPlayers
new bool:ready[33]
new 
ready_count
new HamHook:SpawnWeapon
new HamHook:DefuseKit
new HamHook:PlayerPostink
new HamHook:PlayerSpawn
new bool:vote_map
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 Sync1
new Sync2
new Sync3
new Sync4
new pcvar_max_players

new g_iDmg[33][33]
new 
g_iHits[33][33]

new Array:
g_maps
new g_votes[32]
new 
g_iRound_team[2]
new 
g_iRounds
new g_iFrags[33]
new 
g_iDeaths[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/music1.mp3"
}
new 
SND_COUNTER_BEEP[] = "sound/UI/buttonrollover.wav"
new SND_STINGER[] = "sound/pug/cs_stinger.wav"

enum _:CMDS
{
    
COMMAND[32],
    
VALUE[10]
}

new 
Pregame_Cmds[][CMDS] =
{
    {
"mp_forcerespawn""1"},
    {
"mp_round_infinite""acdefg"},
    {
"mp_auto_reload_weapons""1"},
    {
"mp_auto_join_team""1"},
    {
"mp_autoteambalance""0"},
    {
"mp_limitteams""0"},
    {
"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_roundtime""0"},
    {
"allow_spectators""1"},
    {
"sv_timeout""20"}
}

new 
PugStartCmds[][CMDS] = 
{
    {
"mp_forcerespawn""0"},
    {
"mp_startmoney""800"},
    {
"mp_freezetime""0"},
    {
"sv_alltalk""0"},
    {
"mp_refill_bpammo_weapons""0"},
    {
"mp_buytime"".25"},
    {
"mp_forcechasecam""2"},
    {
"mp_forcecamera""2"},
    {
"mp_freezetime""11"},
    {
"mp_roundtime""1.75"},
    {
"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)
    
DefuseKit RegisterHam(Ham_Spawn"item_thighpack""pfn_remove_weapon"1)
    
register_event("Money""pfn_money""b")
    
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();
    
Sync1 CreateHudSyncObj()
    
Sync2 CreateHudSyncObj()
    
Sync3 CreateHudSyncObj()
    
Sync4 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")

    
register_message(gMsgTeamScore"pfn_TeamScore")
    
    
pcvar_max_players register_cvar("pug_players""10")
    
    
register_event("HLTV""ev_new_round""a""1=0""2=0")

    
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_event("DeathMsg""pfn_PlayerDeath""a")

    
pug_register_command(".ready""pfn_ready"g_PluginId)
    
pug_register_command(".unready""pfn_unready"g_PluginId)
    
pug_register_command(".score""pfn_score"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(".vidas""cmds_vidas"g_PluginId)

    
set_task(5.0"start_pregame")
    
read_maps()
    
read_ini()
}

public 
pfn_player_spawn(id)
{
    if(
round_knife)
    {
        
rg_remove_all_items(id)
        
rg_give_item(id"weapon_knife")
        
set_member(idm_iAccount1)
    }
}

read_ini()
{
    new 
_sz_file[] = "addons/amxmodx/configs/pug_private.ini"
    
if(file_exists(_sz_file))
    {
        
server_print("Servidor Privado!!!!!")
        private = 
true
        
new fh fopen(_sz_file"r")
        new 
line[34]
        new 
_auth[32]
        new 
_sz_team[3]

        while(!
feof(fh))
        {
            
fgets(fhlinecharsmax(line))
            
trim(line)
            if(!
line[0] || line[0] == ';')
            {
                continue;
            }
            
parse(line_authcharsmax(_auth), _sz_teamcharsmax(_sz_team))
            
trim(_sz_team)
            
trim(_auth)
            
TrieSetCell(g_private_authstr_to_num(_sz_team))
        }
        
fclose(fh)
    }
    else
    {
        private = 
false
        server_print
("Servidor Publico!!!!!")
    }
}

public 
client_connect(id)
{
    static 
_steam_id[32]
    
    if(private)
    {
        
get_user_authid(id_steam_idcharsmax(_steam_id))
        if(!
TrieKeyExists(g_private_steam_id))
        {
            
server_cmd("kick #%i 'Servidor Privado!!!'"get_user_userid(id))
            return
        }
    }
}

public 
pfn_money(id)
{
    if(
round_knife)
    {
        
set_member(idm_iAccount1)
        return
    }
    if(
pug_state == ALIVE)
    {
        return 
    }
    
set_member(idm_iAccount25000)
}

public 
pfn_PlayerDeath()
{
    if(
pug_state == ALIVE && !is_intermission && !round_knife )
    {
        new 
read_data(2)
        new 
read_data(1)
        if(!(
1<= <= iMaxPlayers) || == k)
        {
            
g_iDeaths[v]++
            
g_iFrags[v]--
        }
        else
        {
            
g_iFrags[k]++
            
g_iDeaths[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 
cmds_vidas(id)
{
    new 
team get_user_team(id)
    new 
name[32]
    for(new 
<= iMaxPlayers i++)
    {
        if(
team == get_user_team(i))
            continue
        
get_user_name(iname32)
        
client_print(idprint_chat"%s %i"nameget_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
}
public 
cmd_dmg(id)
{
    if(
pug_state != ALIVE || is_user_alive(id))
    {
        
client_print(idprint_chat"%s Accion no permitida en este momento"TAG)
        return
    }
    new 
tmp_name[32], count
    
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(idprint_chat"%s | %s | Dmg: %i | Hits: %i "TAGtmp_nameg_iDmg[i][id], g_iHits[i][id])
            
count++
        }
    }
    if(!
count)
    {
        
client_print(idprint_chat"%s No Le diste a nadie en esta ronda"TAG)
    }
}
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)
    {
        return 
HC_CONTINUE
    
}
    else if(
is_intermission)
    {
        
SetHookChainReturn(ATYPE_INTEGER1)
        return 
HC_SUPERCEDE
    
}
    if(
round_knife)
    {
        if(
status == WINSTATUS_CTS)
        {
            for(new 
<= iMaxPlayers i++)
            {
                if(!
is_user_connected(i) || !(<= get_user_team(i) <= 2))
                {
                    continue;
                }
                
rg_switch_team(i)
            }
            
client_print(0print_chat"%s Han ganado los CTs, Se realizara un cambio de equipos"TAG)
        }
        else if(
status == WINSTATUS_TERRORISTS)
        {
            
client_print(0print_chat"%s Han ganado los TTs, No realizara cambio de equipos"TAG)
        }
        else
        {
            
client_print(0print_chat"%s Nadie Gano!, No realizara cambio de equipos"TAG)
        }
        
round_knife false
        
#if defined END_ROUND_KNIFE_FIX
        
set_cvar_num(Pregame_Cmds[1][COMMAND], 1)
        
#endif
        
DisableHamForward(PlayerSpawn)
        
SetHookChainReturn(ATYPE_INTEGER1)
        
Send_TextMsg(status == WINSTATUS_TERRORISTS "#Terrorists_Win" status == WINSTATUS_CTS "#CTs_Win" "")
        
server_cmd("sv_restart 4")

        
DisableHamForward(SpawnWeapon)
        
unregister_message(gMsgStatusIcongMsgRegisterStatusIcon)
        
rg_send_audio(0status == WINSTATUS_TERRORISTS "%!MRAD_terwin" status == WINSTATUS_CTS "%!MRAD_ctwin" "%!MRAD_rounddraw"PITCH_NORM)
        return 
HC_SUPERCEDE
    
}
    
    if(
status == WINSTATUS_CTS)
    {
        
g_iRound_team[CT]++
        
emessage_begin(MSG_ALLgMsgTeamScore)
        
ewrite_string("CT")
        
ewrite_short(g_iRound_team[CT])
        
emessage_end()
    }
    else if(
status == WINSTATUS_TERRORISTS)
    {
        
g_iRound_team[TT]++
        
emessage_begin(MSG_ALLgMsgTeamScore)
        
ewrite_string("TERRORIST")
        
ewrite_short(g_iRound_team[TT])
        
emessage_end()
    }

    
fn_update_server_name(0)

    if(
g_iRounds == 15 && !half_time)
    {
        
EnableHamForward(PlayerPostink)
        
g_vote_countdown 15
        set_task
(1.0"pfn_intermission_count"TASK_HUD_READY__"b")
        
is_intermission true
        half_time 
true
        rg_send_audio
(0status == WINSTATUS_TERRORISTS "%!MRAD_terwin" status == WINSTATUS_CTS "%!MRAD_ctwin" "%!MRAD_rounddraw"PITCH_NORM)
        
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))])
        
client_cmd(0"wait;^"mp3fadeTime^" ^"0.5^";wait")
        
SetHookChainReturn(ATYPE_INTEGER1)
        return 
HC_SUPERCEDE
    
}
    else if(
g_iRounds == 30 || g_iRound_team[CT] >= 16 || g_iRound_team[TT] >= 16)
    {
        
EnableHamForward(PlayerPostink)
        
g_vote_countdown 15
        set_task
(1.0"pfn_pug_end_countdown"TASK_PUG_END__"b")
        
is_intermission true
        Send_TextMsg
(status == WINSTATUS_TERRORISTS "#Terrorists_Win" status == WINSTATUS_CTS "#CTs_Win" "")
        
rg_send_audio(0status == WINSTATUS_TERRORISTS "%!MRAD_terwin" status == WINSTATUS_CTS "%!MRAD_ctwin" "%!MRAD_rounddraw"PITCH_NORM)
        
client_cmd(0"mp3 play ^"%s^""SND_MUSIC[random_num(0charsmax(SND_MUSIC))])
        
client_cmd(0"wait;^"mp3fadeTime^" ^"0.5^";wait")
        
SetHookChainReturn(ATYPE_INTEGER1)
        return 
HC_SUPERCEDE
    
}

    return 
HC_CONTINUE

}

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])
        {
            
make_hud_title("La partida quedo empatada")
        }
        else if(
g_iRound_team[CT] >= g_iRound_team[TT])
        {
            
make_hud_title("Los Anti-Terroristas Han ganado la partida")
        }
        else
        {
            
make_hud_title("Los Terroristas Han ganado la partida")
        }
        
make_hud_body("Reiniciando en: %i"g_vote_countdown)
    }
    else
    {
        
DisableHamForward(PlayerPostink)
        
remove_task(task)
        
start_pregame()
        
client_cmd(0"-showscores")
        
client_cmd(0"wait;^"mp3fadeTime^" ^"0.5^";wait")
        
client_cmd(0"wait;^"cd^" ^"fadeout^";wait")
    }
}

public 
pfn_intermission_count(task)
{
    
g_vote_countdown--
    if(
g_vote_countdown 0)
    {
        
make_hud_title("Descanso:")
        
make_hud_body("Cambio de Equipos en 00:%02i"g_vote_countdown)
    }
    else
    {
        
client_cmd(0"wait;^"mp3fadeTime^" ^"0.5^";wait")
        
client_cmd(0"wait;^"cd^" ^"fadeout^";wait")
        
remove_task(task)
        
DisableHamForward(PlayerPostink)
        
server_cmd("sv_restart 1")
        new 
temp g_iRound_team[CT]
        
g_iRound_team[CT] = g_iRound_team[TT]
        
g_iRound_team[TT] = temp
        is_intermission 
false
        
for(new i<= iMaxPlayers ;i++)
        {
            if(!
is_user_connected(i) || !(1<= get_user_team(i) <= 2))
            {
                continue
            }
            
rg_switch_team(i)
        }
        
        
client_cmd(0"-showscores")
    }
}
fn_update_server_name(id)
{
    new 
szFmt[128]
    if(
round_knife)
    {
        
formatex(szFmtcharsmax(szFmt), "Ronda de cuchillos")
    }
    else if(
pug_state != NO_ALIVE)
    {
        
formatex(szFmtcharsmax(szFmt), "Ronda: %i | CT: %i | TT: %i"g_iRoundsg_iRound_team[CT], g_iRound_team[TT])
    }
    else
    {
        
formatex(szFmtcharsmax(szFmt), "PUG NO ALIVE")
    }
    if(
id)
    {
        
message_begin(MSG_ONEgMsgServerName, {000}, id)
    }
    else
    {
        
message_begin(MSG_BROADCASTgMsgServerName)
    }
    
write_string(szFmt)
    
message_end();
    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 | TT: %i | CT: %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 | CT: %i | TT: %i"g_iRoundsg_iRound_team[CT], g_iRound_team[TT])
        }
        else
        {
            
formatex(szFmtcharsmax(szFmt), "Ronda: %i | TT: %i | CT: %i"g_iRoundsg_iRound_team[TT], g_iRound_team[CT])
        }
        
set_member_game(m_GameDescszFmt)
    }
    else
    {
        
set_member_game(m_GameDesc"PUG NO ALIVE")
    }
    
}

public 
ev_new_round()
{
    
    if(
pug_state == NO_ALIVE)
    {
        return
    }
    else if(
pug_state == COMMENCING)
    {
        
pug_state ALIVE
        set_cvar_num
("mp_round_infinite"0)
    }
    
    if(
round_knife)
    {
        
fn_update_server_name(0)
        return
    }

    
g_iRounds++

    
#if defined END_ROUND_KNIFE_FIX
    
if(g_iRounds == 1)
    {
        
set_cvar_num(Pregame_Cmds[1][COMMAND], 0)
        
arrayset(g_iFrags0sizeof(g_iFrags))
        
arrayset(g_iDeaths0sizeof(g_iDeaths))
    }
    
#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.301.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)
    new 
i
    
for(iMaxPlayers i++)
    {
        
arrayset(g_iDmg[i], 0sizeof(g_iDmg))
        
arrayset(g_iHits[i], 0sizeof(g_iHits))
    }
}

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))
    new 
dh open_dir("maps"filecharsmax(file))
    if(!
dh)
    {
        
set_fail_state("Error al abrir la carpeta de mapas");
        return
    }
    
    while(
dh)
    {
        
trim(file)
        if(
check_bsp_file(file))
        {
            
replace(filecharsmax(file), ".bsp""")
            if(
equal(curmapfile))
            {
                continue;
            }
            
ArrayPushString(g_mapsfile)
        }
        if(!
next_file(dhfilecharsmax(file)))
        {
            
close_dir(dh)
            
dh false
        
}
    }
    
}
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")
    }
}
public 
pfn_remove_weapon(ent)
{
    
set_pev(entpev_flagsFL_KILLME)
}
public 
pfn_remove_entity(id)
{
    if(
pev_valid(id))
    {
        
engfunc(EngFunc_RemoveEntityid)
    }
    
client_print(0print_chat"Think")
}
reset_user_vars()
{
    
arrayset(readyfalsesizeof(ready))
    
ready_count 0
    g_vote_id 
0;
    
round_knife false
    half_time 
false
    g_iRound_team
[TT] = 0
    g_iRound_team
[CT] = 0
    arrayset
(g_iFrags0sizeof(g_iFrags))
    
arrayset(g_iDeaths0sizeof(g_iDeaths))
}
stock pug_register_command(Command[], Function[], Plugin)
{
/*
    new szPlugin[5]
    num_to_str(Plugin, szPlugin, charsmax(szPlugin))
*/
    
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])
    }
    
is_intermission false
    pug_state 
NO_ALIVE
    gMsgRegisterStatusIcon 
register_message(gMsgStatusIcon"pfn_StatusIcon")
    
server_cmd("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()
{
    
set_hudmessage(255000.80.0701.01.1)
    new 
i;
    new 
__pcount 0
    
for(<= iMaxPlayers ;i++ )
    {
        if(!
is_user_connected(i) || !(<= get_user_team(i) <= 2))
        {
            continue;
        }
        
__pcount += 1
    
}
    
ShowSyncHudMsg(0Sync1"No Listos: %i"__pcount ready_count)
    new 
fmt[33 33], name[32]
    
    
copy(fmtcharsmax(fmt), "")
    for(
<= iMaxPlayers ;i++ )
    {
        if(
ready[i] || !is_user_connected(i) || !(<= get_user_team(i) <= 2))
        {
            continue;
        }
        
get_user_name(inamecharsmax(name))
        
format(fmtcharsmax(fmt), "%s%s^n"fmtname)
    }
    
set_hudmessage(2552552550.80.101.01.1)
    
ShowSyncHudMsg(0Sync2fmt)
    
copy(fmtcharsmax(fmt), "")
    
set_hudmessage(025500.80.501.01.1)
    
ShowSyncHudMsg(0Sync3"Listos: %i"ready_count)
    for(
<= iMaxPlayers ;i++ )
    {
        if(!
ready[i] || !is_user_connected(i) || !(<= get_user_team(i) <= 2))
        {
            continue;
        }
        
get_user_name(inamecharsmax(name))
        
format(fmtcharsmax(fmt), "%s%s^n"fmtname)
    }
    
set_hudmessage(2552552550.80.5301.01.1)
    
ShowSyncHudMsg(0Sync4fmt)
}
public 
plugin_natives()
{
    
register_native("pug_register_command""native_register_command", .style=0)
    
register_native("pug_get_state""native_pug_get_state")
}
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
    
}
    new 
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(idprint_chat"%s Accion no permitida en este momento"TAG)
        return
    }
    else if(
ready[id])
    {
        
client_print(idprint_chat"%s Ya estas listo"TAG)
        return
    }
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    
client_print(0print_chat"%s %s Esta Listo"TAGname)
    
ready[id] = true
    ready_count 
++
    if(
ready_count == get_pcvar_num(pcvar_max_players))
    {
        
start_vote()
    }
}
public 
pfn_unready(id)
{
    if(
pug_state != NO_ALIVE)
    {
        
client_print(idprint_chat"%s Accion no permitida en este momento"TAG)
        return
    }
    else if(!
ready[id])
    {
        
client_print(idprint_chat"%s Aun no estas listo"TAG)
        return
    }
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    
client_print(0print_chat"%s %s Dejo de estar Listo"TAGname)
    
ready[id] = false;
    
ready_count --
}
public 
pfn_TextMsg(meid)
{
    new 
msg[23]
    
get_msg_arg_string(2msgcharsmax(msg))
    if(
equal(msg"#Game_will_restart_in"))
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}
public 
pfn_Hook_ChooseTeam(id_:slot)
{
    new 
count_tplayers[32], count_ct
    
if(!(<= slot <= 2))
    {
        if(
slot == 5)
        {
            
get_players(playerscount_t"e""TERRORIST")
            
get_players(playerscount_ct"e""CT")

            if(
count_t >= (get_pcvar_num(pcvar_max_players) / 2) && count_ct >= (get_pcvar_num(pcvar_max_players) / 2) )
            {
                
client_print(idprint_chat"%s Todos los equipos se encuentran llenos"TAG)
                
SetHookChainReturn(ATYPE_INTEGER0)
                return 
HC_BREAK
            
}
        }
        return 
HC_CONTINUE
    
}
    else if((
<= slot <= 2) && (<= get_user_team(id) <= 2) && pug_state == ALIVE)
    {
        
client_print(idprint_chat"%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"%s Este Equipo esta lleno^n^n^n^n^n"TAG)
        
SetHookChainReturn(ATYPE_INTEGER0)
        return 
HC_BREAK
    
}
    return 
HC_CONTINUE
}

stock center_print(id, const msg[], any:...)
{
    new 
arg[50]
    
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_disconnect(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))
    {
        new 
count 0
        
        
for(new <= iMaxPlayers ;i++)
        {
            if(!
is_user_connected(i) || == id || get_user_team(i) != team)
            {
                continue
            }
            
count++
        }
        if(
count <= 2)
        {
            
client_print(0print_chat"%s Partida cancelada por ausencia de jugadores en el equipo %s"TAGteam == "Terrorista" "Anti-Terrorista")
            
start_pregame()
        }
    }
}

fn_score(id=0)
{
    if(
pug_state == NO_ALIVE)
    {
        
client_print(idprint_chat"%s Accion no permitida en este momento"TAG)
        return
    }
    if(
g_iRound_team[CT] == g_iRound_team[TT])
    {
        
client_print(0print_chat"%s La puntuacion esta empatada %i - %i"TAGg_iRound_team[CT], g_iRound_team[TT])
    }
    else
    {
        
client_print(0print_chat"%s %s: %i - %s: %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)
    
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(0Sync1fmt)
}
make_hud_body(msg[], any:...)
{
    new 
fmt[512]
    
vformat(fmtcharsmax(fmt), msg2)
    
set_hudmessage(255255255, -1.00.0301.01.1)
    
ShowSyncHudMsg(0Sync2fmt)
}
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(15.0"pfn_vote_map_end"TASK_END_VOTE)
                
g_vote_countdown 15
                start_vote_map
()
            }
            else
            {
                
set_pcvar_num(g_pcvar_votemap1)
                
next_vote();
            }
        }
        default :
        {
            
start_countdown()
        }
    }
}

public 
start_countdown()
{
    
EnableHamForward(PlayerPostink)
    
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()
{
    
server_cmd("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_iFrags0sizeof(g_iFrags))
    
arrayset(g_iDeaths0sizeof(g_iDeaths))
    
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
    make_menu_votemap
()
    

}
make_menu_votemap()
{
    
g_VoteMenu menu_create("\rVotacion 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))
    {
        
next_vote();
    }
}

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(0print_chat"%s Se decidio %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(!
is_user_admin(id))
    {
        
client_print(idprint_chat"%s No tienes acceso a este comando"TAG)
        return
    }
    else if(
pug_state != NO_ALIVE)
    {
        
client_print(idprint_chat"%s Accion no permitida en este momento"TAG)
        return
    }
    
start_vote()
}
public 
pfn_force_cancel(id)
{
    if(!
is_user_admin(id))
    {
        
client_print(idprint_chat"%s No tienes acceso a este comando"TAG)
        return
    }
    else if(
pug_state != ALIVE)
    {
        
client_print(idprint_chat"%s Accion no permitida en este momento"TAG)
        return
    }
    
start_pregame()
}
public 
pfn_forceready(id)
{
    if(!
is_user_admin(id))
    {
        
client_print(idprint_chat"%s No tienes acceso a este comando"TAG)
        return
    }
    else if(
pug_state != NO_ALIVE)
    {
        
client_print(idprint_chat"%s Accion no permitida en este momento"TAG)
        return
    }
    
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)
        }
    }
    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(0print_chat"%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
        round_knife 
true
        EnableHamForward
(PlayerSpawn)
    }

    if(
g_vote_countdown -- > 0)
    {
        
center_print(0"Empezando Partida: %i^n^n^n^n"g_vote_countdown)

    }
    else
    {
        
DisableHamForward(PlayerPostink)
        
remove_task(task)
        
center_print(0" ");
        
client_print(0print_chat"%s Ronda cuchillo, el equipo ganador sera TT"TAG)
    }
}
public 
plugin_precache()
{
    
precache_generic(SND_COUNTER_BEEP)
    
precache_generic(SND_STINGER)
    for(new 
sizeof(SND_MUSIC) ; i++)
    {
        
precache_generic(SND_MUSIC[i])
    }
}












// DHUDMESSAGE.INC

#if AMXX_VERSION_NUM < 183


stock __dhud_color;
stock __dhud_x;
stock __dhud_y;
stock __dhud_effect;
stock __dhud_fxtime;
stock __dhud_holdtime;
stock __dhud_fadeintime;
stock __dhud_fadeouttime;
stock __dhud_reliable;

stock set_dhudmessagered 0green 160blue 0Float:= -1.0Float:0.65effects 2Float:fxtime 6.0Float:holdtime 3.0Float:fadeintime 0.1Float:fadeouttime 1.5bool:reliable false )
{
    
#define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )
    #define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )

    
__dhud_color       pack_colorclamp_bytered ), clamp_bytegreen ), clamp_byteblue ) );
    
__dhud_x           _:x;
    
__dhud_y           _:y;
    
__dhud_effect      effects;
    
__dhud_fxtime      _:fxtime;
    
__dhud_holdtime    _:holdtime;
    
__dhud_fadeintime  _:fadeintime;
    
__dhud_fadeouttime _:fadeouttime;
    
__dhud_reliable    _:reliable;

    return 
1;
}

stock show_dhudmessageindex, const message[], any:... )
{
    new 
buffer128 ];
    new 
numArguments numargs();

    if( 
numArguments == )
    {
        
send_dhudMessageindexmessage );
    }
    else if( 
index || numArguments == )
    {
        
vformatbuffercharsmaxbuffer ), message);
        
send_dhudMessageindexbuffer );
    }
    else
    {
        new 
playersList32 ], numPlayers;
        
get_playersplayersListnumPlayers"ch" );

        if( !
numPlayers )
        {
            return 
0;
        }

        new Array:
handleArrayML ArrayCreate();

        for( new 
2jnumArgumentsi++ )
        {
            if( 
getarg) == LANG_PLAYER )
            {
                while( ( 
buffer] = getarg1j++ ) ) ) {}
                
0;

                if( 
GetLangTransKeybuffer ) != TransKey_Bad )
                {
                    
ArrayPushCellhandleArrayMLi++ );
                }
            }
        }

        new 
size ArraySizehandleArrayML );

        if( !
size )
        {
            
vformatbuffercharsmaxbuffer ), message);
            
send_dhudMessageindexbuffer );
        }
        else
        {
            for( new 
0jnumPlayersi++ )
            {
                
index playersList];

                for( 
0sizej++ )
                {
                    
setargArrayGetCellhandleArrayML), 0index );
                }

                
vformatbuffercharsmaxbuffer ), message);
                
send_dhudMessageindexbuffer );
            }
        }

        
ArrayDestroyhandleArrayML );
    }

    return 
1;
}

stock send_dhudMessage( const index, const message[] )
{
    
message_begin__dhud_reliable ? ( index MSG_ONE MSG_ALL ) : ( index MSG_ONE_UNRELIABLE MSG_BROADCAST ), SVC_DIRECTOR_index );
    {
        
write_bytestrlenmessage ) + 31 );
        
write_byteDRC_CMD_MESSAGE );
        
write_byte__dhud_effect );
        
write_long__dhud_color );
        
write_long__dhud_x );
        
write_long__dhud_y );
        
write_long__dhud_fadeintime );
        
write_long__dhud_fadeouttime );
        
write_long__dhud_holdtime );
        
write_long__dhud_fxtime );
        
write_stringmessage );
    }
    
message_end();
}
#endif 
Aprendiendo scripting Excitedeyes || Tratare ayudar en lo que pueda Trolleyes || PD: Soy pobre Cutecry
Responder
#2
Prueba usando la native set_user_frags

Código PHP:
set_user_fragsiIdget_user_fragsiId ) + ); 
Responder
#3
(10/12/2018, 11:04 AM)Chema escribió: Prueba usando la native set_user_frags

Código PHP:
set_user_fragsiIdget_user_fragsiId ) + ); 

Convengamos que con esa native no aumenta la variable que el chaval desea

---

¿ Cual es la linea del error ?, al menos que tengas un servidor de 34 slots no le veo el problema la verdad ..

Saludos,
cLAANS.-
Mi unico plugin.
Tutorial de niveles.

Ayudo, pero no de la manera que quieren, si quieren aprender les servirá lo mio, para pedir el codigo en bandeja tienen la sección 'Pedidos'

(09/11/2017, 09:30 PM)SoundBlaster escribió: Espera y llamo a los power rangers para que me digan la linea de error
Responder
#4
(11/12/2018, 04:41 AM)cLAANS escribió:
(10/12/2018, 11:04 AM)Chema escribió: Prueba usando la native set_user_frags

Código PHP:
set_user_fragsiIdget_user_fragsiId ) + ); 

Convengamos que con esa native no aumenta la variable que el chaval desea

---

¿ Cual es la linea del error ?, al menos que tengas un servidor de 34 slots no le veo el problema la verdad ..

Saludos,
cLAANS.-

tengo un servidor de 12 slot pero es pug y solo jugamos 10 personas y el error se presenta a la hora cuando uno defusa y desplanta la bomba hay es cuando sale ese error hay veces que das las 3 kills y otras veces no
y el errror se presenta es aqui
Código PHP:
public bomb_explode(id)
{
    
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE
}

public 
bomb_defused(id)
{
    
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE

Aprendiendo scripting Excitedeyes || Tratare ayudar en lo que pueda Trolleyes || PD: Soy pobre Cutecry
Responder
#5
(11/12/2018, 09:28 AM)whOo escribió:
(11/12/2018, 04:41 AM)cLAANS escribió:
(10/12/2018, 11:04 AM)Chema escribió: Prueba usando la native set_user_frags

Código PHP:
set_user_fragsiIdget_user_fragsiId ) + ); 

Convengamos que con esa native no aumenta la variable que el chaval desea

---

¿ Cual es la linea del error ?, al menos que tengas un servidor de 34 slots no le veo el problema la verdad ..

Saludos,
cLAANS.-

tengo un servidor de 12 slot pero es pug y solo jugamos 10 personas y el error se presenta a la hora cuando uno defusa y desplanta la bomba hay es cuando sale ese error hay veces que das las 3 kills y otras veces no
y el errror se presenta es aqui
Código PHP:
public bomb_explode(id)
{
    
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE
}

public 
bomb_defused(id)
{
    
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE


Pos, la verdad es que esa porción de código esta bien ...

Pasa el sma editado

Saludos,
cLAANS.-
Mi unico plugin.
Tutorial de niveles.

Ayudo, pero no de la manera que quieren, si quieren aprender les servirá lo mio, para pedir el codigo en bandeja tienen la sección 'Pedidos'

(09/11/2017, 09:30 PM)SoundBlaster escribió: Espera y llamo a los power rangers para que me digan la linea de error
Responder
#6
(13/12/2018, 10:43 PM)cLAANS escribió:
(11/12/2018, 09:28 AM)whOo escribió:
(11/12/2018, 04:41 AM)cLAANS escribió:
(10/12/2018, 11:04 AM)Chema escribió: Prueba usando la native set_user_frags

Código PHP:
set_user_fragsiIdget_user_fragsiId ) + ); 

Convengamos que con esa native no aumenta la variable que el chaval desea

---

¿ Cual es la linea del error ?, al menos que tengas un servidor de 34 slots no le veo el problema la verdad ..

Saludos,
cLAANS.-

tengo un servidor de 12 slot pero es pug y solo jugamos 10 personas y el error se presenta a la hora cuando uno defusa y desplanta la bomba hay es cuando sale ese error hay veces que das las 3 kills y otras veces no
y el errror se presenta es aqui
Código PHP:
public bomb_explode(id)
{
    
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE
}

public 
bomb_defused(id)
{
    
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE


Pos, la verdad es que esa porción de código esta bien ...

Pasa el sma editado

Saludos,
cLAANS.-

Código PHP:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <reapi>
#include <celltrie>

#define PLUGIN  "PUG MOD"
#define VERSION "1.31"
#define AUTHOR  "Sugisaki"

#define MAXPLAYERS 15
#define END_ROUND_KNIFE_FIX
#define get_team(%0) get_member(%0, m_iTeam)

#if AMXX_VERSION_NUM >= 183
    #define client_disconnect client_disconnected
#endif

new TASK_HUD_READY 552214
new TASK_HUD_VOTE 996541
new TASK_END_VOTE 441017
new TASK_PUG_END 778745

new const TAG[] = "!y[!gRTB!y]"

enum _:PUGSTATE
{
    
NO_ALIVE 0,
    
ALIVE,
    
COMMENCING,
    
VOTEMAP
}

enum _:PUG_ROUND
{
    
TT 0,
    
CT
}


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 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 Sync1
new Sync2
new Sync3
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 
g_vote_count

new g_VoteMenu

new gMsgStatusIcon
new gMsgRegisterStatusIcon

new gMsgServerName
new gMsgTextMsg
new gMsgScoreInfo
new gMsgTeamScore

new bool:is_intermission

new pcvar_knife

new SND_MUSIC[][] =
{
    
""
}
new 
SND_COUNTER_BEEP[] = "sound/UI/buttonrollover.wav"

enum _:CMDS
{
    
COMMAND[32],
    
VALUE[10]
}
new 
g_vote_menues_count
new Trie:g_vote_menues
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""0"},
    {
"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_roundtime""0"},
    {
"allow_spectators""1"},
    {
"sv_timeout""20"},
    {
"sv_maxspeed""320"}
}

new 
PugStartCmds[][CMDS] = 
{
    {
"mp_forcerespawn""0"},
    {
"mp_startmoney""800"},
    {
"mp_freezetime""0"},
    {
"sv_alltalk""2"},
    {
"mp_refill_bpammo_weapons""0"},
    {
"mp_buytime"".25"},
    {
"mp_forcechasecam""2"},
    {
"mp_forcecamera""2"},
    {
"mp_freezetime""11"},
    {
"mp_roundtime""1.75"},
    {
"mp_auto_join_team""0"}
}

public 
plugin_init()
{
    
g_PluginId register_plugin(PLUGINVERSIONAUTHOR)
    
pug_state NO_ALIVE
    g_vote_menues_count 
2
    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)
    
DefuseKit RegisterHam(Ham_Spawn"item_thighpack""pfn_remove_weapon"1)
    
register_event("Money""pfn_money""b")
    
g_private TrieCreate()
    
g_vote_menues TrieCreate()
    
pcvar_knife register_cvar("pug_knife""0")
    
g_pcvar_votemap register_cvar("pug_votemap""1")
    
t_Command TrieCreate()
    
t_Command_Plugin TrieCreate()
    
g_maps ArrayCreate(32)
    
iMaxPlayers get_maxplayers();
    
Sync1 CreateHudSyncObj()
    
Sync2 CreateHudSyncObj()
    
Sync3 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")

    
register_message(gMsgTeamScore"pfn_TeamScore")
    
    
pcvar_max_players register_cvar("pug_players""10")
    
    
register_event("HLTV""ev_new_round""a""1=0""2=0")

    
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_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(".nolisto""pfn_unready"g_PluginId)
    
pug_register_command(".unready""pfn_unready"g_PluginId)
    
pug_register_command(".score""pfn_score"g_PluginId)
    
pug_register_command(".start""pfn_force_start_pug"g_PluginId)
    
pug_register_command(".rr""pfn_force_restart_pug"g_PluginId)
    
pug_register_command(".force""pfn_forceready"g_PluginId)
    
pug_register_command(".cancel""pfn_force_cancel"g_PluginId)
    
pug_register_command(".dmg""cmd_dmg"g_PluginId)
    
pug_register_command(".hp""cmds_vidas"g_PluginId)
    
pug_register_command(".hpteam""cmds_vidas_team"g_PluginId)

    
set_task(5.0"start_pregame")
    
read_maps()
    
read_ini()
}

public 
pfn_player_spawn(id)
{
    if(
round_knife)
    {
        
rg_remove_all_items(id)
        
rg_give_item(id"weapon_knife")
        
set_member(idm_iAccount1)
    }
}

read_ini()
{
    new 
_sz_file[] = "addons/amxmodx/configs/pug_private.ini"
    
if(file_exists(_sz_file))
    {
        
server_print("Servidor Privado!!!!!")
        private = 
true
        
new fh fopen(_sz_file"r")
        new 
line[34]
        new 
_auth[32]
        new 
_sz_team[3]

        while(!
feof(fh))
        {
            
fgets(fhlinecharsmax(line))
            
trim(line)
            if(!
line[0] || line[0] == ';' || line[0] == '/')
            {
                continue;
            }
            
parse(line_authcharsmax(_auth), _sz_teamcharsmax(_sz_team))
            
trim(_sz_team)
            
trim(_auth)
            
TrieSetCell(g_private_authstr_to_num(_sz_team))
        }
        
fclose(fh)
    }
    else
    {
        private = 
false
        server_print
("Servidor Publico!!!!!")
    }
}

public 
client_connect(id)
{
    if(private)
    {
        new 
_steam_id[32]
        
get_user_authid(id_steam_idcharsmax(_steam_id))
        
        if(!
TrieKeyExists(g_private_steam_id))
        {
            
server_cmd("kick #%i 'Servidor Privado!!!'"get_user_userid(id))
            return
        }
    }
}

public 
pfn_money(id)
{
    if(
round_knife)
    {
        
set_member(idm_iAccount1)
        return
    }
    if(
pug_state == ALIVE)
    {
        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(!(
1<= <= iMaxPlayers) || == k)
        {
            
g_iDeaths[v]++
            
g_iFrags[v]--
        }
        else
        {
            
g_iFrags[k]++
            
g_iDeaths[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 
cmds_vidas(id)
{
    new 
team get_team(id)
    new 
name[32]
    for(new 
<= iMaxPlayers i++)
    {
        if(
is_user_connected(i) && (<= get_team(i) <= 2) && team != get_team(i) && is_user_alive(i))
        {
            
get_user_name(iname32)
            
CC(id"%s !g%s !yHP: !g%i"TAGnameget_user_health(i))
        }
    }
}

public 
cmds_vidas_team(id)
{
    if(
pug_state != ALIVE || is_user_alive(id))
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    new 
team get_user_team(id)
    new 
name[32]
    for(new 
<= iMaxPlayers i++)
    {
        if(
team != get_user_team(i) || <= get_user_team(i) <= || !is_user_alive(i))    continue
        
get_user_name(iname32)
        
CC(id"%s !g%s !yHP: !g%i"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
}

public 
cmd_dmg(id)
{
    if(
pug_state != ALIVE || is_user_alive(id))
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    new 
tmp_name[32], counthitconndmg
    
for(new <= iMaxPlayers i++)
    {
        
hit g_iHits[i][id]
        if(
hit)
        {
            
count++
            
dmg g_iDmg[i][id]
            
conn is_user_connected(i)
            
get_user_name(itmp_namecharsmax(tmp_name))
            
            
CC(id"%s !y| !g%s !y| Dmg: !g%i !y| Hits: !g%i "TAGtmp_namedmghitconn "" " | Jugador desconectado")
        }
    }
    if(!
count)
    {
        
CC(id"%s !yNo Le diste a nadie en esta ronda"TAG)
    }
}

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)
    {
        return 
HC_CONTINUE
    
}
    else if(
is_intermission)
    {
        
SetHookChainReturn(ATYPE_INTEGER1)
        return 
HC_SUPERCEDE
    
}
    if(
round_knife)
    {
        if(
status == WINSTATUS_CTS)
        {
            for(new 
<= iMaxPlayers i++)
            {
                if(!
is_user_connected(i) || !(<= get_team(i) <= 2))
                {
                    continue;
                }
                
rg_switch_team(i)
            }
            
client_print(0print_chat"%s Han ganado los CTs, Se realizara un cambio de equipos"TAG)
        }
        else if(
status == WINSTATUS_TERRORISTS)
        {
            
client_print(0print_chat"%s Han ganado los TTs, No realizara cambio de equipos"TAG)
        }
        else
        {
            
client_print(0print_chat"%s Nadie Gano!, No realizara cambio de equipos"TAG)
        }
        
round_knife false
        
#if defined END_ROUND_KNIFE_FIX
        
set_cvar_num(Pregame_Cmds[1][COMMAND], 1)
        
#endif
        
DisableHamForward(PlayerSpawn)
        
SetHookChainReturn(ATYPE_INTEGER1)
        
Send_TextMsg(status == WINSTATUS_TERRORISTS "#Terrorists_Win" status == WINSTATUS_CTS "#CTs_Win" "")
        
set_cvar_num("sv_restart"4)

        
DisableHamForward(SpawnWeapon)
        
unregister_message(gMsgStatusIcongMsgRegisterStatusIcon)
        
rg_send_audio(0status == WINSTATUS_TERRORISTS "%!MRAD_terwin" status == WINSTATUS_CTS "%!MRAD_ctwin" "%!MRAD_rounddraw"PITCH_NORM)
        return 
HC_SUPERCEDE
    
}
    
    if(
status == WINSTATUS_CTS)
    {
        
g_iRound_team[CT]++
        
emessage_begin(MSG_ALLgMsgTeamScore)
        
ewrite_string("CT")
        
ewrite_short(g_iRound_team[CT])
        
emessage_end()
    }
    else if(
status == WINSTATUS_TERRORISTS)
    {
        
g_iRound_team[TT]++
        
emessage_begin(MSG_ALLgMsgTeamScore)
        
ewrite_string("TERRORIST")
        
ewrite_short(g_iRound_team[TT])
        
emessage_end()
    }

    
fn_update_server_name(0)

    if(
g_iRounds == 15 && !half_time)
    {
        
EnableHamForward(PlayerPostink)
        
g_vote_countdown 15
        set_task
(1.0"pfn_intermission_count"TASK_HUD_READY__"b")
        
set_cvar_num("sv_maxspeed"0)
        
is_intermission true
        half_time 
true
        rg_send_audio
(0status == WINSTATUS_TERRORISTS "%!MRAD_terwin" status == WINSTATUS_CTS "%!MRAD_ctwin" "%!MRAD_rounddraw"PITCH_NORM)
        
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))])
        
client_cmd(0"wait;^"mp3fadeTime^" ^"0.5^";wait")
        
SetHookChainReturn(ATYPE_INTEGER1)
        return 
HC_SUPERCEDE
    
}
    else if(
g_iRounds == 30 || g_iRound_team[CT] >= 16 || g_iRound_team[TT] >= 16)
    {
        
EnableHamForward(PlayerPostink)
        
g_vote_countdown 15
        set_task
(1.0"pfn_pug_end_countdown"TASK_PUG_END__"b")
        
set_cvar_num("sv_maxspeed"0)
        
is_intermission true
        Send_TextMsg
(status == WINSTATUS_TERRORISTS "#Terrorists_Win" status == WINSTATUS_CTS "#CTs_Win" "")
        
rg_send_audio(0status == WINSTATUS_TERRORISTS "%!MRAD_terwin" status == WINSTATUS_CTS "%!MRAD_ctwin" "%!MRAD_rounddraw"PITCH_NORM)
        
client_cmd(0"mp3 play ^"%s^""SND_MUSIC[random_num(0charsmax(SND_MUSIC))])
        
client_cmd(0"wait;^"mp3fadeTime^" ^"0.5^";wait")
        
SetHookChainReturn(ATYPE_INTEGER1)
        return 
HC_SUPERCEDE
    
}

    return 
HC_CONTINUE

}

stock Send_TextMsg(msg[])
{
    
message_begin(MSG_BROADCASTgMsgTextMsg)
    
write_byte(4)
    
write_string(msg)
    
message_end()
}

public 
pfn_pug_end_countdown(task)
{
    if(--
g_vote_countdown 0)
    {
        if(
g_iRound_team[CT] == g_iRound_team[TT])
        {
            
make_hud_title("La partida quedo empatada")
        }
        else if(
g_iRound_team[CT] >= g_iRound_team[TT])
        {
            
make_hud_title("Los Anti-Terroristas Han ganado la partida")
        }
        else
        {
            
make_hud_title("Los Terroristas Han ganado la partida")
        }
        
make_hud_body("Reiniciando en: %i"g_vote_countdown)
    }
    else
    {
        
DisableHamForward(PlayerPostink)
        
remove_task(task)
        
start_pregame()
        
client_cmd(0"-showscores")
        
client_cmd(0"wait;^"mp3fadeTime^" ^"0.5^";wait")
        
client_cmd(0"wait;^"cd^" ^"fadeout^";wait")
    }
}

public 
pfn_intermission_count(task)
{
    if(--
g_vote_countdown 0)
    {
        
make_hud_title("Descanso:")
        
make_hud_body("Cambio de Equipos en 00:%02i"g_vote_countdown)
    }
    else
    {
        
client_cmd(0"wait;^"mp3fadeTime^" ^"0.5^";wait")
        
client_cmd(0"wait;^"cd^" ^"fadeout^";wait")
        
remove_task(task)
        
DisableHamForward(PlayerPostink)
        
set_cvar_num("sv_maxspeed"320)
        
set_cvar_num("sv_restart"1)
        new 
temp g_iRound_team[CT]
        
g_iRound_team[CT] = g_iRound_team[TT]
        
g_iRound_team[TT] = temp
        is_intermission 
false
        
for(new i<= iMaxPlayers ;i++)
        {
            if(!
is_user_connected(i) || !(1<= get_team(i) <= 2))
            {
                continue
            }
            
rg_switch_team(i)
        }
        
        
client_cmd(0"-showscores")
    }
}

fn_update_server_name(id)
{
    new 
szFmt[32]
    if(
round_knife)
    {
        
formatex(szFmtcharsmax(szFmt), "Ronda de cuchillos")
    }
    else if(
pug_state != NO_ALIVE)
    {
        
formatex(szFmtcharsmax(szFmt), "Ronda:%i - CT:%i Vs TT:%i"g_iRoundsg_iRound_team[CT], g_iRound_team[TT])
    }
    else
    {
        
formatex(szFmtcharsmax(szFmt), "agaming.pro")
    }
    if(
id)
    {
        
message_begin(MSG_ONEgMsgServerName, {000}, id)
    }
    else
    {
        
message_begin(MSG_BROADCASTgMsgServerName)
    }
    
write_string(szFmt)
    
message_end();
    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 - TT:%i Vs CT:%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 - CT:%i Vs TT:%i"g_iRoundsg_iRound_team[CT], g_iRound_team[TT])
        }
        else
        {
            
formatex(szFmtcharsmax(szFmt), "Ronda:%i - 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"agaming.pro")
    }
    
}

public 
ev_new_round()
{
    
    if(
pug_state == NO_ALIVE)
    {
        return
    }
    else if(
pug_state == COMMENCING)
    {
        
DisableHamForward(SpawnWeapon)
        
pug_state ALIVE
        set_cvar_num
("mp_round_infinite"0)
    }
    
    if(
round_knife)
    {
        
fn_update_server_name(0)
        return
    }

    
g_iRounds++

    
#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)
    {
        
        
set_hudmessage(255255255, -1.00.301.01.5)
        if(
g_iRounds == 30)
        {
            
show_hudmessage(0"Ronda Final")
        }
        else
        {
            
show_hudmessage(0"Punto de partido")
        }
    }

    
fn_update_server_name(0)
    
fn_score(0)
    
    for(new 
<= iMaxPlayers i++)
    {
        
arrayset(g_iDmg[i], 0MAXPLAYERS)
        
arrayset(g_iHits[i], 0MAXPLAYERS)
    }
}

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))
    new 
dh open_dir("maps"filecharsmax(file))
    if(!
dh)
    {
        
set_fail_state("Error al abrir la carpeta de mapas");
        return
    }
    
    while(
dh)
    {
        
trim(file)
        if(
check_bsp_file(file))
        {
            
replace(filecharsmax(file), ".bsp""")
            if(
equal(curmapfile))
            {
                continue;
            }
            
ArrayPushString(g_mapsfile)
        }
        if(!
next_file(dhfilecharsmax(file)))
        {
            
close_dir(dh)
            
dh false
        
}
    }
    
}

bool:check_bsp_file(file[])
{
    if(
equal(file[strlen(file)-4], ".bsp"))
    {
        return 
true
    
}
    
    return 
false
}

public 
pfn_postink(id)
{
    if((
<= get_team(id) <= 2) && pug_state == ALIVE)
    {
        
client_cmd(id"+showscores")
    }
}

public 
pfn_remove_weapon(ent)
{
    
set_pev(entpev_flagsFL_KILLME)
}

public 
pfn_remove_entity(id)
{
    if(
pev_valid(id))
    {
        
engfunc(EngFunc_RemoveEntityid)
    }
    
//client_print(0, print_chat, "Think")
}

reset_user_vars()
{
    
arrayset(readyfalseMAXPLAYERS)
    
ready_count 0
    g_vote_id 
0;
    
round_knife false
    half_time 
false
    g_iRound_team
[TT] = 0
    g_iRound_team
[CT] = 0
    arrayset
(g_iFrags0MAXPLAYERS)
    
arrayset(g_iDeaths0MAXPLAYERS)
}

stock pug_register_command(Command[], Function[], Plugin)
{
/*
    new szPlugin[5]
    num_to_str(Plugin, szPlugin, charsmax(szPlugin))
*/
    
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])
    }
    
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()
{
    
set_hudmessage(255255420.58/*1058306785*/0.04/*1025758986*/Sync11.00/*1065353216*/1.00/*1065353216*/0.10/*1036831949*/0.10/*1036831949*/);
    new 
i;
    new 
__pcount 0
    
for(<= iMaxPlayers ;i++ )
    {
        if(!
is_user_connected(i) || !(<= get_user_team(i) <= 2))
        {
            continue;
        }
        
__pcount += 1
    
}
    
ShowSyncHudMsg(0Sync1"RTB Team %i / %i^nPagina agaming.pro"__pcount get_pcvar_num(pcvar_max_players))
    new 
fmt[1089], name[18]

    
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.580.1201.001.100.100.20, -1)
    
ShowSyncHudMsg(0Sync2fmt)

    
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{
            
format(fmtcharsmax(fmt), "%s (No Listo)^n"fmt)
        }
    }
    
set_hudmessage(242195430.840.1201.001.100.100.20, -1)
    
ShowSyncHudMsg(0Sync3fmt)
}

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_register_vote""_native_register_vote")
    
register_native("pug_next_vote""_native_next_vote")
}

public 
_native_register_vote(plpr)
{
    
//pug_register_vote(funcion[])
    
new string[32], num[4]
    
get_string(1stringcharsmax(string))
    
num_to_str(g_vote_menues_countnumcharsmax(num))
    new 
arr[2]
    
arr[0] = get_func_id(stringpl)
    if(!
arr[0])
    {
        
log_amx("Funcion %s no existe"string)
        return
    }
    
arr[1] = pl
    TrieSetArray
(g_vote_menuesnumarrsizeof(arr))
    
g_vote_menues_count += 1
}

public 
_native_next_vote(plpr)
{
    
next_vote();
}

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_team(id) <= 2))
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    else if(
ready[id])
    {
        
CC(id"%s !yYa estas listo"TAG)
        return
    }
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    
CC(id"%s !g%s !yEsta Listo"TAGname)
    
ready[id] = true
    ready_count 
++
    if(
ready_count == get_pcvar_num(pcvar_max_players))
    {
        
start_vote()
    }
}

public 
pfn_unready(id)
{
    if(
pug_state != NO_ALIVE)
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    else if(!
ready[id])
    {
        
CC(id"%s !yAun no estas listo"TAG)
        return
    }
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    
CC(id"%s !g%s !yDejo de estar Listo"TAGname)
    
ready[id] = false;
    
ready_count --
}

public 
pfn_TextMsg(meid)
{
    static 
msg[23]
    
get_msg_arg_string(2msgcharsmax(msg))
    if(
equal(msg"#Game_will_restart_in"))
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
pfn_Hook_ChooseTeam(id_:slot)
{
    new 
count_tplayers[32], count_ct
    
if(!(<= slot <= 2))
    {
        if(
slot == 5)
        {
            
get_players(playerscount_t"e""TERRORIST")
            
get_players(playerscount_ct"e""CT")

            if(
count_t >= (get_pcvar_num(pcvar_max_players) / 2) && count_ct >= (get_pcvar_num(pcvar_max_players) / 2) )
            {
                
CC(id"%s !yTodos los equipos se encuentran llenos"TAG)
                
SetHookChainReturn(ATYPE_INTEGER0)
                return 
HC_BREAK
            
}
        }
        return 
HC_CONTINUE
    
}
    else if((
<= slot <= 2) && (<= get_team(id) <= 2) && pug_state == ALIVE)
    {
        
CC(id"%s !yNo 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[50]
    
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
    new 
_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))
    {
        new 
_c_team
        TrieGetCell
(g_private_sz__steam_id_put_c_team)
        
        if(
get_team(id) == _c_team)
        {
            return
        }
        
        switch(
_c_team)
        {
            case 
1rg_set_user_team(idTEAM_TERRORIST)
            case 
2rg_set_user_team(idTEAM_CT)
            case 
3rg_join_team(idTEAM_SPECTATOR)
        }
        
        if(
<= _c_team <= 2)
        {
            
ExecuteHam(Ham_CS_RoundRespawnid)
        }
    }
}

public 
client_disconnect(id)
{
    if(
is_intermission)
    {
        return
    }
    if(
ready[id])
    {
        
ready[id] = false
        ready_count
--
    }
    new 
team get_team(id)
    if(
pug_state == ALIVE && (<= team <= 2))
    {
        new 
count 0
        
        
for(new <= iMaxPlayers ;i++)
        {
            if(!
is_user_connected(i) || == id || get_team(i) != team)
            {
                continue
            }
            
count++
        }
        if(
count <= 2)
        {
            
CC(id"%s !yPartida cancelada por ausencia de jugadores en el equipo !g%s"TAGteam == "Terrorista" "Anti-Terrorista")
            
start_pregame()
        }
    }
}

fn_score(id=0)
{
    if(
pug_state == NO_ALIVE)
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    if(
g_iRound_team[CT] == g_iRound_team[TT])
    {
        
CC(id"%s !yLa puntuacion esta empatada !g%i !y- !g%i"TAGg_iRound_team[CT], g_iRound_team[TT])
    }
    else
    {
        
CC(id"%s !y%s: !g%i !y- %s: !g%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)
    
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(0Sync1fmt)
}

make_hud_body(msg[], any:...)
{
    new 
fmt[512]
    
vformat(fmtcharsmax(fmt), msg2)
    
set_hudmessage(255255255, -1.00.0301.01.1)
    
ShowSyncHudMsg(0Sync2fmt)
}

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(15.0"pfn_vote_map_end"TASK_END_VOTE)
                
g_vote_countdown 15
                pug_state 
VOTEMAP
                start_vote_map
()
            }
            else
            {
                
set_pcvar_num(g_pcvar_votemap1)
                
next_vote();
            }
        }
        default :
        {
            new 
num[4], arr[2]
            
num_to_str(g_vote_idnumcharsmax(num))
            if(
TrieKeyExists(g_vote_menuesnum))
            {
                
TrieGetArray(g_vote_menuesnumarrsizeof(arr))
                
callfunc_begin_i(arr[0], arr[1])
                
callfunc_end();
            }
            else
            {
                
start_countdown()
            }
        }
    }
}

public 
start_countdown()
{
    
EnableHamForward(PlayerPostink)
    
set_cvar_num("sv_maxspeed"0)
    
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
    make_menu_votemap
()
}

make_menu_votemap()
{
    
arrayset(g_votes0sizeof(g_votes))
    
g_VoteMenu menu_create("\yRTB\w Elige un mapa""mh_vote_map")
    new 
map[32]
    new 
i
    
for(ArraySize(g_maps) ;i++)
    {
        
ArrayGetString(g_mapsimapcharsmax(map))
        
menu_additem(g_VoteMenumap)
    }
    
menu_setprop(g_VoteMenuMPROP_EXITMEXIT_ALL)

    for(
<= iMaxPlayers ;i++ )
    {
        if(!
is_user_connected(i) || !( <= get_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))
    {
        
next_vote();
    }
}

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)
    {
        
CC(0"%s !ySe decidio !g%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(!
is_user_admin(id))
    {
        
CC(id"%s !yNo tienes acceso a este comando"TAG)
        return
    }
    else if(
pug_state != NO_ALIVE)
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    
start_vote()
}

public 
pfn_force_cancel(id)
{
    if(!
is_user_admin(id))
    {
        
CC(id"%s !yNo tienes acceso a este comando"TAG)
        return
    }
    else if(
pug_state != ALIVE)
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    
start_pregame()
}

public 
pfn_force_restart_pug(id)
{
    if (!
is_user_admin(id))
    {
        
CC(id"%s No !ytienes acceso a este comando"TAG)
        return
    }
    
set_cvar_num("sv_restart"1)
    return
}

public 
pfn_forceready(id)
{
    if(!
is_user_admin(id))
    {
        
CC(id"%s !yNo tienes acceso a este comando"TAG)
        return
    }
    else if(
pug_state != NO_ALIVE)
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    
fn_forceready()
    new 
name[32]
    
get_user_name(idname31)
    
CC(id"%s !g%s !yHa forzado a todos a estar en modo listo"TAGname)
}

fn_forceready()
{
    new 
catch_players get_pcvar_num(pcvar_max_players)
    for(new 
<= iMaxPlayers i++)
    {
        if(!
is_user_connected(i) || !(1<= get_team(i) <= 2) || ready[i])
        {
            continue
        }
        
ready[i] = true;
        
ready_count++
        if(
ready_count == catch_players)
        {
            
start_vote()
            break;
        }
    }
}

public 
pfn_waiting_players(task)
{
    new 
pcount 0
    
for(new <= iMaxPlayers i++)
    {
        if(
is_user_connected(i) && <= get_team(i) <= 2)
        {
            
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)
        }
    }
    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();
        
CC(0"%s !yPartida no iniciada por la ausencia de jugadores"TAG)

    }
}

public 
pfn_starting_game(task)
{
    if(
g_vote_countdown == 1)
    {
        
start_pug()
        
pug_state COMMENCING
        
if(get_pcvar_num(pcvar_knife) > 0)
        {
            
round_knife true
        
}
        
EnableHamForward(PlayerSpawn)
    }

    if(
g_vote_countdown-- > 0)
    {
        
center_print(0"Empezando Partida: %i^n^n^n^n"g_vote_countdown)

    }
    else
    {
        
DisableHamForward(PlayerPostink)
        
set_cvar_num("sv_maxspeed"320)
        
remove_task(task)
        
center_print(0" ");
        if(
get_pcvar_num(pcvar_knife) > 0)
        
        {
            
CC(0"%s !yRonda cuchillo, el equipo ganador sera !gTT"TAG)
        }
    }
}

public 
plugin_precache()
{
    
precache_generic(SND_COUNTER_BEEP)
}

stock CC(const Index, const input[], any:...)
{
    static 
i_Counti_Count 1;
    static 
sz_Players[32];
    static 
sz_Msg[191];

    new 
g_messageid_saytext;
    
g_messageid_saytext get_user_msgid("SayText");

    
vformat(sz_Msgcharsmax(sz_Msg), input3);

    
replace_all(sz_Msgcharsmax(sz_Msg), "!y" "^1");
    
replace_all(sz_Msgcharsmax(sz_Msg), "!t" "^3");
    
replace_all(sz_Msgcharsmax(sz_Msg), "!g" "^4");

    if(
Indexsz_Players[0] = Index;
    else 
get_players(sz_Playersi_Count"ch");

    for(new 
0i_Counti++)
    {
        if(
is_user_connected(sz_Players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEg_messageid_saytext_sz_Players[i]);
            
write_byte(sz_Players[i]);
            
write_string(sz_Msg);
            
message_end();
        }
    }
}

public 
bomb_explode(id)
{
    {
        
g_iFrags[id] += 3
    
}
    return 
HC_CONTINUE
}

public 
bomb_defused(id)
{
    {
        
g_iFrags[id] += 3
    
}
    return 
HC_CONTINUE

Aprendiendo scripting Excitedeyes || Tratare ayudar en lo que pueda Trolleyes || PD: Soy pobre Cutecry
Responder
#7
Código PHP:
#define MAXPLAYERS 15
->
#define MAXPLAYERS 32 

si sigue con el error agrega un log para ver cual es el valor del parametro id
Código PHP:
public bomb_explode(id)
{
    
log_to_file("debug.log""bomb_explode(%d)"id)
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE
}

public 
bomb_defused(id)
{
    
log_to_file("debug.log""bomb_defused(%d)"id)
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE

Responder
#8
(13/12/2018, 11:06 PM)Destro escribió:
Código PHP:
#define MAXPLAYERS 15
->
#define MAXPLAYERS 32 

si sigue con el error agrega un log para ver cual es el valor del parametro id
Código PHP:
public bomb_explode(id)
{
    
log_to_file("debug.log""bomb_explode(%d)"id)
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE
}

public 
bomb_defused(id)
{
    
log_to_file("debug.log""bomb_defused(%d)"id)
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE


ya no me salen los logs seguire testeando y te aviso luego
Aprendiendo scripting Excitedeyes || Tratare ayudar en lo que pueda Trolleyes || PD: Soy pobre Cutecry
Responder
#9
esto son los logs que me salen
Cita:L 12/14/2018 - 04:09:13: Log file started (file "cstrike/addons/amxmodx/logs/debug.log") (game "cstrike") (amx "1.8.2-dev")
L 12/14/2018 - 04:09:13: bomb_defused(5)
L 12/14/2018 - 04:14:24: bomb_defused(5)
L 12/14/2018 - 04:15:48: bomb_defused(2)
L 12/14/2018 - 04:18:55: bomb_defused(2)
L 12/14/2018 - 04:34:03: bomb_defused(3)
L 12/14/2018 - 04:35:30: bomb_defused(3)
L 12/14/2018 - 04:39:44: bomb_defused(1)
L 12/14/2018 - 04:41:37: bomb_defused(1)
L 12/14/2018 - 04:54:01: bomb_explode(7)
L 12/14/2018 - 05:10:09: bomb_defused(9)
L 12/14/2018 - 05:11:15: bomb_defused(10)
L 12/14/2018 - 05:25:00: bomb_explode(5)
L 12/14/2018 - 05:26:23: bomb_defused(3)
L 12/14/2018 - 05:31:04: bomb_explode(9)
Aprendiendo scripting Excitedeyes || Tratare ayudar en lo que pueda Trolleyes || PD: Soy pobre Cutecry
Responder
#10
no es nada, id es entero y eso devuelve
Responder
#11
(14/12/2018, 02:34 AM)whOo escribió: esto son los logs que me salen
Cita:L 12/14/2018 - 04:09:13: Log file started (file "cstrike/addons/amxmodx/logs/debug.log") (game "cstrike") (amx "1.8.2-dev")
L 12/14/2018 - 04:09:13: bomb_defused(5)
L 12/14/2018 - 04:14:24: bomb_defused(5)
L 12/14/2018 - 04:15:48: bomb_defused(2)
L 12/14/2018 - 04:18:55: bomb_defused(2)
L 12/14/2018 - 04:34:03: bomb_defused(3)
L 12/14/2018 - 04:35:30: bomb_defused(3)
L 12/14/2018 - 04:39:44: bomb_defused(1)
L 12/14/2018 - 04:41:37: bomb_defused(1)
L 12/14/2018 - 04:54:01: bomb_explode(7)
L 12/14/2018 - 05:10:09: bomb_defused(9)
L 12/14/2018 - 05:11:15: bomb_defused(10)
L 12/14/2018 - 05:25:00: bomb_explode(5)
L 12/14/2018 - 05:26:23: bomb_defused(3)
L 12/14/2018 - 05:31:04: bomb_explode(9)

Ahora puedes quitar el log desde el source code, ya está solucionado.
Responder
#12
(14/12/2018, 03:05 AM)Chema escribió:
(14/12/2018, 02:34 AM)whOo escribió: esto son los logs que me salen
Cita:L 12/14/2018 - 04:09:13: Log file started (file "cstrike/addons/amxmodx/logs/debug.log") (game "cstrike") (amx "1.8.2-dev")
L 12/14/2018 - 04:09:13: bomb_defused(5)
L 12/14/2018 - 04:14:24: bomb_defused(5)
L 12/14/2018 - 04:15:48: bomb_defused(2)
L 12/14/2018 - 04:18:55: bomb_defused(2)
L 12/14/2018 - 04:34:03: bomb_defused(3)
L 12/14/2018 - 04:35:30: bomb_defused(3)
L 12/14/2018 - 04:39:44: bomb_defused(1)
L 12/14/2018 - 04:41:37: bomb_defused(1)
L 12/14/2018 - 04:54:01: bomb_explode(7)
L 12/14/2018 - 05:10:09: bomb_defused(9)
L 12/14/2018 - 05:11:15: bomb_defused(10)
L 12/14/2018 - 05:25:00: bomb_explode(5)
L 12/14/2018 - 05:26:23: bomb_defused(3)
L 12/14/2018 - 05:31:04: bomb_explode(9)

Ahora puedes quitar el log desde el source code, ya está solucionado.

pero aun esta el bug de que hay veces q da las 3 kills y otras veces no y me siguen saliendo los mismo logs
Aprendiendo scripting Excitedeyes || Tratare ayudar en lo que pueda Trolleyes || PD: Soy pobre Cutecry
Responder
#13
pasa los logs de debug.log de la misma hora que te sale el log de error
Responder
#14
(14/12/2018, 12:53 PM)Destro escribió: pasa los logs de debug.log de la misma hora que te sale el log de error

Cita:L 12/14/2018 - 16:28:36: Log file started (file L 12/14/2018 - 16:28:36: Log file started (file "cstrike/addons/amxmodx/logs/debug.log") (game "cstrike") (amx "1.8.3-dev+5201")
L 12/14/2018 - 16:28:36: bomb_explode(1)
L 12/14/2018 - 16:32:19: bomb_defused(2)
Aprendiendo scripting Excitedeyes || Tratare ayudar en lo que pueda Trolleyes || PD: Soy pobre Cutecry
Responder
#15
eso esta bien... seguro que es a la misma hora que te sale el otro log ?
pasa los dos logs juntos
Responder
#16
(14/12/2018, 01:45 PM)Destro escribió: eso esta bien... seguro que es a la misma hora que te sale el otro log ?
pasa los dos logs juntos

cuales 2 logs juntos todo eso lo tengo en la sma del pug el code q me pasastes para los logs esta puesto en la sma del pug cual otro logs te tengo q pasar si es el de cuando defusa ya no me sale ese error ya q ahora sale el archivo txt con ese log y no me salta el otro
Aprendiendo scripting Excitedeyes || Tratare ayudar en lo que pueda Trolleyes || PD: Soy pobre Cutecry
Responder
#17
(13/12/2018, 11:06 PM)Destro escribió:
Código PHP:
#define MAXPLAYERS 15
->
#define MAXPLAYERS 32 

si sigue con el error agrega un log para ver cual es el valor del parametro id
Código PHP:
public bomb_explode(id)
{
    
log_to_file("debug.log""bomb_explode(%d)"id)
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE
}

public 
bomb_defused(id)
{
    
log_to_file("debug.log""bomb_defused(%d)"id)
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE


El servidor tiene 12 slots, no viene por ahi el error

Lo que si puede failear es la creacion de la varibale g_iFrags ..

(14/12/2018, 01:56 PM)whOo escribió:
(14/12/2018, 01:45 PM)Destro escribió: eso esta bien... seguro que es a la misma hora que te sale el otro log ?
pasa los dos logs juntos

cuales 2 logs juntos todo eso lo tengo en la sma del pug el code q me pasastes para los logs esta puesto en la sma del pug cual otro logs te tengo q pasar si es el de cuando defusa ya no me sale ese error ya q ahora sale el archivo txt con ese log y no me salta el otro

¿ Lo dejaste en debug el plugin ? Igualmente deberia saltar como anteriormente, chequea nuevamente.

Te pido nuevamente que pases el codigo entero.

Saludos,
cLAANS.-
Mi unico plugin.
Tutorial de niveles.

Ayudo, pero no de la manera que quieren, si quieren aprender les servirá lo mio, para pedir el codigo en bandeja tienen la sección 'Pedidos'

(09/11/2017, 09:30 PM)SoundBlaster escribió: Espera y llamo a los power rangers para que me digan la linea de error
Responder
#18
(14/12/2018, 04:54 PM)cLAANS escribió:
(13/12/2018, 11:06 PM)Destro escribió:
Código PHP:
#define MAXPLAYERS 15
->
#define MAXPLAYERS 32 

si sigue con el error agrega un log para ver cual es el valor del parametro id
Código PHP:
public bomb_explode(id)
{
    
log_to_file("debug.log""bomb_explode(%d)"id)
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE
}

public 
bomb_defused(id)
{
    
log_to_file("debug.log""bomb_defused(%d)"id)
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE


El servidor tiene 12 slots, no viene por ahi el error

Lo que si puede failear es la creacion de la varibale g_iFrags ..

(14/12/2018, 01:56 PM)whOo escribió:
(14/12/2018, 01:45 PM)Destro escribió: eso esta bien... seguro que es a la misma hora que te sale el otro log ?
pasa los dos logs juntos

cuales 2 logs juntos todo eso lo tengo en la sma del pug el code q me pasastes para los logs esta puesto en la sma del pug cual otro logs te tengo q pasar si es el de cuando defusa ya no me sale ese error ya q ahora sale el archivo txt con ese log y no me salta el otro

¿ Lo dejaste en debug el plugin ? Igualmente deberia saltar como anteriormente, chequea nuevamente.

Te pido nuevamente que pases el codigo entero.

Saludos,
cLAANS.-

si lo tengo con el debug
Código PHP:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <reapi>
#include <celltrie>

#define PLUGIN  "PUG MOD"
#define VERSION "1.31"
#define AUTHOR  "Sugisaki"

#define MAXPLAYERS 32
#define END_ROUND_KNIFE_FIX
#define get_team(%0) get_member(%0, m_iTeam)

#if AMXX_VERSION_NUM >= 183
    #define client_disconnect client_disconnected
#endif

new TASK_HUD_READY 552214
new TASK_HUD_VOTE 996541
new TASK_END_VOTE 441017
new TASK_PUG_END 778745

new const TAG[] = "!y[!gBRT!y]"

enum _:PUGSTATE
{
    
NO_ALIVE 0,
    
ALIVE,
    
COMMENCING,
    
VOTEMAP
}

enum _:PUG_ROUND
{
    
TT 0,
    
CT
}


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 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 Sync1
new Sync2
new Sync3
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 
g_vote_count

new g_VoteMenu

new gMsgStatusIcon
new gMsgRegisterStatusIcon

new gMsgServerName
new gMsgTextMsg
new gMsgScoreInfo
new gMsgTeamScore

new bool:is_intermission

new pcvar_knife

new SND_MUSIC[][] =
{
    
""
}
new 
SND_COUNTER_BEEP[] = "sound/UI/buttonrollover.wav"

enum _:CMDS
{
    
COMMAND[32],
    
VALUE[10]
}
new 
g_vote_menues_count
new Trie:g_vote_menues
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""0"},
    {
"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_roundtime""0"},
    {
"allow_spectators""1"},
    {
"sv_timeout""20"},
    {
"sv_maxspeed""320"}
}

new 
PugStartCmds[][CMDS] = 
{
    {
"mp_forcerespawn""0"},
    {
"mp_startmoney""800"},
    {
"mp_freezetime""0"},
    {
"sv_alltalk""2"},
    {
"mp_refill_bpammo_weapons""0"},
    {
"mp_buytime"".25"},
    {
"mp_forcechasecam""2"},
    {
"mp_forcecamera""2"},
    {
"mp_freezetime""11"},
    {
"mp_roundtime""1.75"},
    {
"mp_auto_join_team""0"}
}

public 
plugin_init()
{
    
g_PluginId register_plugin(PLUGINVERSIONAUTHOR)
    
pug_state NO_ALIVE
    g_vote_menues_count 
2
    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)
    
DefuseKit RegisterHam(Ham_Spawn"item_thighpack""pfn_remove_weapon"1)
    
register_event("Money""pfn_money""b")
    
g_private TrieCreate()
    
g_vote_menues TrieCreate()
    
pcvar_knife register_cvar("pug_knife""0")
    
g_pcvar_votemap register_cvar("pug_votemap""1")
    
t_Command TrieCreate()
    
t_Command_Plugin TrieCreate()
    
g_maps ArrayCreate(32)
    
iMaxPlayers get_maxplayers();
    
Sync1 CreateHudSyncObj()
    
Sync2 CreateHudSyncObj()
    
Sync3 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")

    
register_message(gMsgTeamScore"pfn_TeamScore")
    
    
pcvar_max_players register_cvar("pug_players""10")
    
    
register_event("HLTV""ev_new_round""a""1=0""2=0")

    
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_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(".nolisto""pfn_unready"g_PluginId)
    
pug_register_command(".unready""pfn_unready"g_PluginId)
    
pug_register_command(".score""pfn_score"g_PluginId)
    
pug_register_command(".start""pfn_force_start_pug"g_PluginId)
    
pug_register_command(".rr""pfn_force_restart_pug"g_PluginId)
    
pug_register_command(".force""pfn_forceready"g_PluginId)
    
pug_register_command(".cancel""pfn_force_cancel"g_PluginId)
    
pug_register_command(".dmg""cmd_dmg"g_PluginId)
    
pug_register_command(".hp""cmds_vidas"g_PluginId)
    
pug_register_command(".hpteam""cmds_vidas_team"g_PluginId)

    
set_task(5.0"start_pregame")
    
read_maps()
    
read_ini()
}

public 
pfn_player_spawn(id)
{
    if(
round_knife)
    {
        
rg_remove_all_items(id)
        
rg_give_item(id"weapon_knife")
        
set_member(idm_iAccount1)
    }
}

read_ini()
{
    new 
_sz_file[] = "addons/amxmodx/configs/pug_private.ini"
    
if(file_exists(_sz_file))
    {
        
server_print("Servidor Privado!!!!!")
        private = 
true
        
new fh fopen(_sz_file"r")
        new 
line[34]
        new 
_auth[32]
        new 
_sz_team[3]

        while(!
feof(fh))
        {
            
fgets(fhlinecharsmax(line))
            
trim(line)
            if(!
line[0] || line[0] == ';' || line[0] == '/')
            {
                continue;
            }
            
parse(line_authcharsmax(_auth), _sz_teamcharsmax(_sz_team))
            
trim(_sz_team)
            
trim(_auth)
            
TrieSetCell(g_private_authstr_to_num(_sz_team))
        }
        
fclose(fh)
    }
    else
    {
        private = 
false
        server_print
("Servidor Publico!!!!!")
    }
}

public 
client_connect(id)
{
    if(private)
    {
        new 
_steam_id[32]
        
get_user_authid(id_steam_idcharsmax(_steam_id))
        
        if(!
TrieKeyExists(g_private_steam_id))
        {
            
server_cmd("kick #%i 'Servidor Privado!!!'"get_user_userid(id))
            return
        }
    }
}

public 
pfn_money(id)
{
    if(
round_knife)
    {
        
set_member(idm_iAccount1)
        return
    }
    if(
pug_state == ALIVE)
    {
        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(!(
1<= <= iMaxPlayers) || == k)
        {
            
g_iDeaths[v]++
            
g_iFrags[v]--
        }
        else
        {
            
g_iFrags[k]++
            
g_iDeaths[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 
cmds_vidas(id)
{
    new 
team get_team(id)
    new 
name[32]
    for(new 
<= iMaxPlayers i++)
    {
        if(
is_user_connected(i) && (<= get_team(i) <= 2) && team != get_team(i) && is_user_alive(i))
        {
            
get_user_name(iname32)
            
CC(id"%s !g%s !yHP: !g%i"TAGnameget_user_health(i))
        }
    }
}

public 
cmds_vidas_team(id)
{
    if(
pug_state != ALIVE || is_user_alive(id))
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    new 
team get_user_team(id)
    new 
name[32]
    for(new 
<= iMaxPlayers i++)
    {
        if(
team != get_user_team(i) || <= get_user_team(i) <= || !is_user_alive(i))    continue
        
get_user_name(iname32)
        
CC(id"%s !g%s !yHP: !g%i"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
}

public 
cmd_dmg(id)
{
    if(
pug_state != ALIVE || is_user_alive(id))
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    new 
tmp_name[32], counthitconndmg
    
for(new <= iMaxPlayers i++)
    {
        
hit g_iHits[i][id]
        if(
hit)
        {
            
count++
            
dmg g_iDmg[i][id]
            
conn is_user_connected(i)
            
get_user_name(itmp_namecharsmax(tmp_name))
            
            
CC(id"%s !y| !g%s !y| Dmg: !g%i !y| Hits: !g%i "TAGtmp_namedmghitconn "" " | Jugador desconectado")
        }
    }
    if(!
count)
    {
        
CC(id"%s !yNo Le diste a nadie en esta ronda"TAG)
    }
}

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)
    {
        return 
HC_CONTINUE
    
}
    else if(
is_intermission)
    {
        
SetHookChainReturn(ATYPE_INTEGER1)
        return 
HC_SUPERCEDE
    
}
    if(
round_knife)
    {
        if(
status == WINSTATUS_CTS)
        {
            for(new 
<= iMaxPlayers i++)
            {
                if(!
is_user_connected(i) || !(<= get_team(i) <= 2))
                {
                    continue;
                }
                
rg_switch_team(i)
            }
            
client_print(0print_chat"%s Han ganado los CTs, Se realizara un cambio de equipos"TAG)
        }
        else if(
status == WINSTATUS_TERRORISTS)
        {
            
client_print(0print_chat"%s Han ganado los TTs, No realizara cambio de equipos"TAG)
        }
        else
        {
            
client_print(0print_chat"%s Nadie Gano!, No realizara cambio de equipos"TAG)
        }
        
round_knife false
        
#if defined END_ROUND_KNIFE_FIX
        
set_cvar_num(Pregame_Cmds[1][COMMAND], 1)
        
#endif
        
DisableHamForward(PlayerSpawn)
        
SetHookChainReturn(ATYPE_INTEGER1)
        
Send_TextMsg(status == WINSTATUS_TERRORISTS "#Terrorists_Win" status == WINSTATUS_CTS "#CTs_Win" "")
        
set_cvar_num("sv_restart"4)

        
DisableHamForward(SpawnWeapon)
        
unregister_message(gMsgStatusIcongMsgRegisterStatusIcon)
        
rg_send_audio(0status == WINSTATUS_TERRORISTS "%!MRAD_terwin" status == WINSTATUS_CTS "%!MRAD_ctwin" "%!MRAD_rounddraw"PITCH_NORM)
        return 
HC_SUPERCEDE
    
}
    
    if(
status == WINSTATUS_CTS)
    {
        
g_iRound_team[CT]++
        
emessage_begin(MSG_ALLgMsgTeamScore)
        
ewrite_string("CT")
        
ewrite_short(g_iRound_team[CT])
        
emessage_end()
    }
    else if(
status == WINSTATUS_TERRORISTS)
    {
        
g_iRound_team[TT]++
        
emessage_begin(MSG_ALLgMsgTeamScore)
        
ewrite_string("TERRORIST")
        
ewrite_short(g_iRound_team[TT])
        
emessage_end()
    }

    
fn_update_server_name(0)

    if(
g_iRounds == 15 && !half_time)
    {
        
EnableHamForward(PlayerPostink)
        
g_vote_countdown 15
        set_task
(1.0"pfn_intermission_count"TASK_HUD_READY__"b")
        
set_cvar_num("sv_maxspeed"0)
        
is_intermission true
        half_time 
true
        rg_send_audio
(0status == WINSTATUS_TERRORISTS "%!MRAD_terwin" status == WINSTATUS_CTS "%!MRAD_ctwin" "%!MRAD_rounddraw"PITCH_NORM)
        
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))])
        
client_cmd(0"wait;^"mp3fadeTime^" ^"0.5^";wait")
        
SetHookChainReturn(ATYPE_INTEGER1)
        return 
HC_SUPERCEDE
    
}
    else if(
g_iRounds == 30 || g_iRound_team[CT] >= 16 || g_iRound_team[TT] >= 16)
    {
        
EnableHamForward(PlayerPostink)
        
g_vote_countdown 15
        set_task
(1.0"pfn_pug_end_countdown"TASK_PUG_END__"b")
        
set_cvar_num("sv_maxspeed"0)
        
is_intermission true
        Send_TextMsg
(status == WINSTATUS_TERRORISTS "#Terrorists_Win" status == WINSTATUS_CTS "#CTs_Win" "")
        
rg_send_audio(0status == WINSTATUS_TERRORISTS "%!MRAD_terwin" status == WINSTATUS_CTS "%!MRAD_ctwin" "%!MRAD_rounddraw"PITCH_NORM)
        
client_cmd(0"mp3 play ^"%s^""SND_MUSIC[random_num(0charsmax(SND_MUSIC))])
        
client_cmd(0"wait;^"mp3fadeTime^" ^"0.5^";wait")
        
SetHookChainReturn(ATYPE_INTEGER1)
        return 
HC_SUPERCEDE
    
}

    return 
HC_CONTINUE

}

stock Send_TextMsg(msg[])
{
    
message_begin(MSG_BROADCASTgMsgTextMsg)
    
write_byte(4)
    
write_string(msg)
    
message_end()
}

public 
pfn_pug_end_countdown(task)
{
    if(--
g_vote_countdown 0)
    {
        if(
g_iRound_team[CT] == g_iRound_team[TT])
        {
            
make_hud_title("La partida quedo empatada")
        }
        else if(
g_iRound_team[CT] >= g_iRound_team[TT])
        {
            
make_hud_title("Los Anti-Terroristas Han ganado la partida")
        }
        else
        {
            
make_hud_title("Los Terroristas Han ganado la partida")
        }
        
make_hud_body("Reiniciando en: %i"g_vote_countdown)
    }
    else
    {
        
DisableHamForward(PlayerPostink)
        
remove_task(task)
        
start_pregame()
        
client_cmd(0"-showscores")
        
client_cmd(0"wait;^"mp3fadeTime^" ^"0.5^";wait")
        
client_cmd(0"wait;^"cd^" ^"fadeout^";wait")
    }
}

public 
pfn_intermission_count(task)
{
    if(--
g_vote_countdown 0)
    {
        
make_hud_title("Descanso:")
        
make_hud_body("Cambio de Equipos en 00:%02i"g_vote_countdown)
    }
    else
    {
        
client_cmd(0"wait;^"mp3fadeTime^" ^"0.5^";wait")
        
client_cmd(0"wait;^"cd^" ^"fadeout^";wait")
        
remove_task(task)
        
DisableHamForward(PlayerPostink)
        
set_cvar_num("sv_maxspeed"320)
        
set_cvar_num("sv_restart"1)
        new 
temp g_iRound_team[CT]
        
g_iRound_team[CT] = g_iRound_team[TT]
        
g_iRound_team[TT] = temp
        is_intermission 
false
        
for(new i<= iMaxPlayers ;i++)
        {
            if(!
is_user_connected(i) || !(1<= get_team(i) <= 2))
            {
                continue
            }
            
rg_switch_team(i)
        }
        
        
client_cmd(0"-showscores")
    }
}

fn_update_server_name(id)
{
    new 
szFmt[32]
    if(
round_knife)
    {
        
formatex(szFmtcharsmax(szFmt), "Ronda de cuchillos")
    }
    else if(
pug_state != NO_ALIVE)
    {
        
formatex(szFmtcharsmax(szFmt), "Ronda:%i - CT:%i Vs TT:%i"g_iRoundsg_iRound_team[CT], g_iRound_team[TT])
    }
    else
    {
        
formatex(szFmtcharsmax(szFmt), "agaming.pro")
    }
    if(
id)
    {
        
message_begin(MSG_ONEgMsgServerName, {000}, id)
    }
    else
    {
        
message_begin(MSG_BROADCASTgMsgServerName)
    }
    
write_string(szFmt)
    
message_end();
    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 - TT:%i Vs CT:%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 - CT:%i Vs TT:%i"g_iRoundsg_iRound_team[CT], g_iRound_team[TT])
        }
        else
        {
            
formatex(szFmtcharsmax(szFmt), "Ronda:%i - 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"agaming.pro")
    }
    
}

public 
ev_new_round()
{
    
    if(
pug_state == NO_ALIVE)
    {
        return
    }
    else if(
pug_state == COMMENCING)
    {
        
DisableHamForward(SpawnWeapon)
        
pug_state ALIVE
        set_cvar_num
("mp_round_infinite"0)
    }
    
    if(
round_knife)
    {
        
fn_update_server_name(0)
        return
    }

    
g_iRounds++

    
#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)
    {
        
        
set_hudmessage(255255255, -1.00.301.01.5)
        if(
g_iRounds == 30)
        {
            
show_hudmessage(0"Ronda Final")
        }
        else
        {
            
show_hudmessage(0"Punto de partido")
        }
    }

    
fn_update_server_name(0)
    
fn_score(0)
    
    for(new 
<= iMaxPlayers i++)
    {
        
arrayset(g_iDmg[i], 0MAXPLAYERS)
        
arrayset(g_iHits[i], 0MAXPLAYERS)
    }
}

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))
    new 
dh open_dir("maps"filecharsmax(file))
    if(!
dh)
    {
        
set_fail_state("Error al abrir la carpeta de mapas");
        return
    }
    
    while(
dh)
    {
        
trim(file)
        if(
check_bsp_file(file))
        {
            
replace(filecharsmax(file), ".bsp""")
            if(
equal(curmapfile))
            {
                continue;
            }
            
ArrayPushString(g_mapsfile)
        }
        if(!
next_file(dhfilecharsmax(file)))
        {
            
close_dir(dh)
            
dh false
        
}
    }
    
}

bool:check_bsp_file(file[])
{
    if(
equal(file[strlen(file)-4], ".bsp"))
    {
        return 
true
    
}
    
    return 
false
}

public 
pfn_postink(id)
{
    if((
<= get_team(id) <= 2) && pug_state == ALIVE)
    {
        
client_cmd(id"+showscores")
    }
}

public 
pfn_remove_weapon(ent)
{
    
set_pev(entpev_flagsFL_KILLME)
}

public 
pfn_remove_entity(id)
{
    if(
pev_valid(id))
    {
        
engfunc(EngFunc_RemoveEntityid)
    }
    
//client_print(0, print_chat, "Think")
}

reset_user_vars()
{
    
arrayset(readyfalseMAXPLAYERS)
    
ready_count 0
    g_vote_id 
0;
    
round_knife false
    half_time 
false
    g_iRound_team
[TT] = 0
    g_iRound_team
[CT] = 0
    arrayset
(g_iFrags0MAXPLAYERS)
    
arrayset(g_iDeaths0MAXPLAYERS)
}

stock pug_register_command(Command[], Function[], Plugin)
{
/*
    new szPlugin[5]
    num_to_str(Plugin, szPlugin, charsmax(szPlugin))
*/
    
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])
    }
    
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()
{
    
set_hudmessage(255255420.58/*1058306785*/0.04/*1025758986*/Sync11.00/*1065353216*/1.00/*1065353216*/0.10/*1036831949*/0.10/*1036831949*/);
    new 
i;
    new 
__pcount 0
    
for(<= iMaxPlayers ;i++ )
    {
        if(!
is_user_connected(i) || !(<= get_user_team(i) <= 2))
        {
            continue;
        }
        
__pcount += 1
    
}
    
ShowSyncHudMsg(0Sync1"BRT Team %i / %i^nPagina agaming.pro"__pcount get_pcvar_num(pcvar_max_players))
    new 
fmt[1089], name[18]

    
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.580.1201.001.100.100.20, -1)
    
ShowSyncHudMsg(0Sync2fmt)

    
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{
            
format(fmtcharsmax(fmt), "%s (No Listo)^n"fmt)
        }
    }
    
set_hudmessage(242195430.840.1201.001.100.100.20, -1)
    
ShowSyncHudMsg(0Sync3fmt)
}

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_register_vote""_native_register_vote")
    
register_native("pug_next_vote""_native_next_vote")
}

public 
_native_register_vote(plpr)
{
    
//pug_register_vote(funcion[])
    
new string[32], num[4]
    
get_string(1stringcharsmax(string))
    
num_to_str(g_vote_menues_countnumcharsmax(num))
    new 
arr[2]
    
arr[0] = get_func_id(stringpl)
    if(!
arr[0])
    {
        
log_amx("Funcion %s no existe"string)
        return
    }
    
arr[1] = pl
    TrieSetArray
(g_vote_menuesnumarrsizeof(arr))
    
g_vote_menues_count += 1
}

public 
_native_next_vote(plpr)
{
    
next_vote();
}

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_team(id) <= 2))
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    else if(
ready[id])
    {
        
CC(id"%s !yYa estas listo"TAG)
        return
    }
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    
CC(id"%s !g%s !yEsta Listo"TAGname)
    
ready[id] = true
    ready_count 
++
    if(
ready_count == get_pcvar_num(pcvar_max_players))
    {
        
start_vote()
    }
}

public 
pfn_unready(id)
{
    if(
pug_state != NO_ALIVE)
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    else if(!
ready[id])
    {
        
CC(id"%s !yAun no estas listo"TAG)
        return
    }
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    
CC(id"%s !g%s !yDejo de estar Listo"TAGname)
    
ready[id] = false;
    
ready_count --
}

public 
pfn_TextMsg(meid)
{
    static 
msg[23]
    
get_msg_arg_string(2msgcharsmax(msg))
    if(
equal(msg"#Game_will_restart_in"))
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
pfn_Hook_ChooseTeam(id_:slot)
{
    new 
count_tplayers[32], count_ct
    
if(!(<= slot <= 2))
    {
        if(
slot == 5)
        {
            
get_players(playerscount_t"e""TERRORIST")
            
get_players(playerscount_ct"e""CT")

            if(
count_t >= (get_pcvar_num(pcvar_max_players) / 2) && count_ct >= (get_pcvar_num(pcvar_max_players) / 2) )
            {
                
CC(id"%s !yTodos los equipos se encuentran llenos"TAG)
                
SetHookChainReturn(ATYPE_INTEGER0)
                return 
HC_BREAK
            
}
        }
        return 
HC_CONTINUE
    
}
    else if((
<= slot <= 2) && (<= get_team(id) <= 2) && pug_state == ALIVE)
    {
        
CC(id"%s !yNo 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[50]
    
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
    new 
_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))
    {
        new 
_c_team
        TrieGetCell
(g_private_sz__steam_id_put_c_team)
        
        if(
get_team(id) == _c_team)
        {
            return
        }
        
        switch(
_c_team)
        {
            case 
1rg_set_user_team(idTEAM_TERRORIST)
            case 
2rg_set_user_team(idTEAM_CT)
            case 
3rg_join_team(idTEAM_SPECTATOR)
        }
        
        if(
<= _c_team <= 2)
        {
            
ExecuteHam(Ham_CS_RoundRespawnid)
        }
    }
}

public 
client_disconnect(id)
{
    if(
is_intermission)
    {
        return
    }
    if(
ready[id])
    {
        
ready[id] = false
        ready_count
--
    }
    new 
team get_team(id)
    if(
pug_state == ALIVE && (<= team <= 2))
    {
        new 
count 0
        
        
for(new <= iMaxPlayers ;i++)
        {
            if(!
is_user_connected(i) || == id || get_team(i) != team)
            {
                continue
            }
            
count++
        }
        if(
count <= 2)
        {
            
CC(id"%s !yPartida cancelada por ausencia de jugadores en el equipo !g%s"TAGteam == "Terrorista" "Anti-Terrorista")
            
start_pregame()
        }
    }
}

fn_score(id=0)
{
    if(
pug_state == NO_ALIVE)
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    if(
g_iRound_team[CT] == g_iRound_team[TT])
    {
        
CC(id"%s !yLa puntuacion esta empatada !g%i !y- !g%i"TAGg_iRound_team[CT], g_iRound_team[TT])
    }
    else
    {
        
CC(id"%s !y%s: !g%i !y- %s: !g%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)
    
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(0Sync1fmt)
}

make_hud_body(msg[], any:...)
{
    new 
fmt[512]
    
vformat(fmtcharsmax(fmt), msg2)
    
set_hudmessage(255255255, -1.00.0301.01.1)
    
ShowSyncHudMsg(0Sync2fmt)
}

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(15.0"pfn_vote_map_end"TASK_END_VOTE)
                
g_vote_countdown 15
                pug_state 
VOTEMAP
                start_vote_map
()
            }
            else
            {
                
set_pcvar_num(g_pcvar_votemap1)
                
next_vote();
            }
        }
        default :
        {
            new 
num[4], arr[2]
            
num_to_str(g_vote_idnumcharsmax(num))
            if(
TrieKeyExists(g_vote_menuesnum))
            {
                
TrieGetArray(g_vote_menuesnumarrsizeof(arr))
                
callfunc_begin_i(arr[0], arr[1])
                
callfunc_end();
            }
            else
            {
                
start_countdown()
            }
        }
    }
}

public 
start_countdown()
{
    
EnableHamForward(PlayerPostink)
    
set_cvar_num("sv_maxspeed"0)
    
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
    make_menu_votemap
()
}

make_menu_votemap()
{
    
arrayset(g_votes0sizeof(g_votes))
    
g_VoteMenu menu_create("\yBRT\w Elige un mapa""mh_vote_map")
    new 
map[32]
    new 
i
    
for(ArraySize(g_maps) ;i++)
    {
        
ArrayGetString(g_mapsimapcharsmax(map))
        
menu_additem(g_VoteMenumap)
    }
    
menu_setprop(g_VoteMenuMPROP_EXITMEXIT_ALL)

    for(
<= iMaxPlayers ;i++ )
    {
        if(!
is_user_connected(i) || !( <= get_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))
    {
        
next_vote();
    }
}

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)
    {
        
CC(0"%s !ySe decidio !g%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(!
is_user_admin(id))
    {
        
CC(id"%s !yNo tienes acceso a este comando"TAG)
        return
    }
    else if(
pug_state != NO_ALIVE)
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    
start_vote()
}

public 
pfn_force_cancel(id)
{
    if(!
is_user_admin(id))
    {
        
CC(id"%s !yNo tienes acceso a este comando"TAG)
        return
    }
    else if(
pug_state != ALIVE)
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    
start_pregame()
}

public 
pfn_force_restart_pug(id)
{
    if (!
is_user_admin(id))
    {
        
CC(id"%s No !ytienes acceso a este comando"TAG)
        return
    }
    
set_cvar_num("sv_restart"1)
    return
}

public 
pfn_forceready(id)
{
    if(!
is_user_admin(id))
    {
        
CC(id"%s !yNo tienes acceso a este comando"TAG)
        return
    }
    else if(
pug_state != NO_ALIVE)
    {
        
CC(id"%s !yAccion no permitida en este momento"TAG)
        return
    }
    
fn_forceready()
    new 
name[32]
    
get_user_name(idname31)
    
CC(id"%s !g%s !yHa forzado a todos a estar en modo listo"TAGname)
}

fn_forceready()
{
    new 
catch_players get_pcvar_num(pcvar_max_players)
    for(new 
<= iMaxPlayers i++)
    {
        if(!
is_user_connected(i) || !(1<= get_team(i) <= 2) || ready[i])
        {
            continue
        }
        
ready[i] = true;
        
ready_count++
        if(
ready_count == catch_players)
        {
            
start_vote()
            break;
        }
    }
}

public 
pfn_waiting_players(task)
{
    new 
pcount 0
    
for(new <= iMaxPlayers i++)
    {
        if(
is_user_connected(i) && <= get_team(i) <= 2)
        {
            
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)
        }
    }
    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();
        
CC(0"%s !yPartida no iniciada por la ausencia de jugadores"TAG)

    }
}

public 
pfn_starting_game(task)
{
    if(
g_vote_countdown == 1)
    {
        
start_pug()
        
pug_state COMMENCING
        
if(get_pcvar_num(pcvar_knife) > 0)
        {
            
round_knife true
        
}
        
EnableHamForward(PlayerSpawn)
    }

    if(
g_vote_countdown-- > 0)
    {
        
center_print(0"Empezando Partida: %i^n^n^n^n"g_vote_countdown)

    }
    else
    {
        
DisableHamForward(PlayerPostink)
        
set_cvar_num("sv_maxspeed"320)
        
remove_task(task)
        
center_print(0" ");
        if(
get_pcvar_num(pcvar_knife) > 0)
        
        {
            
CC(0"%s !yRonda cuchillo, el equipo ganador sera !gTT"TAG)
        }
    }
}

public 
plugin_precache()
{
    
precache_generic(SND_COUNTER_BEEP)
}

stock CC(const Index, const input[], any:...)
{
    static 
i_Counti_Count 1;
    static 
sz_Players[32];
    static 
sz_Msg[191];

    new 
g_messageid_saytext;
    
g_messageid_saytext get_user_msgid("SayText");

    
vformat(sz_Msgcharsmax(sz_Msg), input3);

    
replace_all(sz_Msgcharsmax(sz_Msg), "!y" "^1");
    
replace_all(sz_Msgcharsmax(sz_Msg), "!t" "^3");
    
replace_all(sz_Msgcharsmax(sz_Msg), "!g" "^4");

    if(
Indexsz_Players[0] = Index;
    else 
get_players(sz_Playersi_Count"ch");

    for(new 
0i_Counti++)
    {
        if(
is_user_connected(sz_Players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEg_messageid_saytext_sz_Players[i]);
            
write_byte(sz_Players[i]);
            
write_string(sz_Msg);
            
message_end();
        }
    }
}

public 
bomb_explode(id)
{
    
log_to_file("debug.log""bomb_explode(%d)"id)
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE
}

public 
bomb_defused(id)
{
    
log_to_file("debug.log""bomb_defused(%d)"id)
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE

Aprendiendo scripting Excitedeyes || Tratare ayudar en lo que pueda Trolleyes || PD: Soy pobre Cutecry
Responder
#19
para no hacer lio sobre que log tenes que pasar, cambia esto:
Código PHP:
public bomb_explode(id)
{
    if(!(
<= id <= 32))
    {
        
log_to_file("si_sale_esto_esta_mal.log""bomb_explode(%d)"id)
        return
    }

    
g_iFrags[id] += 3
    
    
return HC_CONTINUE
}

public 
bomb_defused(id)
{
    if(!(
<= id <= 32))
    {
        
log_to_file("si_sale_esto_esta_mal.log""bomb_defused(%d)"id)
        return
    }
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE

Responder
#20
(15/12/2018, 12:15 AM)Destro escribió: para no hacer lio sobre que log tenes que pasar, cambia esto:
Código PHP:
public bomb_explode(id)
{
    if(!(
<= id <= 32))
    {
        
log_to_file("si_sale_esto_esta_mal.log""bomb_explode(%d)"id)
        return
    }

    
g_iFrags[id] += 3
    
    
return HC_CONTINUE
}

public 
bomb_defused(id)
{
    if(!(
<= id <= 32))
    {
        
log_to_file("si_sale_esto_esta_mal.log""bomb_defused(%d)"id)
        return
    }
    
g_iFrags[id] += 3
    
    
return HC_CONTINUE


me sale esto logs al copilar
Cita:Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright © 1997-2006 ITB CompuPhase, AMX Mod X Team

Warning: Function "bomb_explode" should return a value on line 1586
Error: Function uses both "return" and "return <value>" on line 1590
Warning: Function "bomb_defused" should return a value on line 1599
Error: Function uses both "return" and "return <value>" on line 1602

2 Errors.
Could not locate output file C:\Users\Usuario\Desktop\pug_ages.amx (compile failed).
Aprendiendo scripting Excitedeyes || Tratare ayudar en lo que pueda Trolleyes || PD: Soy pobre Cutecry
Responder
#21
agregale un 0 después del return (return 0)
Responder
#22
(15/12/2018, 01:29 AM)Destro escribió: agregale un 0 después del return (return 0)

eso es todo lo que me sale
Cita:L 12/15/2018 - 04:36:37: Log file started (file "cstrike/addons/amxmodx/logs/debug.log") (game "cstrike") (amx "1.8.2-dev")
L 12/15/2018 - 04:36:37: bomb_explode(2)
L 12/15/2018 - 04:37:27: bomb_defused(1)
Aprendiendo scripting Excitedeyes || Tratare ayudar en lo que pueda Trolleyes || PD: Soy pobre Cutecry
Responder
#23
Probe el codigo que publicastes tal cual y funciono bien solo me dio error en el votemap
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)