Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <reapi>
- #define PLUGIN "LEL"
- #define VERSION "1.0"
- #define AUTHOR "Sugisaki"
- new g_iTeam[33]
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- RegisterHookChain(RG_HandleMenu_ChooseTeam, "pfn_ChooseTeam_Hook")
- }
- public pfn_ChooseTeam_Hook(id, _:slot)
- {
- if(slot == 5)
- {
- new count_t, count_ct
- count_player(5, count_t, count_ct)
- if(count_t == 5 && count_ct == 5)
- {
- client_print(id, print_chat, "Equipo lleno")
- SetHookChainReturn(ATYPE_INTEGER, 0)
- return HC_BREAK
- }
- if(count_t > count_ct)
- {
- rg_internal_cmd(id, "jointeam", "2")
- g_iTeam[id] = 2
- }
- else
- {
- rg_internal_cmd(id, "jointeam", "1")
- g_iTeam[id] = 1
- }
- SetHookChainReturn(ATYPE_INTEGER, 1)
- return HC_SUPERCEDE
- }
- if(slot == 6)
- {
- if(1 <= g_iTeam[id] <= 2)
- {
- client_print(id, print_chat, "No puedes Entrar a espectador mientras la partia esta en proceso")
- SetHookChainReturn(ATYPE_INTEGER, 0)
- return HC_BREAK
- }
- g_iTeam[id] = slot
- return HC_CONTINUE
- }
- if(1 <= slot <= 2)
- {
- if(count_player(slot) >= 5)
- {
- client_print(id, print_chat, "Equipo lleno")
- SetHookChainReturn(ATYPE_INTEGER, 0)
- return HC_BREAK
- }
- g_iTeam[id] = slot
- }
- return HC_CONTINUE
- }
- public client_putinserver(id)
- {
- g_iTeam[id] = 0
- }
- count_player(slot, &count_t=0, &count_ct=0)
- {
- new count
- for(new i = 1 ; i <= get_maxplayers() ; i++)
- {
- if(!is_user_connected(i))
- {
- continue
- }
- if(slot == 5)
- {
- if(g_iTeam[i] == 1)
- {
- count_t += 1
- }
- else if(g_iTeam[i] == 2)
- {
- count_ct += 1
- }
- }
- else
- {
- if(g_iTeam[i] == slot)
- {
- count += 1
- }
- }
- }
- return count
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement