seroff

Simple AWP Limited 1.0b By Seroff

Jan 10th, 2017
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <cstrike>
  3.  
  4. static sClim,sRstatus,sLimset,sPlus,g_iTextMsg,scLimiton,stLimiton,szSt;
  5.  
  6. public plugin_init(){
  7. register_plugin("Simple AWP Limited","1.0b","Seroff");
  8. sClim=register_cvar("awp_lim","3");
  9. sRstatus=register_cvar("awp_slim","1");
  10. sPlus=register_cvar("awp_plim","2");
  11. g_iTextMsg = get_user_msgid("TextMsg");
  12. register_event("HLTV", "eRestart", "a", "1=0", "2=0");
  13. register_event("TextMsg", "eRestart", "a", "2=#Game_will_restart_in","2=#Game_Commencing");
  14. }
  15.  
  16. public eRestart(){
  17. sLimset=get_pcvar_num(sRstatus);
  18. switch(sLimset){
  19. case 1:{
  20. scLimiton=3;
  21. stLimiton=3;
  22. }
  23. case 2:{
  24. scLimiton=2;
  25. stLimiton=2;
  26. szSt=1;
  27. }
  28. case 3:{
  29. scLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus);
  30. stLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus);
  31. szSt=1;
  32. }
  33. case 4:{
  34. scLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus);
  35. stLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus);
  36. }
  37. case 5:{
  38. scLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus)/2;
  39. stLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus)/2;
  40. }
  41. case 6:{
  42. scLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus)/2;
  43. stLimiton=get_pcvar_num(sClim)+get_pcvar_num(sPlus)/2;
  44. szSt=1;
  45. }
  46. }
  47. }
  48.  
  49. stock teamCount(szTeam){
  50. new Count, Players[32];
  51. get_players(Players, Count, "e",szTeam ? "TERRORIST":"CT");
  52. return Count;
  53. }
  54.  
  55. public client_buy(id, i_Item){
  56. new CsTeams:check_team;
  57. check_team = cs_get_user_team(id);
  58. // Проверяем, что купил игрок, если это AWP и игрок не имеет AWP в наличии, то выполняем
  59. if (i_Item==CSW_AWP && !user_has_weapon(id, CSW_AWP)){
  60. switch(check_team){
  61. case CS_TEAM_CT:{
  62. if(szSt){
  63. if(scLimiton){
  64. switch(teamCount(0)){
  65. case 1,2,3:{
  66. scLimiton--;
  67. }
  68. case 4..32:{
  69. scLimiton=teamCount(0)-scLimiton;
  70. }
  71. }
  72. }
  73. }else{
  74. if(scLimiton){
  75. scLimiton--;
  76. }
  77. }
  78. }
  79. case CS_TEAM_T:{
  80. if(szSt){
  81. if(stLimiton){
  82. switch(teamCount(1)){
  83. case 1,2,3:{
  84. stLimiton--;
  85. }
  86. case 4..32:{
  87. stLimiton=teamCount(0)-stLimiton;
  88. }
  89. }
  90. }else{
  91. if(stLimiton){
  92. stLimiton--;
  93. }
  94. }
  95. }
  96. }
  97. }
  98. if(!stLimiton || !scLimiton){
  99. message_begin(MSG_ONE_UNRELIABLE, g_iTextMsg, .player = id)
  100. {
  101. write_byte(print_center);
  102. write_string("#Alias_Not_Avail");
  103. write_string("#ArcticWarfareMagnum");
  104. }
  105. message_end();
  106. // Используем PLUGIN_HANDLED для блокировки покупки
  107. return PLUGIN_HANDLED
  108. }
  109. }
  110. return PLUGIN_CONTINUE
  111. }
Advertisement
Add Comment
Please, Sign In to add comment