SHARE
TWEET

vip

a guest Sep 11th, 2017 356 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * AMX Mod X
  3.  * V.I.P. Plugin
  4.  *
  5.  * Originally developed by wasntme/Caldeum
  6.  *
  7.  *
  8.  * This program is free software; you can redistribute it and/or modify it
  9.  * under the terms of the GNU General Public License as published by the
  10.  * Free Software Foundation; either version 2 of the License, or (at
  11.  * your option) any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful, but
  14.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16.  * General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to the Free Software Foundation,
  20.  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21.  *
  22.  * In addition, as a special exception, the author gives permission to
  23.  * link the code of this program with the Half-Life Game Engine ("HL
  24.  * Engine") and Modified Game Libraries ("MODs") developed by Valve,
  25.  * L.L.C ("Valve"). You must obey the GNU General Public License in all
  26.  * respects for all of the code used other than the HL Engine and MODs
  27.  * from Valve. If you modify this file, you may extend this exception
  28.  * to your version of the file, but you are not obligated to do so. If
  29.  * you do not wish to do so, delete this exception statement from your
  30.  * version.
  31.  *
  32.  *
  33.  * Link to the plugin
  34.  *
  35.  *  http://forums.alliedmods.net/showthread.php?t=131494
  36.  *
  37.  **/
  38.  
  39. #include < amxmodx >
  40. #include < amxmisc >
  41. #include < cstrike >
  42. #include < fun >
  43. #include < fakemeta >
  44. #include < fakemeta_util >
  45. #include < hamsandwich >
  46.  
  47. #define PLUGIN "VIP"
  48. #define VERSION "0.3"
  49. #define AUTHOR "wasntme/Caldeum"
  50.  
  51. #define VIP_ACCESS ADMIN_LEVEL_H
  52.  
  53. #define FFADE_IN 0x0000
  54.  
  55. #define CharsMax(%1) sizeof %1 - 1
  56. #define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
  57.  
  58. const m_LastHitGroup = 75;
  59.  
  60. new equipment_mode[ 33 ], money_mode[ 33 ], critical_mode[ 33 ], soldier_mode[ 33 ], heavy_mode[ 33 ], medic_mode[ 33 ];
  61. new equipment_active[ 33 ], money_active[ 33 ], critical_active[ 33 ], soldier_active[ 33 ], heavy_active[ 33 ], medic_active[ 33 ];
  62.  
  63. new bool:g_showrecieved;
  64. new bool:canHeal = true;
  65.  
  66. new g_iMaxPlayers;
  67. new g_iRoundCount = 0, g_roundendfix;
  68. new g_hudmsg1, g_hudmsg2;
  69. new g_msgFade, g_msgShake;
  70. new g_msgSayText, g_msgTeamInfo;
  71.  
  72. new p_Enabled, p_Join, p_Damage, p_Type, p_Recieved, p_Defuser, p_Equipment, p_Money, p_Critical, p_Soldier, p_Heavy, p_Medic, p_MoneyGive, p_CriticalChance, p_CriticalDamage, p_SoldierMaxHp, p_SoldierKillHp, p_SoldierArmor, p_HeavyArmor, p_MedicHpRegen, p_MedicHpRegenSpeed, p_MedicMaxHp;
  73.  
  74. public plugin_init ( )
  75. {
  76.  register_plugin( PLUGIN, VERSION, AUTHOR );
  77.  
  78.  register_event( "HLTV", "event_NewRound", "a", "1=0", "2=0" );
  79.  register_logevent( "event_RoundEnd", 2, "0=World triggered", "1=Round_End" );
  80.  
  81.  RegisterHam( Ham_Spawn, "player", "player_Spawn", 1 );
  82.  RegisterHam( Ham_TraceAttack, "player", "player_Attack" );
  83.  RegisterHam( Ham_TakeDamage, "player", "player_TakeDamage" );
  84.  
  85.  register_event( "DeathMsg", "event_PlayerHeal", "a" );
  86.  register_event( "Damage", "event_ShowDamage", "b", "2!0", "3=0", "4!0" );
  87.  
  88.  register_forward( FM_PlayerPreThink, "pthink" );
  89.  
  90.  p_Enabled = register_cvar( "amx_vip_script", "1" );
  91.  p_Join = register_cvar( "amx_vip_join", "1" );
  92.  p_Type = register_cvar( "amx_vip_damage", "2" );
  93.  p_Recieved = register_cvar( "amx_vip_damage_recieved", "1" );
  94.  p_Defuser = register_cvar( "amx_vip_defuser", "1" );
  95.  p_Equipment = register_cvar( "amx_vip_equipment", "1" );
  96.  p_Money = register_cvar( "amx_vip_money", "1" );
  97.  p_MoneyGive = register_cvar( "amx_vip_money_give", "2500" );
  98.  p_Critical = register_cvar( "amx_vip_critical", "1" );
  99.  p_CriticalChance = register_cvar( "amx_vip_critical_chance", "15" );
  100.  p_CriticalDamage = register_cvar( "amx_vip_critical_damage", "2.0" );
  101.  p_Soldier = register_cvar( "amx_vip_soldier", "1" );
  102.  p_SoldierKillHp = register_cvar( "amx_vip_soldier_kill_hp", "5" );
  103.  p_SoldierMaxHp = register_cvar( "amx_vip_soldier_max_hp", "120" );
  104.  p_SoldierArmor = register_cvar( "amx_vip_soldier_armor", "120" );
  105.  p_Heavy = register_cvar( "amx_vip_heavy", "1" );
  106.  p_HeavyArmor = register_cvar( "amx_vip_heavy_armor", "250" );
  107.  p_Medic = register_cvar( "amx_vip_medic", "1" );
  108.  p_MedicHpRegen = register_cvar( "amx_vip_medic_hp_regen", "2" );
  109.  p_MedicHpRegenSpeed = register_cvar( "amx_vip_medic_hp_regen_speed", "2.0" );
  110.  p_MedicMaxHp = register_cvar( "amx_vip_medic_max_hp", "100" );
  111.  
  112.  register_concmd( "vipmenu", "show_vip_menu" );
  113.  
  114.  register_clcmd( "say /vipmenu", "show_vip_menu" );
  115.  register_clcmd( "say vipmenu", "show_vip_menu" );
  116.  register_clcmd( "say_team /vipmenu", "show_vip_menu" );
  117.  register_clcmd( "say_team vipmenu", "show_vip_menu" );
  118.  register_clcmd( "say /vips", "viplist" );
  119.  register_clcmd( "say vips", "viplist" );
  120.  register_clcmd( "say_team /vips", "viplist" );
  121.  register_clcmd( "say_team vips", "viplist" );
  122.  
  123.  g_hudmsg1 = CreateHudSyncObj( );
  124.  g_hudmsg2 = CreateHudSyncObj( );
  125.  g_msgFade = get_user_msgid( "ScreenFade" );
  126.  g_msgShake = get_user_msgid( "ScreenShake" );
  127.  g_msgSayText = get_user_msgid( "SayText" );
  128.  g_msgTeamInfo = get_user_msgid( "TeamInfo" );
  129.  g_iMaxPlayers = get_maxplayers( );
  130.  
  131.  register_dictionary( "vip.txt" );
  132. }
  133.  
  134. public client_connect ( id )
  135. {
  136.  if ( get_user_flags( id ) & VIP_ACCESS )
  137.  {
  138.  equipment_mode[ id ] = 0;
  139.  money_mode[ id ] = 0;
  140.  critical_mode[ id ] = 0;
  141.  soldier_mode[ id ] = 0;
  142.  heavy_mode[ id ] = 0;
  143.  medic_mode[ id ] = 0;
  144.  }
  145. }
  146.  
  147. public client_disconnect ( id )
  148. {
  149.  remove_task( id );
  150.  
  151.  if ( get_user_flags( id ) & VIP_ACCESS )
  152.  {
  153.  equipment_mode[ id ] = 0;
  154.  money_mode[ id ] = 0;
  155.  critical_mode[ id ] = 0;
  156.  soldier_mode[ id ] = 0;
  157.  heavy_mode[ id ] = 0;
  158.  medic_mode[ id ] = 0;
  159.  }
  160. }
  161.  
  162. public client_putinserver ( id )
  163. {
  164.  if ( get_user_flags( id ) & VIP_ACCESS )
  165.  {
  166.  if ( get_pcvar_num( p_Join ) && g_iRoundCount > 1 )
  167.  {
  168.  new name[ 32 ];
  169.  get_user_name( id, name, 31 );
  170.  
  171.  print_color( 0, id, 0, "%L", LANG_SERVER, "VIP_JOIN", name );
  172.  }
  173.  }
  174. }
  175.  
  176. public event_ShowDamage ( id )
  177. {
  178.  if ( p_Damage )
  179.  {
  180.  static attacker, damage;
  181.  attacker = get_user_attacker( id );
  182.  damage = read_data( 2 );
  183.  
  184.  if ( g_showrecieved && ( get_user_flags( id ) & VIP_ACCESS ) )
  185.  {
  186.  set_hudmessage( 200, 20, 20, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1 );
  187.  ShowSyncHudMsg( id, g_hudmsg2, "%i^n", damage );
  188.  }
  189.  
  190.  if ( is_user_connected( attacker ) )
  191.  {
  192.  switch( p_Damage )
  193.  {
  194.  case 1:
  195.  {
  196.  if ( is_user_alive( attacker ) && ( get_user_flags( attacker ) & VIP_ACCESS ) )
  197.  {
  198.  set_hudmessage( 34, 139, 34, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1 );
  199.  ShowSyncHudMsg( attacker, g_hudmsg1, "%i^n", damage );
  200.  }
  201.  }
  202.  case 2:
  203.  {
  204.  if ( is_user_alive( attacker ) && ( get_user_flags( attacker ) & VIP_ACCESS ) && fm_is_ent_visible( attacker, id ) )
  205.  {
  206.  set_hudmessage( 34, 139, 34, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1 );
  207.  ShowSyncHudMsg( attacker, g_hudmsg1, "%i^n", damage );
  208.  }
  209.  }
  210.  }
  211.  }
  212.  }
  213. }
  214.  
  215. public player_TakeDamage ( VictimId, InflictorId, AttackerId, Float:damage, dmgbits )
  216. {
  217.  if ( IsPlayer( AttackerId ) && critical_active[ AttackerId ] && cs_get_user_team( VictimId ) != cs_get_user_team( AttackerId ) && get_pcvar_num( p_CriticalChance ) > random( 100 ) )
  218.  {
  219.  if ( get_user_flags( AttackerId ) & VIP_ACCESS )
  220.  {
  221.  new Float:crit_damage = damage * get_pcvar_float( p_CriticalDamage );
  222.  
  223.  SetHamParamFloat( 4, crit_damage );
  224.  
  225.  new szVictim[ 32 ];
  226.  get_user_name( VictimId, szVictim, 31 );
  227.  
  228.  print_color( AttackerId, AttackerId, 0, "%L", LANG_PLAYER, "VIP_CRITICAL_HIT", szVictim );
  229.  
  230.  client_cmd( AttackerId, "spk silent/vip/player/critical" );
  231.  }
  232.  }
  233.  return HAM_IGNORED;
  234. }
  235.  
  236. public event_PlayerHeal ( )
  237. {
  238.  new iKiller = read_data( 1 );
  239.  new iVictim = read_data( 2 );
  240.  
  241.  if ( get_user_flags( iKiller ) & VIP_ACCESS )
  242.  {
  243.  if ( soldier_active[ iKiller ] && cs_get_user_team( iVictim ) != cs_get_user_team( iKiller ) )
  244.  {
  245.  new MaxHp = get_pcvar_num( p_SoldierMaxHp );
  246.  new BonusHp = get_pcvar_num( p_SoldierKillHp );
  247.  new TotalHp = get_user_health( iKiller ) + BonusHp;
  248.  
  249.  if ( TotalHp >= MaxHp )
  250.  {
  251.  set_user_health( iKiller, MaxHp );
  252.  
  253.  print_color( iKiller, iKiller, 0, "%L", LANG_SERVER, "VIP_SOLDIER_MAX_HP", get_pcvar_num( p_SoldierMaxHp ) );
  254.  
  255.  client_cmd( iKiller, "spk silent/vip/player/maximum" );
  256.  
  257.  message_begin( MSG_ONE_UNRELIABLE, g_msgFade, .player=iKiller );
  258.  {
  259.  write_short( 1<<13 );
  260.  write_short( 1<<5 );
  261.  write_short( FFADE_IN );
  262.  write_byte( 139 );
  263.  write_byte( 34 );
  264.  write_byte( 34 );
  265.  write_byte( 75 );
  266.  }
  267.  message_end( );
  268.  
  269.  message_begin( MSG_ONE_UNRELIABLE, g_msgShake, .player=iKiller );
  270.  {
  271.  write_short( 255<<7 );
  272.  write_short( 50<<7 );
  273.  write_short( 255<<7 );
  274.  }
  275.  message_end( );
  276.  } else {
  277.  set_user_health( iKiller, TotalHp );
  278.  
  279.  print_color( iKiller, iKiller, 0, "%L", LANG_SERVER, "VIP_SOLDIER_HEAL", get_pcvar_num( p_SoldierKillHp ) );
  280.  
  281.  client_cmd( iKiller, "spk silent/vip/items/health" );
  282.  
  283.  message_begin( MSG_ONE_UNRELIABLE, g_msgFade, .player=iKiller );
  284.  {
  285.  write_short( 1<<12 );
  286.  write_short( 1<<5 );
  287.  write_short( FFADE_IN );
  288.  write_byte( 139 );
  289.  write_byte( 34 );
  290.  write_byte( 34 );
  291.  write_byte( 75 );
  292.  }
  293.  message_end( );
  294.  
  295.  message_begin( MSG_ONE_UNRELIABLE, g_msgShake, .player=iKiller );
  296.  {
  297.  write_short( 255<<5 );
  298.  write_short( 50<<5 );
  299.  write_short( 255<<5 );
  300.  }
  301.  message_end( );
  302.  }
  303.  }
  304.  }
  305. }
  306.  
  307. public player_Attack ( id, iAttacker, Float:flDamage, Float:fVecDir[3], tr )
  308. {
  309.  if ( get_user_flags( id ) & VIP_ACCESS )
  310.  {
  311.  if ( IsPlayer( iAttacker ) && heavy_active[ id ] && cs_get_user_team( id ) != cs_get_user_team( iAttacker ) && get_tr2( tr, TR_iHitgroup ) == HIT_HEAD && get_tr2( tr, TR_iHitgroup ) == HIT_HEAD )
  312.  {
  313.  set_tr2( tr, TR_iHitgroup, HIT_CHEST );
  314.  set_tr2( tr, TR_iHitgroup, HIT_STOMACH );
  315.  
  316.  client_cmd( id, "spk silent/vip/player/headshot" );
  317.  
  318.  message_begin( MSG_ONE_UNRELIABLE, g_msgFade, .player=id );
  319.  {
  320.  write_short( 1<<12 );
  321.  write_short( 1<<5 );
  322.  write_short( FFADE_IN );
  323.  write_byte( 139 );
  324.  write_byte( 34 );
  325.  write_byte( 34 );
  326.  write_byte( 75 );
  327.  }
  328.  message_end( );
  329.  
  330.  message_begin( MSG_ONE_UNRELIABLE, g_msgShake, .player=id );
  331.  {
  332.  write_short( 255<<5 );
  333.  write_short( 50<<5 );
  334.  write_short( 255<<5 );
  335.  }
  336.  message_end( );
  337.  }
  338.  }
  339. }
  340.  
  341. public waiter ( id )
  342. {
  343.  canHeal = false;
  344.  
  345.  set_task( get_pcvar_float( p_MedicHpRegenSpeed ), "givehp", id );
  346. }
  347.  
  348. public givehp ( id )
  349. {
  350.  canHeal = true;
  351.  
  352.  new MaxHp = get_pcvar_num( p_MedicMaxHp );
  353.  new BonusHp = get_pcvar_num( p_MedicHpRegen );
  354.  new TotalHp = get_user_health( id ) + BonusHp;
  355.  new hp = pev( id, pev_health );
  356.  
  357.  if ( get_user_flags( id ) & VIP_ACCESS )
  358.  {
  359.  if ( medic_active[ id ] && is_user_alive( id ) && get_user_weapon( id ) == CSW_KNIFE )
  360.  {
  361.  if ( TotalHp >= MaxHp )
  362.  {
  363.  set_user_health( id, MaxHp );
  364.  
  365.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_MEDIC_MAX_HP", get_pcvar_num( p_MedicMaxHp ) );
  366.  
  367.  client_cmd( id, "spk silent/vip/player/maximum" );
  368.  
  369.  message_begin( MSG_ONE_UNRELIABLE, g_msgFade, .player=id );
  370.  {
  371.  write_short( 1<<13 );
  372.  write_short( 1<<5 );
  373.  write_short( FFADE_IN );
  374.  write_byte( 134 );
  375.  write_byte( 34 );
  376.  write_byte( 34 );
  377.  write_byte( 75 );
  378.  }
  379.  message_end( );
  380.  
  381.  message_begin( MSG_ONE_UNRELIABLE, g_msgShake, .player=id );
  382.  {
  383.  write_short( 255<<7 );
  384.  write_short( 50<<7 );
  385.  write_short( 255<<7 );
  386.  }
  387.  message_end( );
  388.  } else {
  389.  set_user_health( id, hp + BonusHp );
  390.  
  391.  client_cmd( id, "spk silent/vip/items/health" );
  392.  
  393.  message_begin( MSG_ONE_UNRELIABLE, g_msgFade, .player=id );
  394.  {
  395.  write_short( 1<<12 );
  396.  write_short( 1<<5 );
  397.  write_short( FFADE_IN );
  398.  write_byte( 134 );
  399.  write_byte( 34 );
  400.  write_byte( 34 );
  401.  write_byte( 75 );
  402.  }
  403.  message_end( );
  404.  
  405.  message_begin( MSG_ONE_UNRELIABLE, g_msgShake, .player=id );
  406.  {
  407.  write_short( 255<<5 );
  408.  write_short( 50<<5 );
  409.  write_short( 255<<5 );
  410.  }
  411.  message_end( );
  412.  }
  413.  }
  414.  }
  415. }
  416.  
  417. public pthink ( id )
  418. {
  419.  if ( medic_active[ id ] )
  420.  {
  421.  if ( canHeal && ( pev( id, pev_health ) < 100) )
  422.  {
  423.  waiter( id );
  424.  }
  425.  }
  426.  return FMRES_HANDLED;
  427. }
  428.  
  429. public show_vip_menu ( id )
  430. {
  431.  if ( get_user_flags( id ) & VIP_ACCESS )
  432.  {
  433.  if ( !get_pcvar_num( p_Enabled ) )
  434.  {
  435.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_MENU_DISSABLE" );
  436.  client_cmd( id, "spk silent/vip/noaccess" );
  437.  }
  438.  
  439.  if ( get_pcvar_num( p_Enabled ) )
  440.  {
  441.  if ( g_iRoundCount < 1 )
  442.  {
  443.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_WAIT" );
  444.  client_cmd( id, "spk silent/vip/attention" );
  445.  return PLUGIN_HANDLED;
  446.  }
  447.  
  448.  client_cmd( id, "spk silent/vip/menu/open" );
  449.  new menu = menu_create( "\rV.I.P. Меню \wv \r0\w.\r3 \wstable", "menu" );
  450.  
  451.  if ( !equipment_mode[ id ] && get_pcvar_num( p_Equipment ) )
  452.  {
  453.  menu_additem( menu, "Ammo \y(HE,FB,SG,патроны)", "1", 0 );
  454.  }
  455.  else if ( equipment_mode[ id ] )
  456.  {
  457.  menu_additem( menu, "\dAmmo \r* \y(HE,FB,SG,патроны)", "1", 0 );
  458.  }
  459.  else if ( !get_pcvar_num( p_Equipment ) )
  460.  {
  461.  menu_additem( menu, "\dAmmo (\rВЫКЛ\d)", "1", 0 );
  462.  }
  463.  
  464.  if ( !money_mode[ id ] && get_pcvar_num( p_Money ) )
  465.  {
  466.  menu_additem( menu, "Деньги \y(+2.500$)", "2", 0 );
  467.  }
  468.  else if ( money_mode[ id ] )
  469.  {
  470.  menu_additem( menu, "\dДеньги \r* \y(+2.500$)", "2", 0 );
  471.  }
  472.  else if ( !get_pcvar_num( p_Money ) )
  473.  {
  474.  menu_additem( menu, "\dДеньги (\rВЫКЛ\d)", "2", 0 );
  475.  }
  476.  
  477.  if ( !critical_mode[ id ] && get_pcvar_num( p_Critical ) )
  478.  {
  479.  menu_additem( menu, "Вампир\y(+15%HP-убийство)", "3", 0 );
  480.  }
  481.  else if ( critical_mode[ id ] )
  482.  {
  483.  menu_additem( menu, "\dВампир \r* \y(+15%HP-убийство)", "3", 0 );
  484.  }
  485.  else if ( !get_pcvar_num( p_Critical ) )
  486.  {
  487.  menu_additem( menu, "\dВампир (\rВЫКЛ\d)", "3", 0 );
  488.  }
  489.  
  490.  if ( !soldier_mode[ id ] && get_pcvar_num( p_Soldier ) )
  491.  {
  492.  menu_additem( menu, "Солдат \y(150AP и +5HP убей всех)", "4", 0 );
  493.  }
  494.  else if ( soldier_mode[ id ] )
  495.  {
  496.  menu_additem( menu, "\dСолдат \r* \y(150AP и +5HP убей всех)", "4", 0 );
  497.  }
  498.  else if ( !get_pcvar_num( p_Soldier ) )
  499.  {
  500.  menu_additem( menu, "\dСолдат (\rВЫКЛ\d)", "4", 0 );
  501.  }
  502.  
  503.  if ( !heavy_mode[ id ] && get_pcvar_num( p_Heavy ) )
  504.  {
  505.  menu_additem( menu, "Шлем \y(+250AP)", "5", 0 );
  506.  }
  507.  else if ( heavy_mode[ id ] )
  508.  {
  509.  menu_additem( menu, "\dШлем \r* \y(+250AP)", "5", 0 );
  510.  }
  511.  else if ( !get_pcvar_num( p_Heavy ) )
  512.  {
  513.  menu_additem( menu, "\dШлем (\rВЫКЛ\d)", "5", 0 );
  514.  }
  515.  
  516.  if ( !medic_mode[ id ] && get_pcvar_num( p_Medic ) )
  517.  {
  518.  menu_additem( menu, "Медик \y(Регенерация H-P, держа Нож)", "6", 0 );
  519.  }
  520.  else if ( medic_mode[ id ] )
  521.  {
  522.  menu_additem( menu, "\dМедик \r* \y(Регенерация H-P, держа Нож)", "6", 0 );
  523.  }
  524.  else if ( !get_pcvar_num( p_Medic ) )
  525.  {
  526.  menu_additem( menu, "\dМедик (\rВЫКЛ\d)", "6", 0 );
  527.  }
  528.  
  529.  menu_additem( menu, "\rВыключить все функции", "7", 0 );
  530.  
  531.  menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
  532.  menu_setprop( menu, MPROP_NUMBER_COLOR, "\r" );
  533.  menu_setprop( menu, MPROP_BACKNAME, "Назад" );
  534.  menu_setprop( menu, MPROP_NEXTNAME, "Вперед" );
  535.  menu_setprop( menu, MPROP_EXITNAME, "Выход" );
  536.  menu_setprop( menu, MPROP_PERPAGE, 7 );
  537.  menu_display( id, menu, 0 );
  538.  }
  539.  }
  540.  
  541.  else if ( get_user_flags( id ) != VIP_ACCESS )
  542.  {
  543.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_NO_ACCESS" );
  544.  client_cmd( id, "spk silent/vip/noaccess" );
  545.  }
  546.  return PLUGIN_HANDLED;
  547. }
  548.  
  549. public menu ( id, menu, item )
  550. {
  551.  if ( item == MENU_EXIT )
  552.  {
  553.  client_cmd( id, "spk silent/vip/menu/button" );
  554.  client_cmd( id, "spk silent/vip/menu/close" );
  555.  menu_destroy( menu );
  556.  
  557.  return PLUGIN_HANDLED;
  558.  }
  559.  
  560.  new data[ 6 ], iName[ 64 ];
  561.  new access, callback;
  562.  menu_item_getinfo( menu, item, access, data,5, iName, 63, callback );
  563.  
  564.  new key = str_to_num( data );
  565.  switch( key )
  566.  {
  567.  case 1:
  568.  {
  569.  if ( !equipment_mode[ id ] && get_pcvar_num( p_Equipment ) )
  570.  {
  571.  equipment_mode[ id ] = 1;
  572.  money_mode[ id ] = 0;
  573.  critical_mode[ id ] = 0;
  574.  soldier_mode[ id ] = 0;
  575.  heavy_mode[ id ] = 0;
  576.  medic_mode[ id ] = 0;
  577.  
  578.  client_cmd( id, "spk silent/vip/menu/button" );
  579.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_EQUIPMENT_FUNCTION" );
  580.  }
  581.  else if ( equipment_mode[ id ] )
  582.  {
  583.  client_cmd( id, "spk silent/vip/menu/close" );
  584.  }
  585.  else if ( !get_pcvar_num( p_Equipment ) )
  586.  {
  587.  client_cmd( id, "spk silent/vip/menu/close" );
  588.  }
  589.  }
  590.  case 2:
  591.  {
  592.  if ( !money_mode[ id ] && get_pcvar_num( p_Money ) )
  593.  {
  594.  equipment_mode[ id ] = 0;
  595.  money_mode[ id ] = 1;
  596.  critical_mode[ id ] = 0;
  597.  soldier_mode[ id ] = 0;
  598.  heavy_mode[ id ] = 0;
  599.  medic_mode[ id ] = 0;
  600.  
  601.  client_cmd( id, "spk silent/vip/menu/button" );
  602.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_MONEY_FUNCTION" );
  603.  }
  604.  else if ( money_mode[ id ] )
  605.  {
  606.  client_cmd( id, "spk silent/vip/menu/close" );
  607.  }
  608.  else if ( !get_pcvar_num( p_Money ) )
  609.  {
  610.  client_cmd( id, "spk silent/vip/menu/close" );
  611.  }
  612.  }
  613.  case 3:
  614.  {
  615.  if ( !critical_mode[ id ] && get_pcvar_num( p_Critical ) )
  616.  {
  617.  equipment_mode[ id ] = 0;
  618.  money_mode[ id ] = 0;
  619.  critical_mode[ id ] = 1;
  620.  soldier_mode[ id ] = 0;
  621.  heavy_mode[ id ] = 0;
  622.  medic_mode[ id ] = 0;
  623.  
  624.  client_cmd( id, "spk silent/vip/menu/button" );
  625.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_CRITICAL_FUNCTION" );
  626.  }
  627.  else if ( critical_mode[ id ] )
  628.  {
  629.  client_cmd( id, "spk silent/vip/menu/close" );
  630.  }
  631.  else if ( !get_pcvar_num( p_Critical ) )
  632.  {
  633.  client_cmd( id, "spk silent/vip/menu/close" );
  634.  }
  635.  }
  636.  case 4:
  637.  {
  638.  if ( !soldier_mode[ id ] && get_pcvar_num( p_Soldier ) )
  639.  {
  640.  equipment_mode[ id ] = 0;
  641.  money_mode[ id ] = 0;
  642.  critical_mode[ id ] = 0;
  643.  soldier_mode[ id ] = 1;
  644.  heavy_mode[ id ] = 0;
  645.  medic_mode[ id ] = 0;
  646.  
  647.  client_cmd( id, "spk silent/vip/menu/button" );
  648.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_SOLDIER_FUNCTION" );
  649.  }
  650.  else if ( soldier_mode[ id ] )
  651.  {
  652.  client_cmd( id, "spk silent/vip/menu/close" );
  653.  }
  654.  else if ( !get_pcvar_num( p_Soldier ) )
  655.  {
  656.  client_cmd( id, "spk silent/vip/menu/close" );
  657.  }
  658.  }
  659.  case 5:
  660.  {
  661.  if ( !heavy_mode[ id ] && get_pcvar_num( p_Heavy ) )
  662.  {
  663.  equipment_mode[ id ] = 0;
  664.  money_mode[ id ] = 0;
  665.  critical_mode[ id ] = 0;
  666.  soldier_mode[ id ] = 0;
  667.  heavy_mode[ id ] = 1;
  668.  medic_mode[ id ] = 0;
  669.  
  670.  client_cmd( id, "spk silent/vip/menu/button" );
  671.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_HEAVY_FUNCTION" );
  672.  }
  673.  else if ( heavy_mode[ id ] )
  674.  {
  675.  client_cmd( id, "spk silent/vip/menu/close" );
  676.  }
  677.  else if ( !get_pcvar_num( p_Heavy ) )
  678.  {
  679.  client_cmd( id, "spk silent/vip/menu/close" );
  680.  }
  681.  }
  682.  case 6:
  683.  {
  684.  if ( !medic_mode[ id ] && get_pcvar_num( p_Medic ) )
  685.  {
  686.  equipment_mode[ id ] = 0;
  687.  money_mode[ id ] = 0;
  688.  critical_mode[ id ] = 0;
  689.  soldier_mode[ id ] = 0;
  690.  heavy_mode[ id ] = 0;
  691.  medic_mode[ id ] = 1;
  692.  
  693.  client_cmd( id, "spk silent/vip/menu/button" );
  694.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_MEDIC_FUNCTION" );
  695.  }
  696.  else if ( medic_mode[ id ] )
  697.  {
  698.  client_cmd( id, "spk silent/vip/menu/close" );
  699.  }
  700.  else if ( !get_pcvar_num( p_Medic ) )
  701.  {
  702.  client_cmd( id, "spk silent/vip/menu/close" );
  703.  }
  704.  }
  705.  case 7:
  706.  {
  707.  equipment_mode[ id ] = 0;
  708.  money_mode[ id ] = 0;
  709.  critical_mode[ id ] = 0;
  710.  soldier_mode[ id ] = 0;
  711.  heavy_mode[ id ] = 0;
  712.  medic_mode[ id ] = 0;
  713.  
  714.  client_cmd( id, "spk silent/vip/menu/button" );
  715.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_DISSABLE_FUNCTIONS" );
  716.  client_cmd( id, "spk silent/vip/items/dissable" );
  717.  }
  718.  }
  719.  return PLUGIN_HANDLED;
  720. }
  721.  
  722. public event_NewRound ( id )
  723. {
  724.  g_iRoundCount++;
  725.  
  726.  p_Damage = get_pcvar_num( p_Type );
  727.  
  728.  if ( get_pcvar_num( p_Recieved ) )
  729.  {
  730.  g_showrecieved = true;
  731.  }
  732. }
  733.  
  734. public event_RoundEnd ( id )
  735. {
  736.  g_roundendfix = 1;
  737. }
  738.  
  739. public player_Spawn ( id )
  740. {
  741.  if ( get_user_flags( id ) & VIP_ACCESS )
  742.  {
  743.  if ( get_pcvar_num( p_Enabled ) && g_roundendfix )
  744.  {
  745.  if ( is_user_alive( id ) )
  746.  {
  747.  equipment_active[ id ] = 0;
  748.  money_active[ id ] = 0;
  749.  critical_active[ id ] = 0;
  750.  soldier_active[ id ] = 0;
  751.  heavy_active[ id ] = 0;
  752.  medic_active[ id ] = 0;
  753.  
  754.  if ( g_iRoundCount == 1 )
  755.  {
  756.  show_vip_menu( id );
  757.  }
  758.  
  759.  if ( equipment_mode[ id ] )
  760.  {
  761.  equipment_active[ id ] = 1;
  762.  equipment( id );
  763.  }
  764.  
  765.  if ( money_mode[ id ] )
  766.  {
  767.  money_active[ id ] = 1;
  768.  money( id );
  769.  }
  770.  
  771.  if ( critical_mode[ id ] )
  772.  {
  773.  critical_active[ id ] = 1;
  774.  critical( id );
  775.  }
  776.  
  777.  if ( soldier_mode[ id ] )
  778.  {
  779.  soldier_active[ id ] = 1;
  780.  soldier( id );
  781.  }
  782.  
  783.  if ( heavy_mode[ id ] )
  784.  {
  785.  heavy_active[ id ] = 1;
  786.  heavy( id );
  787.  }
  788.  
  789.  if ( medic_mode[ id ] )
  790.  {
  791.  medic_active[ id ] = 1;
  792.  medic( id );
  793.  }
  794.  
  795.  if ( p_Defuser )
  796.  {
  797.  if ( fm_find_ent_by_class( -1, "func_bomb_target" ) || fm_find_ent_by_class( -1, "info_bomb_target" ) )
  798.  {
  799.  if ( cs_get_user_team( id ) == CS_TEAM_CT )
  800.  {
  801.  fm_give_item( id, "item_thighpack" );
  802.  }
  803.  }
  804.  }
  805.  }
  806.  }
  807.  }
  808. }
  809.  
  810. public equipment ( id )
  811. {
  812.  if ( equipment_active[ id ] )
  813.  {
  814.  cs_set_user_armor( id, 100, CS_ARMOR_VESTHELM );
  815.  
  816.  fm_give_item( id, "weapon_hegrenade" );
  817.  fm_give_item( id, "weapon_flashbang" );
  818.  fm_give_item( id, "weapon_flashbang" );
  819.  
  820.  cs_set_user_bpammo( id, CSW_USP, 100 );
  821.  cs_set_user_bpammo( id, CSW_ELITE, 120 );
  822.  cs_set_user_bpammo( id, CSW_DEAGLE, 35) ;
  823.  cs_set_user_bpammo( id, CSW_GLOCK18, 120) ;
  824.  cs_set_user_bpammo( id, CSW_P228, 52 );
  825.  cs_set_user_bpammo( id, CSW_FIVESEVEN, 100 );
  826.  cs_set_user_bpammo( id, CSW_XM1014, 32 );
  827.  cs_set_user_bpammo( id, CSW_M3, 32 );
  828.  cs_set_user_bpammo( id, CSW_P90, 100 );
  829.  cs_set_user_bpammo( id, CSW_MAC10, 100 );
  830.  cs_set_user_bpammo( id, CSW_MP5NAVY, 120 );
  831.  cs_set_user_bpammo( id, CSW_TMP, 120 );
  832.  cs_set_user_bpammo( id, CSW_UMP45, 100 );
  833.  cs_set_user_bpammo( id, CSW_FAMAS, 90 );
  834.  cs_set_user_bpammo( id, CSW_GALIL, 90 );
  835.  cs_set_user_bpammo( id, CSW_SCOUT, 90 );
  836.  cs_set_user_bpammo( id, CSW_AUG, 90 );
  837.  cs_set_user_bpammo( id, CSW_M4A1, 90 );
  838.  cs_set_user_bpammo( id, CSW_AK47, 90 );
  839.  cs_set_user_bpammo( id, CSW_SG552, 90 );
  840.  cs_set_user_bpammo( id, CSW_G3SG1, 90 );
  841.  cs_set_user_bpammo( id, CSW_SG552, 90 );
  842.  cs_set_user_bpammo( id, CSW_AWP, 30 );
  843.  cs_set_user_bpammo( id, CSW_M249, 200 );
  844.  
  845.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_EQUIPMENT" );
  846.  
  847.  set_task( 0.1, "shake", id );
  848.  }
  849. }
  850.  
  851. public money ( id )
  852. {
  853.  if ( money_active[ id ] )
  854.  {
  855.  new MaxMoney = 16000;
  856.  new BonusMoney = get_pcvar_num( p_MoneyGive );
  857.  new TotalMoney = cs_get_user_money( id ) + BonusMoney;
  858.  
  859.  if ( TotalMoney >= MaxMoney )
  860.  {
  861.  cs_set_user_money( id, MaxMoney );
  862.  
  863.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_MONEY_MAX", get_pcvar_num( p_MoneyGive ) );
  864.  
  865.  client_cmd( id, "spk silent/vip/items/money_max" );
  866.  
  867.  set_task( 0.1, "shake", id );
  868.  
  869.  show_vip_menu( id );
  870.  } else {
  871.  cs_set_user_money( id, TotalMoney );
  872.  
  873.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_MONEY", get_pcvar_num( p_MoneyGive ) );
  874.  
  875.  set_task( 0.1, "shake", id );
  876.  }
  877.  }
  878. }
  879.  
  880. public critical ( id )
  881. {
  882.  if ( critical_active[ id ] )
  883.  {
  884.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_CRITICAL", get_pcvar_num( p_CriticalChance ) );
  885.  
  886.  set_task( 0.1, "shake", id );
  887.  }
  888. }
  889.  
  890. public soldier ( id )
  891. {
  892.  if ( soldier_active[ id ] )
  893.  {
  894.  cs_set_user_armor( id, get_pcvar_num( p_SoldierArmor ), CS_ARMOR_VESTHELM );
  895.  
  896.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_SOLDIER", get_pcvar_num( p_SoldierArmor ), get_pcvar_num( p_SoldierKillHp ) );
  897.  
  898.  set_task( 0.1, "shake", id );
  899.  }
  900. }
  901.  
  902. public heavy( id )
  903. {
  904.  if ( heavy_active[ id ] )
  905.  {
  906.  cs_set_user_armor( id, get_pcvar_num( p_HeavyArmor ), CS_ARMOR_VESTHELM );
  907.  
  908.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_HEAVY", get_pcvar_num( p_HeavyArmor ) );
  909.  
  910.  set_task( 0.1, "shake", id );
  911.  }
  912. }
  913.  
  914. public medic ( id )
  915. {
  916.  if ( medic_active[ id ] )
  917.  {
  918.  print_color( id, id, 0, "%L", LANG_SERVER, "VIP_MEDIC", get_pcvar_num( p_MedicHpRegen ), get_pcvar_num( p_MedicHpRegenSpeed ) );
  919.  
  920.  set_task( 0.1, "shake", id );
  921.  }
  922. }
  923.  
  924. public viplist ( id )
  925. {
  926.  static sPlayers[ 32 ], iNum, iPlayer;
  927.  static sName[ 32 ], sBuffer[ 1024 ];
  928.  static iLen;
  929.  
  930.  iLen = formatex( sBuffer, sizeof sBuffer - 1, "<html><head><link rel='stylesheet' type='text/css' href='http://silent.lt/motd/motd.css' media='screen' />" );
  931.  iLen += formatex( sBuffer[ iLen ], CharsMax( sBuffer ) - iLen,"<html><head><link rel='stylesheet' type='text/css' href='http://silent.lt/motd/motd.css' media='screen' />" );
  932.  
  933.  get_players( sPlayers, iNum, "ch" );
  934.  
  935.  iLen += formatex( sBuffer[ iLen ], CharsMax( sBuffer ) - iLen, "<center><img src='http://silent.lt/images/vips.png'></img></center><br>" );
  936.  
  937.  for( new x = 0; x < iNum ; x++ )
  938.  {
  939.  iPlayer = sPlayers[ x ];
  940.  
  941.  if ( get_user_flags( iPlayer ) & VIP_ACCESS )
  942.  {
  943.  get_user_name( iPlayer, sName, sizeof sName - 1 );
  944.  iLen += formatex( sBuffer[ iLen ], CharsMax( sBuffer ) - iLen, "<left>%s</left><br>", sName );
  945.  }
  946.  }
  947.  
  948.  show_motd( id, sBuffer, "Vip's Online" );
  949.  return 0;
  950. }
  951.  
  952. public shake ( id )
  953. {
  954.  client_cmd( id, "spk silent/vip/items/give_item" );
  955.  
  956.  message_begin( MSG_ONE_UNRELIABLE, g_msgFade, .player=id );
  957.  {
  958.  write_short( 1<<14 );
  959.  write_short( 1<<5 );
  960.  write_short( FFADE_IN );
  961.  write_byte( 34 );
  962.  write_byte( 34 );
  963.  write_byte( 139 );
  964.  write_byte( 75 );
  965.  }
  966.  message_end( );
  967.  
  968.  message_begin( MSG_ONE_UNRELIABLE, g_msgShake, .player=id );
  969.  {
  970.  write_short( 255<<15 );
  971.  write_short( 50<<8 );
  972.  write_short( 255<<15 );
  973.  }
  974.  message_end( );
  975. }
  976.  
  977. public print_color ( id, cid, color, const message[ ], any:... )
  978. {
  979.  new msg[ 192 ];
  980.  vformat( msg, charsmax( msg ), message, 5 );
  981.  
  982.  replace_all( msg, charsmax( msg ), "!g", "^x04" );
  983.  replace_all( msg, charsmax( msg ), "!n", "^x01" );
  984.  replace_all( msg, charsmax( msg ), "!t", "^x03" );
  985.  
  986.  new param;
  987.  
  988.  if ( !cid )
  989.  {
  990.  return;
  991.  } else {
  992.  param = cid;
  993.  }
  994.  
  995.  new team[ 32 ];
  996.  get_user_team( param, team, 31 );
  997.  
  998.  switch ( color )
  999.  {
  1000.  case 0: msg_teaminfo( param, team );
  1001.  case 1: msg_teaminfo( param, "TERRORIST" );
  1002.  case 2: msg_teaminfo( param, "CT" );
  1003.  case 3: msg_teaminfo( param, "SPECTATOR" );
  1004.  }
  1005.  
  1006.  if ( id )
  1007.  {
  1008.  msg_saytext( id, param, msg );
  1009.  } else {
  1010.  msg_saytext( 0, param, msg );
  1011.  }
  1012.  
  1013.  if ( color != 0 )
  1014.  {
  1015.  msg_teaminfo( param, team );
  1016.  }
  1017. }
  1018.  
  1019. msg_saytext ( id, cid, msg[ ] )
  1020. {
  1021.  message_begin( id?MSG_ONE:MSG_ALL, g_msgSayText, {0,0,0}, id );
  1022.  write_byte( cid );
  1023.  write_string( msg );
  1024.  message_end( );
  1025. }
  1026.  
  1027. msg_teaminfo ( id, team[ ] )
  1028. {
  1029.  message_begin( MSG_ONE, g_msgTeamInfo, {0,0,0}, id );
  1030.  write_byte( id );
  1031.  write_string( team );
  1032.  message_end( );
  1033. }
  1034.  
  1035. public plugin_precache ( )
  1036. {
  1037.  if ( file_exists( "sound/silent/vip/noaccess.wav" ) )
  1038.  precache_sound( "silent/vip/noaccess.wav" );
  1039.  
  1040.  if ( file_exists( "sound/silent/vip/attention.wav" ) )
  1041.  precache_sound( "silent/vip/attention.wav" );
  1042.  
  1043.  if ( file_exists( "sound/silent/vip/menu/open.wav" ) )
  1044.  precache_sound( "silent/vip/menu/open.wav" );
  1045.  
  1046.  if ( file_exists( "sound/silent/vip/menu/button.wav" ) )
  1047.  precache_sound( "silent/vip/menu/button.wav" );
  1048.  
  1049.  if ( file_exists( "sound/silent/vip/items/give_item.wav" ) )
  1050.  precache_sound( "silent/vip/items/give_item.wav" );
  1051.  
  1052.  if ( file_exists( "sound/silent/vip/items/money_max.wav" ) )
  1053.  precache_sound( "silent/vip/items/money_max.wav" );
  1054.  
  1055.  if ( file_exists( "sound/silent/vip/player/headshot.wav" ) )
  1056.  precache_sound( "silent/vip/player/headshot.wav" );
  1057.  
  1058.  if ( file_exists( "sound/silent/vip/player/critical.wav" ) )
  1059.  precache_sound( "silent/vip/player/critical.wav" );
  1060.  
  1061.  if ( file_exists( "sound/silent/vip/player/maximum.wav" ) )
  1062.  precache_sound( "silent/vip/player/maximum.wav" );
  1063.  
  1064.  if ( file_exists( "sound/silent/vip/items/health.wav" ) )
  1065.  precache_sound( "silent/vip/items/health.wav" );
  1066.  
  1067.  if ( file_exists( "sound/silent/vip/items/dissable.wav" ) )
  1068.  precache_sound( "silent/vip/items/dissable.wav" );
  1069.  
  1070.  if ( file_exists( "sound/silent/vip/menu/close.wav" ) )
  1071.  precache_sound( "silent/vip/menu/close.wav" );
  1072. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top