seroff

AMX Client Exec 0.05 By v3x+Seroff

Jan 10th, 2017
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.93 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define IsSetBit(%0,%1) ((%0) & (1 << (%1)))
  5. #define InvertBit(%0,%1) ((%0) ^= (1 << (%1)))
  6. #define IsNotSetBit(%0,%1) (~(%0) & (1 << (%1)))
  7.  
  8. new bool:isAll,bool:isTeam,bool:isServ,g_Connected,aShowActivity;
  9.  
  10. public plugin_init() {
  11. register_plugin("AMX Client Exec","0.05","v3x+Seroff");
  12. register_clcmd("amx_exec","doExec",ADMIN_RCON,"<nick,@TEAM,*(all),@SERVER>");
  13. register_srvcmd("amx_exec","doExec");
  14. aShowActivity=register_cvar("amx_show_activity","");
  15. }
  16.  
  17. public doExec(id,level,cid)
  18. {
  19. if(!cmd_access(id,level,cid,3))
  20. {
  21. return 1;
  22. }
  23. new arg[32],command[64],players[32],player,num,i;
  24. read_argv(1,arg,31);
  25. read_argv(2,command,63);
  26. remove_quotes(command);
  27. while(replace(command,63,"\'","^"")) { } // Credited to OLO
  28. new admin[32],activity = get_pcvar_num(aShowActivity);
  29. get_user_name(id,admin,31);
  30. if(arg[0]=='@'){
  31. if(equali(arg[1],"A") || equali(arg[1],"ALL")){
  32. isAll = true;
  33. isTeam = false;
  34. isServ = false;
  35. get_players(players,num,"c");
  36. }
  37. if(equali(arg[1],"TERRORIST") || equali(arg[1],"T") || equali(arg[1],"TERROR") || equali(arg[1],"TE") || equali(arg[1],"TER")){
  38. isAll = false;
  39. isTeam = true;
  40. isServ = false;
  41. get_players(players,num,"ce","TERRORIST");
  42. }
  43. if(equali(arg[1],"CT") || equali(arg[1],"C") || equali(arg[1],"COUNTER")){
  44. isAll = false;
  45. isTeam = true;
  46. isServ = false;
  47. get_players(players,num,"ce","CT");
  48. }
  49. if(equali(arg[1],"S") || equali(arg[1],"SERV") || equali(arg[1],"SERVER")){
  50. isAll = false;
  51. isTeam = false;
  52. isServ = true;
  53. server_cmd(command);
  54. }
  55. if(!(num) && !(isServ)){
  56. console_print(id,"[AMXX] No players on such team!");
  57. return 1;
  58. }
  59. if(!isServ){
  60. for(i=0;i<num;i++){
  61. player = players[i];
  62. if(IsNotSetBit(g_Connected,player)){
  63. continue;
  64. } else if(player){
  65. if(~get_user_flags(player) & ADMIN_IMMUNITY){
  66. client_cmd(player,command);
  67. }
  68. }
  69. }
  70. }
  71. if(isAll==true){
  72. switch(activity){
  73. case 1:{
  74. client_print(0,print_chat,"ADMIN: Command line ^"%s^" has been used on everyone",command);
  75. server_print("ADMIN: Command line ^"%s^" has been used on everyone",command);
  76. }
  77. case 2:{
  78. client_print(0,print_chat,"ADMIN %s: Command line ^"%s^" has been used on everyone",admin,command);
  79. server_print("ADMIN %s: Command line ^"%s^" has been used on everyone",admin,command);
  80. }
  81. }
  82. }
  83. if(isTeam==true){
  84. switch(activity){
  85. case 1:{
  86. client_print(0,print_chat,"ADMIN: Command line ^"%s^" has been used on the %ss",command,arg[1]);
  87. server_print("ADMIN: Command line ^"%s^" has been used on the %ss",command,arg[1]);
  88. }
  89. case 2:{
  90. client_print(0,print_chat,"ADMIN %s: Command line ^"%s^" has been used on the %ss",admin,command,arg[1]);
  91. server_print("ADMIN %s: Command line ^"%s^" has been used on the %ss",admin,command,arg[1]);
  92. }
  93. }
  94. }
  95. if(isServ==true){
  96. switch(activity){
  97. case 1:{
  98. client_print(0,print_chat,"ADMIN: Command line ^"%s^" has been exectuted into the server",command);
  99. server_print("ADMIN: Command line ^"%s^" has been exectuted into the server",command);
  100. }
  101. case 2:{
  102. client_print(0,print_chat,"ADMIN %s: Command line ^"%s^" has been exectuted into the server",admin,command);
  103. server_print("ADMIN %s: Command line ^"%s^" has been exectuted into the server",admin,command);
  104. }
  105. }
  106. }
  107. } else if(arg[0]=='*'){
  108. get_players(players,num,"c")
  109. for(i=0;i<num;i++){
  110. player = players[i];
  111. if(IsNotSetBit(g_Connected, player)){
  112. continue;
  113. } else if(player){
  114. if(~get_user_flags(player) & ADMIN_IMMUNITY){
  115. client_cmd(player,command);
  116. }
  117. }
  118. }
  119. switch(activity){
  120. case 1:{
  121. client_print(0,print_chat,"ADMIN: Command line ^"%s^" has been used on everyone!",command);
  122. server_print("ADMIN: Command line ^"%s^" has been used on everyone!",command);
  123. }
  124. case 2:{
  125. client_print(0,print_chat,"ADMIN %s: Command line ^"%s^" has been used on everyone!",admin,command);
  126. server_print("ADMIN %s: Command line ^"%s^" has been used on everyone!",admin,command);
  127. }
  128. }
  129. }else{
  130. new target = cmd_target(id,arg,3), name[33];
  131. if(IsNotSetBit(g_Connected,target)){
  132. return 1;
  133. }
  134. get_user_name(target,name,32);
  135. if(~get_user_flags(target) & ADMIN_IMMUNITY){
  136. client_cmd(target,command);
  137. }
  138. switch(activity){
  139. case 1:{
  140. client_print(0,print_chat,"ADMIN: Command line ^"%s^" has been used on %s!",command,name);
  141. server_print("ADMIN: Command line ^"%s^" has been used on %s!",command,name);
  142. }
  143. case 2:{
  144. client_print(0,print_chat,"ADMIN %s: Command line ^"%s^" has been used on %s!",admin,command,name);
  145. server_print("ADMIN %s: Command line ^"%s^" has been used on %s!",admin,command,name);
  146. }
  147. }
  148. }
  149. return 1;
  150. }
  151.  
  152. public client_putinserver(id){ InvertBit(g_Connected, id); }
  153. public client_disconnect(id){ InvertBit(g_Connected, id); }
Advertisement
Add Comment
Please, Sign In to add comment