#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <zombieplague>

#define PLUGIN "[zp]VipMenu"
#define VERSION "1.0"
#define AUTHOR "NextPawno"

new g_cvar[8], logfile[64], logdate[64]

new vipblock[33][5]
new vipsurv[33]
new vipnem[33]

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)

        register_event("HLTV", "Round_End", "a", "1=0", "2=0")

        g_cvar[1] = register_cvar( "zp_vipmenu_blockitem1", "3" )
        g_cvar[2] = register_cvar( "zp_vipmenu_blockitem2", "3" ) 
        g_cvar[3] = register_cvar( "zp_vipmenu_blockitem3", "3" )
        g_cvar[4] = register_cvar( "zp_vipmenu_blockitem4", "3" )
        g_cvar[5] = register_cvar( "zp_vipmenu_only_one_sh", "1" )
        g_cvar[6] = register_cvar( "zp_vipmenu_logfile", "1" )
        g_cvar[7] = register_cvar( "zp_vipmenu_logfile_format", "0" )

        register_clcmd("say /vipmenu", "show_menu_vip")
        register_clcmd("say_team /vipmenu", "show_menu_vip")
        register_clcmd("vipmenu", "show_menu_vip")

        register_dictionary( "zp_vipmenu.txt" )
}

public plugin_precache()
{
      new logdir[64]

      get_configsdir(logdir, 63)
      get_time("20%y.%m.%d", logdate, 63)
}

public Round_End()
{
      new iPlayer[32], iNum
      get_players(iPlayer, iNum)

      for(new i; i < iNum; i++) 
      {
         vipblock[iPlayer[i]][1] = 0
         vipblock[iPlayer[i]][2] = 0
         vipblock[iPlayer[i]][3] = 0
         vipblock[iPlayer[i]][4] = 0
         vipsurv[iPlayer[i]] = 0
         vipnem[iPlayer[i]] = 0
      }
}

public show_menu_vip(id)
{
      new szText[ 555 char ]

      formatex( szText, charsmax( szText ), "%L", id, "ZPVIPMENU_TITLE")
      new menu = menu_create( szText, "show_menu_vip_handler" )

      if(vipblock[id][1]<get_pcvar_num(g_cvar[1]))
      {
         formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_ITEM_1" )
         menu_additem( menu, szText, "1", 0 )
      }else{
         formatex( szText, charsmax( szText ), "%L - \r[%L]", id, "ZPVIP_ITEM_1", id, "ZPVIP_LIMIT" )
         menu_additem( menu, szText, "1", ADMIN_ADMIN )
      }

      if(vipblock[id][2]<get_pcvar_num(g_cvar[2]))
      {
         formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_ITEM_2" )
         menu_additem( menu, szText, "2", 0 )
      }else{
         formatex( szText, charsmax( szText ), "%L - \r[%L]", id, "ZPVIP_ITEM_2", id, "ZPVIP_LIMIT" )
         menu_additem( menu, szText, "2", ADMIN_ADMIN )
      }

      if(vipblock[id][3]<get_pcvar_num(g_cvar[3]))
      {
         formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_ITEM_3" )
         menu_additem( menu, szText, "3", 0 )
      }else{
         formatex( szText, charsmax( szText ), "%L - \r[%L]", id, "ZPVIP_ITEM_3", id, "ZPVIP_LIMIT" )
         menu_additem( menu, szText, "1", ADMIN_ADMIN )
      }
   
      if(vipblock[id][4]<get_pcvar_num(g_cvar[4]))
      {
         new players[32], num
         get_players(players, num, "bh")

         if(num>=1)
         {
            formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_ITEM_4" )
            menu_additem( menu, szText, "4", 0 )
         }else{
            formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_ITEM_4" )
            menu_additem( menu, szText, "4", ADMIN_ADMIN )
         }
      }else{
         formatex( szText, charsmax( szText ), "%L - \r[%L]", id, "ZPVIP_ITEM_4", id, "ZPVIP_LIMIT" )
         menu_additem( menu, szText, "4", ADMIN_ADMIN )
      }
   
      menu_setprop( menu, MPROP_EXIT, MEXIT_ALL )
      menu_setprop( menu, MPROP_EXITNAME, "Выход")
   	
      if(get_user_flags(id) & ADMIN_LEVEL_H)
      {
         menu_display( id, menu, 0 )
      }else{
         ChatColor(0, "!g[VIP]!y%L",0,"ZPVIP_NO_ACCESS") 
         return PLUGIN_HANDLED
      }
      return PLUGIN_HANDLED
}

public show_menu_vip_handler( id, menu, item )
{
      if( item == MENU_EXIT )
      {
           menu_destroy( menu )
           return PLUGIN_HANDLED
      }
 
      new data[ 6 ], iName[ 64 ], access, callback
      menu_item_getinfo( menu, item, access, data, charsmax( data ), iName, charsmax( iName ), callback )
 
      new key = str_to_num( data )
 	
      switch( key )
      {
           case 1:
           {
              vipmenu_playerhz(id)
           }
 
           case 2:
           {
              vipmenu_playernemesis(id)
           }
 
           case 3:
           {
              vipmenu_playersurvivor(id)
           }
 
           case 4:
           {
              vipmenu_playerrevive(id)
           }
      }
      return PLUGIN_HANDLED
}

public vipmenu_playerhz(id)
{
      new szText[ 555 char ];
  
      formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_HZMENU_TITLE")
      new i_Menu = menu_create( szText, "vipmenu_playerhz_handler" )
  
      new s_Players[32], i_Num, i_Player
      new s_Name[32], s_Player[10]
  
      get_players(s_Players, i_Num)

      new Zombie, Human
             
      Human = zp_get_human_count()
      Zombie = zp_get_zombie_count()
  
      for (new i; i < i_Num; i++)
      { 
          i_Player = s_Players[i]
  
          if(!is_user_alive(i_Player))
                continue
  
          get_user_name(i_Player, s_Name, charsmax(s_Name))
          num_to_str(i_Player, s_Player, charsmax(s_Player))
  
          if(zp_get_user_survivor(i_Player))
          {
             formatex( szText, charsmax( szText ), "%s - [%L]", s_Name, id, "ZPVIP_SURVIVOR" )
             menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
          }else
          if(zp_get_user_nemesis(i_Player))
          {
             formatex( szText, charsmax( szText ), "%s - [%L]", s_Name, id, "ZPVIP_BOSS" )
             menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
          }else
          if(zp_get_user_zombie(i_Player))
          {
             if(Zombie>=2)
             {
                formatex( szText, charsmax( szText ), "%s - \r[%L]", s_Name, id, "ZPVIP_ZOMBIE" )
                menu_additem(i_Menu, szText, s_Player, 0)
             }else{
                formatex( szText, charsmax( szText ), "%s - \r[%L]", s_Name, id, "ZPVIP_ZOMBIE" )
                menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
             }
          }else{
             if(Human>=2)
             {
                formatex( szText, charsmax( szText ), "%s - \y[%L]", s_Name, id, "ZPVIP_HUMAN" )
                menu_additem(i_Menu, szText, s_Player, 0)
             }else{
                formatex( szText, charsmax( szText ), "%s - \y[%L]", s_Name, id, "ZPVIP_HUMAN" )
                menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
             }
          }
      }
  
      menu_setprop( i_Menu, MPROP_EXIT, MEXIT_ALL );
      menu_setprop( i_Menu, MPROP_NEXTNAME, "Далее")
      menu_setprop( i_Menu, MPROP_BACKNAME, "Назад")
      menu_setprop( i_Menu, MPROP_EXITNAME, "Выход")

      menu_display(id, i_Menu, 0)
}

public vipmenu_playerhz_handler(id, menu, item)
{
     if (item == MENU_EXIT)
     {
         menu_destroy(menu)
         return PLUGIN_HANDLED
     }
 
     new s_Data[6], s_Name[64], i_Access, i_Callback
     menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)
 
     new i_Player = str_to_num(s_Data)
 
     if (is_user_alive(i_Player))
     {
         if(zp_get_user_zombie(i_Player))
         {
            zp_disinfect_user(i_Player)
            vipblock[id][1] = vipblock[id][1]+1
 
            if(!zp_get_user_zombie(i_Player) && !zp_get_user_survivor(i_Player) && !zp_get_user_nemesis(i_Player))
            {
               new name[33], name1[33]
               get_user_name(id, name, 32)
               get_user_name(i_Player, name1, 32) 
               ChatColor(0, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_HZ_H", name, name1)

               show_menu_vip(id)

               if(get_pcvar_num(g_cvar[6]) == 1)
               {
                  new szText[ 555 char ], szData[32]
                  get_time("[%H:%M]",szData,31)
 
                  if(get_pcvar_num(g_cvar[7]) == 0)
                  {
                     formatex(logfile, 63, "zpvip_%s.log", logdate)
                  }else{
                     formatex(logfile, 63, "zpvip_%s_%s.log", name, logdate)
                  }

                  formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_LOG_HUMAN", name, name1, szData);
                  log_to_file(logfile, szText )
               }
            }else{
               ChatColor(id, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_NO")
               show_menu_vip(id)
               return PLUGIN_HANDLED
            }
         }else{
            zp_infect_user(i_Player)
            vipblock[id][1] = vipblock[id][1]+1
 
            if(zp_get_user_zombie(i_Player) && !zp_get_user_survivor(i_Player) && !zp_get_user_nemesis(i_Player))
            {
               new name[32], name1[32]
               get_user_name(id, name, 31)
               get_user_name(i_Player, name1, 31)
               ChatColor(0, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_HZ_Z", name, name1)
 
               show_menu_vip(id)

               if(get_pcvar_num(g_cvar[6]) == 1)
               {
                  new szText[ 555 char ], szData[32]
                  get_time("[%H:%M]",szData,31)
 
                  if(get_pcvar_num(g_cvar[7]) == 0)
                  {
                     formatex(logfile, 63, "zpvip_%s.log", logdate)
                  }else{
                     formatex(logfile, 63, "zpvip_%s_%s.log", name, logdate)
                  }

                  formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_LOG_ZOMBIE", name, name1, szData);
                  log_to_file(logfile, szText )
               }
            }else{
                ChatColor(id, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_NO")
                show_menu_vip(id)
                return PLUGIN_HANDLED
            }
         }
     }else{
         new name2[32]
         get_user_name(i_Player, name2, 31)
         ChatColor(id, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_HZ_DEATH", name2)
         vipmenu_playerhz(id)
     }
 
     menu_destroy(menu)
     return PLUGIN_HANDLED
} 

public vipmenu_playersurvivor(id)
{
      new szText[ 555 char ]
  
      formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_SURVIVORMENU_TITLE")
      new i_Menu = menu_create( szText, "vipmenu_playersurvivor_handler" )
  
      new s_Players[32], i_Num, i_Player
      new s_Name[32], s_Player[10]
  
      get_players(s_Players, i_Num)

      new Zombie, Human
             
      Human = zp_get_human_count()
      Zombie = zp_get_zombie_count()
  
      for (new i; i < i_Num; i++)
      { 
          i_Player = s_Players[i]
  
          if(!is_user_alive(i_Player))
                continue
  
          get_user_name(i_Player, s_Name, charsmax(s_Name))
          num_to_str(i_Player, s_Player, charsmax(s_Player))
  
          if(vipsurv[i_Player] && !zp_get_user_survivor(i_Player))
          {
             if(get_pcvar_num(g_cvar[5])==1)
             {
                formatex( szText, charsmax( szText ), "%s - [%L]", s_Name, id, "ZPVIP_USE" )
                menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
             }
          }else
          if(zp_get_user_survivor(i_Player))
          {
             formatex( szText, charsmax( szText ), "%s - [%L]", s_Name, id, "ZPVIP_SURVIVOR" )
             menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
          }else
          if(zp_get_user_nemesis(i_Player))
          {
             formatex( szText, charsmax( szText ), "%s - [%L]", s_Name, id, "ZPVIP_BOSS" )
             menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
          }else
          if(zp_get_user_zombie(i_Player))
          {
             if(Zombie>=2)
             {
                formatex( szText, charsmax( szText ), "%s - \r[%L]", s_Name, id, "ZPVIP_ZOMBIE" )
                menu_additem(i_Menu, szText, s_Player, 0)
             }else{
                formatex( szText, charsmax( szText ), "%s - \r[%L]", s_Name, id, "ZPVIP_ZOMBIE" )
                menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
             }
          }else{
             if(Human>=2)
             {
                formatex( szText, charsmax( szText ), "%s - \y[%L]", s_Name, id, "ZPVIP_HUMAN" )
                menu_additem(i_Menu, szText, s_Player, 0)
             }else{
                formatex( szText, charsmax( szText ), "%s - \y[%L]", s_Name, id, "ZPVIP_HUMAN" )
                menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
             }
          }
      }
  
      menu_setprop( i_Menu, MPROP_EXIT, MEXIT_ALL );
      menu_setprop( i_Menu, MPROP_NEXTNAME, "Далее")
      menu_setprop( i_Menu, MPROP_BACKNAME, "Назад")
      menu_setprop( i_Menu, MPROP_EXITNAME, "Выход")

      menu_display(id, i_Menu, 0)
}

public vipmenu_playersurvivor_handler(id, menu, item) 
{
     if (item == MENU_EXIT)
     {
         menu_destroy(menu)
         return PLUGIN_HANDLED
     }
 
     new s_Data[6], s_Name[64], i_Access, i_Callback
     menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)
 
     new i_Player = str_to_num(s_Data)
 
     if (is_user_alive(i_Player))
     {
         if(!zp_get_user_survivor(i_Player) && !zp_get_user_nemesis(i_Player))
         {
            zp_make_user_survivor(i_Player)
            vipblock[id][3] = vipblock[id][3]+1
            vipsurv[i_Player] = true
         }else{
            ChatColor(id, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_NO")
            show_menu_vip(id)
            return PLUGIN_HANDLED
         }
 
         if(!zp_get_user_zombie(i_Player) && zp_get_user_survivor(i_Player) && !zp_get_user_nemesis(i_Player))
         {
            new name[32], name1[32]
            get_user_name(id, name, 31)
            get_user_name(i_Player, name1, 31)
            ChatColor(0, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_SURVIVOR", name, name1)
 
            show_menu_vip(id)

            if(get_pcvar_num(g_cvar[7]) == 1)
            {
               new szText[ 555 char ], szData[32]
               get_time("[%H:%M]",szData,31)
 
               if(get_pcvar_num(g_cvar[6]) == 0)
               {
                  formatex(logfile, 63, "zpvip_%s.log", logdate)
               }else{
                  formatex(logfile, 63, "zpvip_%s_%s.log", name, logdate)
               }

               formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_LOG_SURVIVOR", name, name1, szData);
               log_to_file(logfile, szText )
            }
         }else{
            ChatColor(id, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_NO")
            show_menu_vip(id)
            return PLUGIN_HANDLED
         }
     }else{
         new name2[32]
         get_user_name(i_Player, name2, 31)
         ChatColor(id, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_SURVIVOR_DEATH", name2)
 
         show_menu_vip(id)
     }
 
     menu_destroy(menu)
     return PLUGIN_HANDLED
} 

public vipmenu_playernemesis(id)
{
      new szText[ 555 char ]
  
      formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_NEMESISMENU_TITLE")
      new i_Menu = menu_create( szText, "vipmenu_playernemesis_handler" )
  
      new s_Players[32], i_Num, i_Player
      new s_Name[32], s_Player[10]

      new Zombie, Human
             
      Human = zp_get_human_count()
      Zombie = zp_get_zombie_count()
  
      get_players(s_Players, i_Num)
  
      for (new i; i < i_Num; i++)
      { 
          i_Player = s_Players[i]
  
          if(!is_user_alive(i_Player))
                continue
  
          get_user_name(i_Player, s_Name, charsmax(s_Name))
          num_to_str(i_Player, s_Player, charsmax(s_Player))

          if(vipnem[i_Player] && !zp_get_user_nemesis(i_Player))
          {
             if(get_pcvar_num(g_cvar[5])==1)
             {
                formatex( szText, charsmax( szText ), "%s - [%L]", s_Name, id, "ZPVIP_USE" )
                menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
             }
          }else
          if(zp_get_user_survivor(i_Player))
          {
             formatex( szText, charsmax( szText ), "%s - [%L]", s_Name, id, "ZPVIP_SURVIVOR" )
             menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
          }else
          if(zp_get_user_nemesis(i_Player))
          {
             formatex( szText, charsmax( szText ), "%s - [%L]", s_Name, id, "ZPVIP_BOSS" )
             menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
          }else
          if(zp_get_user_zombie(i_Player))
          {
             if(Zombie>=2)
             {
                formatex( szText, charsmax( szText ), "%s - \r[%L]", s_Name, id, "ZPVIP_ZOMBIE" )
                menu_additem(i_Menu, szText, s_Player, 0)
             }else{
                formatex( szText, charsmax( szText ), "%s - \r[%L]", s_Name, id, "ZPVIP_ZOMBIE" )
                menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
             }
          }else{
             if(Human>=2)
             {
                formatex( szText, charsmax( szText ), "%s - \y[%L]", s_Name, id, "ZPVIP_HUMAN" )
                menu_additem(i_Menu, szText, s_Player, 0)
             }else{
                formatex( szText, charsmax( szText ), "%s - \y[%L]", s_Name, id, "ZPVIP_HUMAN" )
                menu_additem(i_Menu, szText, s_Player, ADMIN_ADMIN)
             }
          }
      }
  
      menu_setprop( i_Menu, MPROP_EXIT, MEXIT_ALL );
      menu_setprop( i_Menu, MPROP_NEXTNAME, "Далее")
      menu_setprop( i_Menu, MPROP_BACKNAME, "Назад")
      menu_setprop( i_Menu, MPROP_EXITNAME, "Выход")
  
      menu_display(id, i_Menu, 0)
}

public vipmenu_playernemesis_handler(id, menu, item)
{
    if (item == MENU_EXIT)
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }

    new s_Data[6], s_Name[64], i_Access, i_Callback
    menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

    new i_Player = str_to_num(s_Data)

    if (is_user_alive(i_Player))
    {
        if(!zp_get_user_survivor(i_Player) && !zp_get_user_nemesis(i_Player))
        {
           zp_make_user_nemesis(i_Player)
           vipblock[id][2] = vipblock[id][2]+1
           vipnem[i_Player] = true
        }else{
           ChatColor(id, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_NO")
           show_menu_vip(id)
           return PLUGIN_HANDLED
        }

        if(zp_get_user_zombie(i_Player) && !zp_get_user_survivor(i_Player) && zp_get_user_nemesis(i_Player))
        {
           new name[32], name1[32]
           get_user_name(id, name, 31)
           get_user_name(i_Player, name1, 31)
           ChatColor(0, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_NEMESIS", name, name1)

           show_menu_vip(id)

           if(get_pcvar_num(g_cvar[6]) == 1)
           {
              new szText[ 555 char ], szData[32]
              get_time("[%H:%M]",szData,31)
 
              if(get_pcvar_num(g_cvar[7]) == 0)
              {
                 formatex(logfile, 63, "zpvip_%s.log", logdate)
              }else{
                 formatex(logfile, 63, "zpvip_%s_%s.log", name, logdate)
              }

              formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_LOG_NEMESIS", name, name1, szData);
              log_to_file(logfile, szText )
           }
        }else{
           ChatColor(id, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_NO")
           show_menu_vip(id)
           return PLUGIN_HANDLED
        }
    }else{
        new name2[32]
        get_user_name(i_Player, name2, 31)
        ChatColor(id, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_NEMESIS_DEATH", name2)

        show_menu_vip(id)
    }

    menu_destroy(menu)
    return PLUGIN_HANDLED
} 

public vipmenu_playerrevive(id)
{
      new szText[ 555 char ]
  
      formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_REVIVEMENU_TITLE")
      new i_Menu = menu_create( szText, "vipmenu_playerrevive_handler" )
  
      new s_Players[32], i_Num, i_Player
      new s_Name[32], s_Player[10]
  
      get_players(s_Players, i_Num)
  
      for (new i; i < i_Num; i++)
      { 
          i_Player = s_Players[i]
  
          if(is_user_alive(i_Player))
                continue
  
          get_user_name(i_Player, s_Name, charsmax(s_Name))
          num_to_str(i_Player, s_Player, charsmax(s_Player)) 
             
          formatex( szText, charsmax( szText ), "%s", s_Name)
          menu_additem(i_Menu, szText, s_Player, 0)
      }
  
      menu_setprop( i_Menu, MPROP_EXIT, MEXIT_ALL )
      menu_setprop( i_Menu, MPROP_NEXTNAME, "Далее")
      menu_setprop( i_Menu, MPROP_BACKNAME, "Назад")
      menu_setprop( i_Menu, MPROP_EXITNAME, "Выход")

      menu_display(id, i_Menu, 0)
}

public vipmenu_playerrevive_handler(id, menu, item)
{
      if (item == MENU_EXIT)
      {
          menu_destroy(menu)
          return PLUGIN_HANDLED
      }
  
      new s_Data[6], s_Name[64], i_Access, i_Callback
      menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)
  
      new i_Player = str_to_num(s_Data)
  
      if (!is_user_alive(i_Player))
      {
          ExecuteHamB(Ham_CS_RoundRespawn, i_Player)
          vipblock[id][4] = vipblock[id][4]+1 

          if(is_user_alive(i_Player))
          {
             new name[32], name1[32]
             get_user_name(id, name, 31)
             get_user_name(i_Player, name1, 31)
             ChatColor(0, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_REVIVE", name, name1) 

             show_menu_vip(id)

             if(get_pcvar_num(g_cvar[6]) == 1)
             {
                new szText[ 555 char ], szData[32]
                get_time("[%H:%M]",szData,31)
 
                if(get_pcvar_num(g_cvar[7]) == 0)
                {
                   formatex(logfile, 63, "zpvip_%s.log", logdate)
                }else{
                   formatex(logfile, 63, "zpvip_%s_%s.log", name, logdate)
                }

                formatex( szText, charsmax( szText ), "%L", id, "ZPVIP_LOG_REVIVE", name, name1, szData);
                log_to_file(logfile, szText )
             }
          }else{
             ChatColor(id, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_NO")
             show_menu_vip(id)
             return PLUGIN_HANDLED
          }
      }else{
          new name2[32]
          get_user_name(i_Player, name2, 31)
          ChatColor(id, "!g[VIP]!y%L",0,"ZPVIP_PLAYER_REVIVE_ALIVE", name2)
  
          show_menu_vip(id)
      }
  
      menu_destroy(menu)
      return PLUGIN_HANDLED
} 

stock ChatColor(const id, const input[], any:...)
{
      new count = 1, players[32]
      static msg[191]
      vformat(msg, 190, input, 3)
      
      replace_all(msg, 190, "!g", "^4")
      replace_all(msg, 190, "!y", "^1")
      replace_all(msg, 190, "!team", "^3")
      
      if (id) players[0] = id; else get_players(players, count, "ch")
      {
          for (new i = 0; i < count; i++)
          {
              if (is_user_connected(players[i]))
              {
                  message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
                  write_byte(players[i]);
                  write_string(msg);
                  message_end();
              }
          }
      }
} 