AMXX GAG Color

Coding Help/Re-API Supported
Post Reply
User avatar
Null
Member
Member
Saudi Arabia
Posts: 24
Joined: 7 Months Ago
Location: Saudi Arabia, Riyadh
Has thanked: 0
Been thanked: 2 times
Contact:

AMXX GAG Color

#1

Post by Null » 3 Weeks Ago

Hi Guys i made this i want it when gag someone see in the chat like this
!g[GAG] "!tPlayer !tName" !tHas !gGAGGED !tFor !g%Time.
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4.  
  5. // time in minutes
  6. #define DEFAULT_GAG_TIME 10
  7. #define DEFAULT_MUTE_TIME 10
  8.  
  9. // level to use amx_gag and amx_ungag
  10. #define ADMIN_GAG ADMIN_LEVEL_A
  11.  
  12. new bool:g_AllowNameChange[33];
  13.  
  14. // text
  15. new const g_TextGagTag[] = "[GAG]";
  16. new bool:g_TextGagged[33];
  17. new Float:g_TextGagTime[33];
  18. new Float:g_PermTextGagged[100];
  19. new g_TextGaggedAuthid[100][35];
  20. new g_TotalTextGagLeaves;
  21.  
  22. // mute
  23. new const g_MutedTag[] = "[MUTE]";
  24. new bool:g_Muted[33];
  25. new Float:g_MutedTime[33];
  26. new Float:g_PermMuted[100];
  27. new g_MutedAuthid[100][35];
  28. new g_TotalMutedLeaves;
  29.  
  30. public plugin_init()
  31. {
  32.     register_plugin("AMXX Gag & Mute", "1.0", "null");
  33.     register_concmd("amx_gag", "concmd_Gag", ADMIN_GAG, "<nick, #userid, authid> <time> -- leave time empty for rest of map");
  34.     register_concmd("amx_ungag", "concmd_Ungag", ADMIN_GAG, "<nick, #userid, authid>");
  35.     register_concmd("amx_mute", "concmd_Mute", ADMIN_GAG, "<nick, #userid, authid> <time> -- leave empty for rest of map");
  36.     register_concmd("amx_unmute", "concmd_Unmute", ADMIN_GAG, "<nick, #userid, authid>");
  37.     register_clcmd("say", "clcmd_Say");
  38.     register_clcmd("say_team", "clcmd_Say");
  39. }
  40.  
  41. public client_putinserver(id)
  42. {
  43.     g_TextGagged[id] = false;
  44.     g_TextGagTime[id] = 0.0;
  45.     g_Muted[id] = false;
  46.     g_MutedTime[id] = 0.0;
  47.    
  48.     new authid[35], bool:text = false, mute = false;
  49.     if(g_TotalTextGagLeaves > 0)
  50.     {
  51.         get_user_authid(id, authid, 34);
  52.         for(new i=0; i < 100; i++)
  53.         {
  54.             if(equali(authid, g_TextGaggedAuthid[i]))
  55.             {
  56.                 g_TextGagged[id] = true;
  57.                
  58.                 if(g_PermTextGagged[i] > -1.0)
  59.                     set_task(g_PermTextGagged[i], "task_UngagPlayer", id + 112233);
  60.                
  61.                 g_TextGagTime[id] = g_PermTextGagged[i];
  62.                 g_PermTextGagged[i] = 0.0;
  63.                 g_TextGaggedAuthid[i][0] = '^0';
  64.                 g_TotalTextGagLeaves--;
  65.                
  66.                 text = true;
  67.                 break;
  68.             }
  69.         }
  70.     }
  71.     if(g_TotalMutedLeaves > 0)
  72.     {
  73.         if(!strlen(authid))
  74.             get_user_authid(id, authid, 34);
  75.        
  76.         for(new i=0; i < 100; i++)
  77.         {
  78.             if(equali(authid, g_MutedAuthid[i]))
  79.             {
  80.                 g_Muted[id] = true;
  81.                
  82.                 if(g_PermMuted[i] > -1.0)
  83.                     set_task(g_PermMuted[i], "task_UnmutePlayer", id + 223344);
  84.                
  85.                 g_MutedTime[id] = g_PermMuted[i];
  86.                 g_PermMuted[i] = 0.0;
  87.                 g_MutedAuthid[i][0] = '^0';
  88.                 g_TotalMutedLeaves--;
  89.                
  90.                 mute = true;
  91.                 break;
  92.             }
  93.         }
  94.     }
  95.     if(text || mute)
  96.     {
  97.         new name[32], ip[64];
  98.         get_user_name(id, name, 31);
  99.         get_user_ip(id, ip, 63, 0);
  100.         if(text && mute)
  101.         {
  102.             client_print(0, print_chat, "[AMXX] A gagged&muted player has returned! %s", name);
  103.             format(name, 31, "%s%s%s", g_TextGagTag, g_MutedTag, name);
  104.         }
  105.         else if(text)
  106.         {
  107.             client_print(0, print_chat, "[AMXX] A gagged player has returned! %s", name);
  108.             format(name, 31, "%s%s", g_TextGagTag, name);
  109.         }
  110.         else if(mute)
  111.         {
  112.             client_print(0, print_chat, "[AMXX] A muted player has returned! %s", name);
  113.             format(name, 31, "%s%s", g_MutedTag, name);
  114.         }
  115.         client_print(0, print_chat, "[AMXX] IP: %s", ip);
  116.         g_AllowNameChange[id] = true;
  117.         set_user_name(id, name);
  118.     }
  119.     if(!mute)
  120.         set_speak(id, SPEAK_NORMAL);
  121.     else
  122.         set_speak(id, SPEAK_MUTED);
  123. }
  124.  
  125. public client_disconnect(id)
  126. {
  127.     if(!g_TextGagged[id] && !g_Muted[id])
  128.         return;
  129.    
  130.     new authid[35], bool:text = g_TextGagged[id], mute = g_Muted[id];
  131.     get_user_authid(id, authid, 34);
  132.     if(g_TextGagged[id])
  133.     {
  134.         for(new i=0; i < 100; i++)
  135.         {
  136.             if(!strlen(g_TextGaggedAuthid[i]))
  137.             {
  138.                 g_TextGagged[id] = false;
  139.                 g_PermTextGagged[i] = g_TextGagTime[id];
  140.                 formatex(g_TextGaggedAuthid[i], 34, authid);
  141.                 g_TotalTextGagLeaves++;
  142.                
  143.                 text = true;
  144.                
  145.                 if(task_exists(id + 112233))
  146.                     remove_task(id + 112233);
  147.                
  148.                 break;
  149.             }
  150.         }
  151.     }
  152.     if(g_Muted[id])
  153.     {
  154.         for(new i=0; i < 100; i++)
  155.         {
  156.             if(!strlen(g_MutedAuthid[i]))
  157.             {
  158.                 g_Muted[id] = false;
  159.                 g_PermMuted[i] = g_MutedTime[id];
  160.                 formatex(g_MutedAuthid[i], 34, authid);
  161.                 g_TotalMutedLeaves++;
  162.                
  163.                 mute = true;
  164.                
  165.                 if(task_exists(id + 223344))
  166.                     remove_task(id + 223344);
  167.                
  168.                 break;
  169.             }
  170.         }
  171.     }
  172.     if(text || mute)
  173.     {
  174.         new name[32], ip[64];
  175.         get_user_name(id, name, 31);
  176.         get_user_ip(id, ip, 63, 0);
  177.         if(text && mute)
  178.         {
  179.             deletei(name, g_TextGagTag);
  180.             deletei(name, g_MutedTag);
  181.             client_print(0, print_chat, "[AMXX] A gagged&muted player has left! %s", name);
  182.         }
  183.         else if(text)
  184.         {
  185.             deletei(name, g_TextGagTag);
  186.             client_print(0, print_chat, "[AMXX] A gagged player has left! %s", name);
  187.         }
  188.         else if(mute)
  189.         {
  190.             deletei(name, g_MutedTag);
  191.             client_print(0, print_chat, "[AMXX] A muted player has left! %s", name);
  192.         }
  193.         client_print(0, print_chat, "[AMXX] IP: %s", ip);
  194.     }
  195. }
  196.  
  197. public client_infochanged(id)
  198. {
  199.     if(!g_TextGagged[id] && !g_Muted[id])
  200.         return;
  201.    
  202.     if(g_AllowNameChange[id])
  203.     {
  204.         g_AllowNameChange[id] = false;
  205.         return;
  206.     }
  207.    
  208.     new newname[32], oldname[32];
  209.     get_user_name(id, oldname, 31);
  210.     get_user_info(id, "name", newname, 31);
  211.     if(!equali(newname, oldname))
  212.     {
  213.         g_AllowNameChange[id] = true;
  214.         set_user_name(id, oldname);
  215.     }
  216. }
  217.  
  218. public concmd_Gag(id, level, cid)
  219. {
  220.     if(!cmd_access(id, level, cid, 2))
  221.         return PLUGIN_HANDLED;
  222.    
  223.     new arg[35];
  224.     read_argv(1, arg, 34);
  225.     new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY);
  226.     if(!player)
  227.         return PLUGIN_HANDLED;
  228.    
  229.     if(g_TextGagged[player])
  230.     {
  231.         client_print(id, print_console, "[AMXX] Client is already gagged!");
  232.         return PLUGIN_HANDLED;
  233.     }
  234.    
  235.     new Float:gagtime;
  236.     if(read_argc() > 2)
  237.     {
  238.         read_argv(2, arg, 31);
  239.         gagtime = str_to_float(arg) * 60.0;
  240.         if(gagtime < 60.0)
  241.             gagtime = DEFAULT_GAG_TIME * 60.0;
  242.     }
  243.     else
  244.         gagtime = -1.0;
  245.    
  246.     new gagtype[32];
  247.     if(!(gagtime > -1.0))
  248.         formatex(gagtype, 31, "until next map");
  249.     else
  250.     {
  251.         formatex(gagtype, 31, "for %.2f minutes", gagtime);
  252.         set_task(gagtime, "task_UngagPlayer", id + 112233);
  253.     }
  254.    
  255.     new name_a[32], name_p[32];
  256.     new authid_a[35], authid_p[35];
  257.     get_user_name(id, name_a, 31);
  258.     get_user_name(player, name_p, 31);
  259.     get_user_authid(id, authid_a, 35);
  260.     get_user_authid(id, authid_p, 35);
  261.     show_activity(id, name_a, "gagged %s %s!", name_p, gagtype);
  262.     log_amx("%s <%s> gagged %s <%s> %s", name_a, authid_a, name_p, authid_p, gagtype);
  263.    
  264.     format(name_p, 31, "%s%s", g_TextGagTag, name_p);
  265.     g_AllowNameChange[player] = true;
  266.     set_user_name(player, name_p);
  267.    
  268.     g_TextGagged[player] = true;
  269.     g_TextGagTime[player] = gagtime;
  270.     return PLUGIN_HANDLED;
  271. }
  272.  
  273. public concmd_Ungag(id, level, cid)
  274. {
  275.     if(!cmd_access(id, level, cid, 2))
  276.         return PLUGIN_HANDLED;
  277.    
  278.     new arg[35];
  279.     read_argv(1, arg, 31);
  280.     new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY);
  281.     if(!player)
  282.         return PLUGIN_HANDLED;
  283.    
  284.     if(!g_TextGagged[player])
  285.     {
  286.         client_print(id, print_console, "[AMXX] Client was not gagged!");
  287.         return PLUGIN_HANDLED;
  288.     }
  289.    
  290.     new name_a[32], name_p[32];
  291.     new authid_a[35], authid_p[35];
  292.     get_user_name(id, name_a, 31);
  293.     get_user_name(player, name_p, 31);
  294.     get_user_authid(id, authid_a, 35);
  295.     get_user_authid(id, authid_p, 35);
  296.     deletei(name_p, g_TextGagTag);
  297.     show_activity(id, name_a, "ungagged %s!", name_p);
  298.     log_amx("%s <%s> ungagged %s <%s>", name_a, authid_a, name_p, authid_p);
  299.    
  300.     g_AllowNameChange[player] = true;
  301.     set_user_name(player, name_p);
  302.    
  303.     g_TextGagged[player] = false;
  304.     g_TextGagTime[player] = 0.0;
  305.     if(task_exists(player + 112233))
  306.         remove_task(player + 112233);
  307.    
  308.     return PLUGIN_HANDLED;
  309. }
  310.  
  311. public concmd_Mute(id, level, cid)
  312. {
  313.     if(!cmd_access(id, level, cid, 2))
  314.         return PLUGIN_HANDLED;
  315.    
  316.     new arg[35];
  317.     read_argv(1, arg, 34);
  318.     new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY);
  319.     if(!player)
  320.         return PLUGIN_HANDLED;
  321.    
  322.     if(g_Muted[player])
  323.     {
  324.         client_print(id, print_console, "[AMXX] Client is already muted!");
  325.         return PLUGIN_HANDLED;
  326.     }
  327.    
  328.     new Float:mutetime;
  329.     if(read_argc() > 2)
  330.     {
  331.         read_argv(2, arg, 31);
  332.         mutetime = str_to_float(arg) * 60.0;
  333.         if(mutetime < 60.0)
  334.             mutetime = DEFAULT_MUTE_TIME * 60.0;
  335.     }
  336.     else
  337.         mutetime = -1.0;
  338.    
  339.     new mutetype[32];
  340.     if(!(mutetime > -1.0))
  341.         formatex(mutetype, 31, "until next map");
  342.     else
  343.     {
  344.         formatex(mutetype, 31, "for %.2f minutes", mutetime);
  345.         set_task(mutetime, "task_UnmutePlayer", id + 223344);
  346.     }
  347.    
  348.     new name_a[32], name_p[32];
  349.     new authid_a[35], authid_p[35];
  350.     get_user_name(id, name_a, 31);
  351.     get_user_name(player, name_p, 31);
  352.     get_user_authid(id, authid_a, 35);
  353.     get_user_authid(id, authid_p, 35);
  354.     show_activity(id, name_a, "muted %s %s!", name_p, mutetype);
  355.     log_amx("%s <%s> muted %s <%s> %s", name_a, authid_a, name_p, authid_p, mutetype);
  356.    
  357.     format(name_p, 31, "%s%s", g_MutedTag, name_p);
  358.     g_AllowNameChange[player] = true;
  359.     set_user_name(player, name_p);
  360.    
  361.     g_Muted[player] = true;
  362.     g_MutedTime[player] = mutetime;
  363.     set_speak(player, SPEAK_MUTED);
  364.     return PLUGIN_HANDLED;
  365. }
  366.  
  367. public concmd_Unmute(id, level, cid)
  368. {
  369.     if(!cmd_access(id, level, cid, 2))
  370.         return PLUGIN_HANDLED;
  371.    
  372.     new arg[35];
  373.     read_argv(1, arg, 31);
  374.     new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY);
  375.     if(!player)
  376.         return PLUGIN_HANDLED;
  377.    
  378.     if(!g_Muted[player])
  379.     {
  380.         client_print(id, print_console, "[AMXX] Client was not muted!");
  381.         return PLUGIN_HANDLED;
  382.     }
  383.    
  384.     new name_a[32], name_p[32];
  385.     new authid_a[35], authid_p[35];
  386.     get_user_name(id, name_a, 31);
  387.     get_user_name(player, name_p, 31);
  388.     get_user_authid(id, authid_a, 35);
  389.     get_user_authid(id, authid_p, 35);
  390.     deletei(name_p, g_MutedTag);
  391.     show_activity(id, name_a, "unmuted %s!", name_p);
  392.     log_amx("%s <%s> unmuted %s <%s>", name_a, authid_a, name_p, authid_p);
  393.    
  394.     g_AllowNameChange[player] = true;
  395.     set_user_name(player, name_p);
  396.    
  397.     g_Muted[player] = false;
  398.     g_MutedTime[player] = 0.0;
  399.     if(task_exists(player + 223344))
  400.         remove_task(player + 223344);
  401.    
  402.     return PLUGIN_HANDLED;
  403. }
  404.  
  405. public clcmd_Say(id)
  406. {
  407.     return g_TextGagged[id] ? PLUGIN_HANDLED : PLUGIN_CONTINUE;
  408. }
  409.  
  410. public task_UngagPlayer(id)
  411. {
  412.     id -= 112233;
  413.    
  414.     new name[32];
  415.     get_user_name(id, name, 31);
  416.     client_print(0, print_chat, "[AMXX] %s is now ungagged!", name);
  417.    
  418.     g_TextGagged[id] = false;
  419.     g_TextGagTime[id] = 0.0;
  420. }
  421.  
  422. public task_UnmutePlayer(id)
  423. {
  424.     id -= 223344;
  425.    
  426.     new name[32];
  427.     get_user_name(id, name, 31);
  428.     client_print(0, print_chat, "[AMXX] %s is now unmuted!", name);
  429.    
  430.     g_Muted[id] = false;
  431.     g_MutedTime[id] = 0.0;
  432. }
  433.  
  434. set_user_name(id, const name[])
  435. {
  436.     set_user_info(id, "name", name);
  437.     client_cmd(id, "name ^"%s^"", name);
  438. }
  439.  
  440. deletei(text[], const what[])
  441. {
  442.     new pos = containi(text, what);
  443.     new len, i;
  444.     while(pos >= 0)
  445.     {
  446.         len = strlen(what);
  447.         i = 0;
  448.         while(text[pos+len+i] != 0)
  449.         {
  450.             text[pos+i] = text[pos+len+i];
  451.             i++;
  452.         }
  453.         text[pos+i] = '^0';
  454.         pos = containi(text, what);
  455.     }
  456. }
These users thanked the author Null for the post:
Z0uha1r_LK (4 Days Ago)

User avatar
Z0uha1r_LK
Moderator
Moderator
Morocco
Posts: 342
Joined: 2 Years Ago
Location: Morocco
Has thanked: 92 times
Been thanked: 39 times
Age: 19
Contact:

#2

Post by Z0uha1r_LK » 4 Days Ago

do you want edit that from lang ?

karan
Mod Tester
Mod Tester
India
Posts: 122
Joined: 4 Years Ago
Location: India
Has thanked: 3 times
Been thanked: 10 times
Age: 24
Contact:

#3

Post by karan » 3 Days Ago

  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4. #include <zombie_escape>
  5.  
  6. // time in minutes
  7. #define DEFAULT_GAG_TIME 10
  8. #define DEFAULT_MUTE_TIME 10
  9.  
  10. // level to use amx_gag and amx_ungag
  11. #define ADMIN_GAG ADMIN_LEVEL_A
  12.  
  13. new bool:g_AllowNameChange[33];
  14.  
  15. // text
  16. new const g_TextGagTag[] = "[GAG]";
  17. new bool:g_TextGagged[33];
  18. new Float:g_TextGagTime[33];
  19. new Float:g_PermTextGagged[100];
  20. new g_TextGaggedAuthid[100][35];
  21. new g_TotalTextGagLeaves;
  22.  
  23. // mute
  24. new const g_MutedTag[] = "[MUTE]";
  25. new bool:g_Muted[33];
  26. new Float:g_MutedTime[33];
  27. new Float:g_PermMuted[100];
  28. new g_MutedAuthid[100][35];
  29. new g_TotalMutedLeaves;
  30.  
  31. public plugin_init()
  32. {
  33.     register_plugin("AMXX Gag & Mute", "1.0", "null");
  34.     register_concmd("amx_gag", "concmd_Gag", ADMIN_GAG, "<nick, #userid, authid> <time> -- leave time empty for rest of map");
  35.     register_concmd("amx_ungag", "concmd_Ungag", ADMIN_GAG, "<nick, #userid, authid>");
  36.     register_concmd("amx_mute", "concmd_Mute", ADMIN_GAG, "<nick, #userid, authid> <time> -- leave empty for rest of map");
  37.     register_concmd("amx_unmute", "concmd_Unmute", ADMIN_GAG, "<nick, #userid, authid>");
  38.     register_clcmd("say", "clcmd_Say");
  39.     register_clcmd("say_team", "clcmd_Say");
  40. }
  41.  
  42. public client_putinserver(id)
  43. {
  44.     g_TextGagged[id] = false;
  45.     g_TextGagTime[id] = 0.0;
  46.     g_Muted[id] = false;
  47.     g_MutedTime[id] = 0.0;
  48.    
  49.     new authid[35], bool:text = false, mute = false;
  50.     if(g_TotalTextGagLeaves > 0)
  51.     {
  52.         get_user_authid(id, authid, 34);
  53.         for(new i=0; i < 100; i++)
  54.         {
  55.             if(equali(authid, g_TextGaggedAuthid[i]))
  56.             {
  57.                 g_TextGagged[id] = true;
  58.                
  59.                 if(g_PermTextGagged[i] > -1.0)
  60.                     set_task(g_PermTextGagged[i], "task_UngagPlayer", id + 112233);
  61.                
  62.                 g_TextGagTime[id] = g_PermTextGagged[i];
  63.                 g_PermTextGagged[i] = 0.0;
  64.                 g_TextGaggedAuthid[i][0] = '^0';
  65.                 g_TotalTextGagLeaves--;
  66.                
  67.                 text = true;
  68.                 break;
  69.             }
  70.         }
  71.     }
  72.     if(g_TotalMutedLeaves > 0)
  73.     {
  74.         if(!strlen(authid))
  75.             get_user_authid(id, authid, 34);
  76.        
  77.         for(new i=0; i < 100; i++)
  78.         {
  79.             if(equali(authid, g_MutedAuthid[i]))
  80.             {
  81.                 g_Muted[id] = true;
  82.                
  83.                 if(g_PermMuted[i] > -1.0)
  84.                     set_task(g_PermMuted[i], "task_UnmutePlayer", id + 223344);
  85.                
  86.                 g_MutedTime[id] = g_PermMuted[i];
  87.                 g_PermMuted[i] = 0.0;
  88.                 g_MutedAuthid[i][0] = '^0';
  89.                 g_TotalMutedLeaves--;
  90.                
  91.                 mute = true;
  92.                 break;
  93.             }
  94.         }
  95.     }
  96.     if(text || mute)
  97.     {
  98.         new name[32], ip[64];
  99.         get_user_name(id, name, 31);
  100.         get_user_ip(id, ip, 63, 0);
  101.         if(text && mute)
  102.         {
  103.             ze_colored_print(0, "!g[GAG] !tA gagged&muted player has returned! %s", name)
  104.             //client_print(0, print_chat, "[AMXX] A gagged&muted player has returned! %s", name);            
  105.             format(name, 31, "%s%s%s", g_TextGagTag, g_MutedTag, name);
  106.         }
  107.         else if(text)
  108.         {
  109.             ze_colored_print(0, "!g[GAG] !tA gagged player has returned! %s", name)
  110.             //client_print(0, print_chat, "[AMXX] A gagged player has returned! %s", name);
  111.             format(name, 31, "%s%s", g_TextGagTag, name);
  112.         }
  113.         else if(mute)
  114.         {
  115.             ze_colored_print(0, "!g[GAG] !tA muted player has returned! %s", name)
  116.             //client_print(0, print_chat, "[AMXX] A muted player has returned! %s", name);
  117.             format(name, 31, "%s%s", g_MutedTag, name);
  118.         }
  119.         //client_print(0, print_chat, "[AMXX] IP: %s", ip);
  120.         ze_colored_print(0, "!g[GAG] !tIP: %s", ip);
  121.         g_AllowNameChange[id] = true;
  122.         set_user_name(id, name);
  123.     }
  124.     if(!mute)
  125.         set_speak(id, SPEAK_NORMAL);
  126.     else
  127.         set_speak(id, SPEAK_MUTED);
  128. }
  129.  
  130. public client_disconnected(id)
  131. {
  132.     if(!g_TextGagged[id] && !g_Muted[id])
  133.         return;
  134.    
  135.     new authid[35], bool:text = g_TextGagged[id], mute = g_Muted[id];
  136.     get_user_authid(id, authid, 34);
  137.     if(g_TextGagged[id])
  138.     {
  139.         for(new i=0; i < 100; i++)
  140.         {
  141.             if(!strlen(g_TextGaggedAuthid[i]))
  142.             {
  143.                 g_TextGagged[id] = false;
  144.                 g_PermTextGagged[i] = g_TextGagTime[id];
  145.                 formatex(g_TextGaggedAuthid[i], 34, authid);
  146.                 g_TotalTextGagLeaves++;
  147.                
  148.                 text = true;
  149.                
  150.                 if(task_exists(id + 112233))
  151.                     remove_task(id + 112233);
  152.                
  153.                 break;
  154.             }
  155.         }
  156.     }
  157.     if(g_Muted[id])
  158.     {
  159.         for(new i=0; i < 100; i++)
  160.         {
  161.             if(!strlen(g_MutedAuthid[i]))
  162.             {
  163.                 g_Muted[id] = false;
  164.                 g_PermMuted[i] = g_MutedTime[id];
  165.                 formatex(g_MutedAuthid[i], 34, authid);
  166.                 g_TotalMutedLeaves++;
  167.                
  168.                 mute = true;
  169.                
  170.                 if(task_exists(id + 223344))
  171.                     remove_task(id + 223344);
  172.                
  173.                 break;
  174.             }
  175.         }
  176.     }
  177.     if(text || mute)
  178.     {
  179.         new name[32], ip[64];
  180.         get_user_name(id, name, 31);
  181.         get_user_ip(id, ip, 63, 0);
  182.         if(text && mute)
  183.         {
  184.             deletei(name, g_TextGagTag);
  185.             deletei(name, g_MutedTag);
  186.             //client_print(0, print_chat, "[AMXX] A gagged&muted player has left! %s", name);
  187.             ze_colored_print(0, "!g[GAG] !tA gagged&muted player has left! %s", name)
  188.         }
  189.         else if(text)
  190.         {
  191.             deletei(name, g_TextGagTag);
  192.             //client_print(0, print_chat, "[AMXX] A gagged player has left! %s", name);
  193.             ze_colored_print(0, "!g[GAG] !tA gagged player has left! %s", name)
  194.         }
  195.         else if(mute)
  196.         {
  197.             deletei(name, g_MutedTag);
  198.             //client_print(0, print_chat, "[AMXX] A muted player has left! %s", name);
  199.             ze_colored_print(0, "!g[GAG] !tA muted player has left! %s", name)
  200.         }
  201.         //client_print(0, print_chat, "[AMXX] IP: %s", ip);
  202.         ze_colored_print(0, "!g[GAG] !tIP: %s", ip);
  203.     }
  204. }
  205.  
  206. public client_infochanged(id)
  207. {
  208.     if(!g_TextGagged[id] && !g_Muted[id])
  209.         return;
  210.    
  211.     if(g_AllowNameChange[id])
  212.     {
  213.         g_AllowNameChange[id] = false;
  214.         return;
  215.     }
  216.    
  217.     new newname[32], oldname[32];
  218.     get_user_name(id, oldname, 31);
  219.     get_user_info(id, "name", newname, 31);
  220.     if(!equali(newname, oldname))
  221.     {
  222.         g_AllowNameChange[id] = true;
  223.         set_user_name(id, oldname);
  224.     }
  225. }
  226.  
  227. public concmd_Gag(id, level, cid)
  228. {
  229.     if(!cmd_access(id, level, cid, 2))
  230.         return PLUGIN_HANDLED;
  231.    
  232.     new arg[35];
  233.     read_argv(1, arg, 34);
  234.     new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY);
  235.     if(!player)
  236.         return PLUGIN_HANDLED;
  237.    
  238.     if(g_TextGagged[player])
  239.     {
  240.         ze_colored_print(id, "!g[GAG] !tClient is already gagged!");
  241.         //client_print(id, print_console, "[AMXX] Client is already gagged!");
  242.         return PLUGIN_HANDLED;
  243.     }
  244.    
  245.     new Float:gagtime;
  246.     if(read_argc() > 2)
  247.     {
  248.         read_argv(2, arg, 31);
  249.         gagtime = str_to_float(arg) * 60.0;
  250.         if(gagtime < 60.0)
  251.             gagtime = DEFAULT_GAG_TIME * 60.0;
  252.     }
  253.     else
  254.         gagtime = -1.0;
  255.    
  256.     new gagtype[32];
  257.     if(!(gagtime > -1.0))
  258.         formatex(gagtype, 31, "until next map");
  259.     else
  260.     {
  261.         formatex(gagtype, 31, "for %.2f minutes", gagtime);
  262.         set_task(gagtime, "task_UngagPlayer", id + 112233);
  263.     }
  264.    
  265.     new name_a[32], name_p[32];
  266.     new authid_a[35], authid_p[35];
  267.     get_user_name(id, name_a, 31);
  268.     get_user_name(player, name_p, 31);
  269.     get_user_authid(id, authid_a, 35);
  270.     get_user_authid(id, authid_p, 35);
  271.     show_activity(id, name_a, "gagged %s %s!", name_p, gagtype);
  272.     log_amx("%s <%s> gagged %s <%s> %s", name_a, authid_a, name_p, authid_p, gagtype);
  273.    
  274.     format(name_p, 31, "%s%s", g_TextGagTag, name_p);
  275.     g_AllowNameChange[player] = true;
  276.     set_user_name(player, name_p);
  277.    
  278.     g_TextGagged[player] = true;
  279.     g_TextGagTime[player] = gagtime;
  280.     return PLUGIN_HANDLED;
  281. }
  282.  
  283. public concmd_Ungag(id, level, cid)
  284. {
  285.     if(!cmd_access(id, level, cid, 2))
  286.         return PLUGIN_HANDLED;
  287.    
  288.     new arg[35];
  289.     read_argv(1, arg, 31);
  290.     new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY);
  291.     if(!player)
  292.         return PLUGIN_HANDLED;
  293.    
  294.     if(!g_TextGagged[player])
  295.     {
  296.         ze_colored_print(id, "!g[GAG] !tClient was not gagged!");
  297.         //client_print(id, print_console, "[AMXX] Client was not gagged!");
  298.         return PLUGIN_HANDLED;
  299.     }
  300.    
  301.     new name_a[32], name_p[32];
  302.     new authid_a[35], authid_p[35];
  303.     get_user_name(id, name_a, 31);
  304.     get_user_name(player, name_p, 31);
  305.     get_user_authid(id, authid_a, 35);
  306.     get_user_authid(id, authid_p, 35);
  307.     deletei(name_p, g_TextGagTag);
  308.     show_activity(id, name_a, "ungagged %s!", name_p);
  309.     log_amx("%s <%s> ungagged %s <%s>", name_a, authid_a, name_p, authid_p);
  310.    
  311.     g_AllowNameChange[player] = true;
  312.     set_user_name(player, name_p);
  313.    
  314.     g_TextGagged[player] = false;
  315.     g_TextGagTime[player] = 0.0;
  316.     if(task_exists(player + 112233))
  317.         remove_task(player + 112233);
  318.    
  319.     return PLUGIN_HANDLED;
  320. }
  321.  
  322. public concmd_Mute(id, level, cid)
  323. {
  324.     if(!cmd_access(id, level, cid, 2))
  325.         return PLUGIN_HANDLED;
  326.    
  327.     new arg[35];
  328.     read_argv(1, arg, 34);
  329.     new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY);
  330.     if(!player)
  331.         return PLUGIN_HANDLED;
  332.    
  333.     if(g_Muted[player])
  334.     {
  335.         ze_colored_print(id, "!g[GAG] !tClient is already muted!");
  336.         //client_print(id, print_console, "[AMXX] Client is already muted!");
  337.         return PLUGIN_HANDLED;
  338.     }
  339.    
  340.     new Float:mutetime;
  341.     if(read_argc() > 2)
  342.     {
  343.         read_argv(2, arg, 31);
  344.         mutetime = str_to_float(arg) * 60.0;
  345.         if(mutetime < 60.0)
  346.             mutetime = DEFAULT_MUTE_TIME * 60.0;
  347.     }
  348.     else
  349.         mutetime = -1.0;
  350.    
  351.     new mutetype[32];
  352.     if(!(mutetime > -1.0))
  353.         formatex(mutetype, 31, "until next map");
  354.     else
  355.     {
  356.         formatex(mutetype, 31, "for %.2f minutes", mutetime);
  357.         set_task(mutetime, "task_UnmutePlayer", id + 223344);
  358.     }
  359.    
  360.     new name_a[32], name_p[32];
  361.     new authid_a[35], authid_p[35];
  362.     get_user_name(id, name_a, 31);
  363.     get_user_name(player, name_p, 31);
  364.     get_user_authid(id, authid_a, 35);
  365.     get_user_authid(id, authid_p, 35);
  366.     show_activity(id, name_a, "muted %s %s!", name_p, mutetype);
  367.     log_amx("%s <%s> muted %s <%s> %s", name_a, authid_a, name_p, authid_p, mutetype);
  368.    
  369.     format(name_p, 31, "%s%s", g_MutedTag, name_p);
  370.     g_AllowNameChange[player] = true;
  371.     set_user_name(player, name_p);
  372.    
  373.     g_Muted[player] = true;
  374.     g_MutedTime[player] = mutetime;
  375.     set_speak(player, SPEAK_MUTED);
  376.     return PLUGIN_HANDLED;
  377. }
  378.  
  379. public concmd_Unmute(id, level, cid)
  380. {
  381.     if(!cmd_access(id, level, cid, 2))
  382.         return PLUGIN_HANDLED;
  383.    
  384.     new arg[35];
  385.     read_argv(1, arg, 31);
  386.     new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY);
  387.     if(!player)
  388.         return PLUGIN_HANDLED;
  389.    
  390.     if(!g_Muted[player])
  391.     {
  392.         ze_colored_print(id, "!g[GAG] !tClient was not muted!");
  393.         //client_print(id, print_console, "[AMXX] Client was not muted!");
  394.         return PLUGIN_HANDLED;
  395.     }
  396.    
  397.     new name_a[32], name_p[32];
  398.     new authid_a[35], authid_p[35];
  399.     get_user_name(id, name_a, 31);
  400.     get_user_name(player, name_p, 31);
  401.     get_user_authid(id, authid_a, 35);
  402.     get_user_authid(id, authid_p, 35);
  403.     deletei(name_p, g_MutedTag);
  404.     show_activity(id, name_a, "unmuted %s!", name_p);
  405.     log_amx("%s <%s> unmuted %s <%s>", name_a, authid_a, name_p, authid_p);
  406.    
  407.     g_AllowNameChange[player] = true;
  408.     set_user_name(player, name_p);
  409.    
  410.     g_Muted[player] = false;
  411.     g_MutedTime[player] = 0.0;
  412.     if(task_exists(player + 223344))
  413.         remove_task(player + 223344);
  414.    
  415.     return PLUGIN_HANDLED;
  416. }
  417.  
  418. public clcmd_Say(id)
  419. {
  420.     return g_TextGagged[id] ? PLUGIN_HANDLED : PLUGIN_CONTINUE;
  421. }
  422.  
  423. public task_UngagPlayer(id)
  424. {
  425.     id -= 112233;
  426.    
  427.     new name[32];
  428.     get_user_name(id, name, 31);
  429.     ze_colored_print(0, "!g[GAG] !t%s is now ungagged!", name);
  430.     //client_print(0, print_chat, "[AMXX] %s is now ungagged!", name);
  431.    
  432.     g_TextGagged[id] = false;
  433.     g_TextGagTime[id] = 0.0;
  434. }
  435.  
  436. public task_UnmutePlayer(id)
  437. {
  438.     id -= 223344;
  439.    
  440.     new name[32];
  441.     get_user_name(id, name, 31);
  442.     ze_colored_print(0, "!g[GAG] !t%s is now unmuted!", name);
  443.     //client_print(0, print_chat, "[AMXX] %s is now unmuted!", name);
  444.    
  445.     g_Muted[id] = false;
  446.     g_MutedTime[id] = 0.0;
  447. }
  448.  
  449. set_user_name(id, const name[])
  450. {
  451.     set_user_info(id, "name", name);
  452.     client_cmd(id, "name ^"%s^"", name);
  453. }
  454.  
  455. deletei(text[], const what[])
  456. {
  457.     new pos = containi(text, what);
  458.     new len, i;
  459.     while(pos >= 0)
  460.     {
  461.         len = strlen(what);
  462.         i = 0;
  463.         while(text[pos+len+i] != 0)
  464.         {
  465.             text[pos+i] = text[pos+len+i];
  466.             i++;
  467.         }
  468.         text[pos+i] = '^0';
  469.         pos = containi(text, what);
  470.     }
  471. }
  472. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  473. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang16393\\ f0\\ fs16 \n\\ par }
  474. */
try this changes made for work with ze mod only
These users thanked the author karan for the post:
Z0uha1r_LK (2 Days Ago)
Image

User avatar
Null
Member
Member
Saudi Arabia
Posts: 24
Joined: 7 Months Ago
Location: Saudi Arabia, Riyadh
Has thanked: 0
Been thanked: 2 times
Contact:

#4

Post by Null » 3 Days Ago

Not for ZE bro

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 232
Joined: 4 Years Ago
Has thanked: 14 times
Been thanked: 13 times
Age: 22
Contact:

#5

Post by sPe3doN » 3 Days Ago

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <ColorChat>

// time in minutes
#define DEFAULT_GAG_TIME 10
#define DEFAULT_MUTE_TIME 10
 
// level to use amx_gag and amx_ungag
#define ADMIN_GAG ADMIN_LEVEL_A
 
new bool:g_AllowNameChange[33];
 
// text
new const g_TextGagTag[] = "[GAG]";
new bool:g_TextGagged[33];
new Float:g_TextGagTime[33];
new Float:g_PermTextGagged[100];
new g_TextGaggedAuthid[100][35];
new g_TotalTextGagLeaves;
 
// mute
new const g_MutedTag[] = "[MUTE]";
new bool:g_Muted[33];
new Float:g_MutedTime[33];
new Float:g_PermMuted[100];
new g_MutedAuthid[100][35];
new g_TotalMutedLeaves;
 
public plugin_init()
{
    register_plugin("AMXX Gag & Mute", "1.0", "null");
    register_concmd("amx_gag", "concmd_Gag", ADMIN_GAG, "<nick, #userid, authid> <time> -- leave time empty for rest of map");
    register_concmd("amx_ungag", "concmd_Ungag", ADMIN_GAG, "<nick, #userid, authid>");
    register_concmd("amx_mute", "concmd_Mute", ADMIN_GAG, "<nick, #userid, authid> <time> -- leave empty for rest of map");
    register_concmd("amx_unmute", "concmd_Unmute", ADMIN_GAG, "<nick, #userid, authid>");
    register_clcmd("say", "clcmd_Say");
    register_clcmd("say_team", "clcmd_Say");
}
 
public client_putinserver(id)
{
    g_TextGagged[id] = false;
    g_TextGagTime[id] = 0.0;
    g_Muted[id] = false;
    g_MutedTime[id] = 0.0;
   
    new authid[35], bool:text = false, mute = false;
    if(g_TotalTextGagLeaves > 0)
    {
        get_user_authid(id, authid, 34);
        for(new i=0; i < 100; i++)
        {
            if(equali(authid, g_TextGaggedAuthid[i]))
            {
                g_TextGagged[id] = true;
               
                if(g_PermTextGagged[i] > -1.0)
                    set_task(g_PermTextGagged[i], "task_UngagPlayer", id + 112233);
               
                g_TextGagTime[id] = g_PermTextGagged[i];
                g_PermTextGagged[i] = 0.0;
                g_TextGaggedAuthid[i][0] = '^0';
                g_TotalTextGagLeaves--;
               
                text = true;
                break;
            }
        }
    }
    if(g_TotalMutedLeaves > 0)
    {
        if(!strlen(authid))
            get_user_authid(id, authid, 34);
       
        for(new i=0; i < 100; i++)
        {
            if(equali(authid, g_MutedAuthid[i]))
            {
                g_Muted[id] = true;
               
                if(g_PermMuted[i] > -1.0)
                    set_task(g_PermMuted[i], "task_UnmutePlayer", id + 223344);
               
                g_MutedTime[id] = g_PermMuted[i];
                g_PermMuted[i] = 0.0;
                g_MutedAuthid[i][0] = '^0';
                g_TotalMutedLeaves--;
               
                mute = true;
                break;
            }
        }
    }
    if(text || mute)
    {
        new name[32], ip[64];
        get_user_name(id, name, 31);
        get_user_ip(id, ip, 63, 0);
        if(text && mute)
        {
            ColorChat(0, "!t[!gAMXX!t] !yA gagged & muted player has returned! %s", name);
            format(name, 31, "%s%s%s", g_TextGagTag, g_MutedTag, name);
        }
        else if(text)
        {
            ColorChat(0, "!t[!gAMXX!t] !yA gagged player has returned! %s", name);
            format(name, 31, "%s%s", g_TextGagTag, name);
        }
        else if(mute)
        {
            ColorChat(0, "!t[!gAMXX!t] !yA muted player has returned! %s", name);
            format(name, 31, "%s%s", g_MutedTag, name);
        }
        ColorChat(0, "!t[!gAMXX!t] !yIP: !g%s", ip);
        g_AllowNameChange[id] = true;
        set_user_name(id, name);
    }
    if(!mute)
        set_speak(id, SPEAK_NORMAL);
    else
        set_speak(id, SPEAK_MUTED);
}
 
public client_disconnect(id)
{
    if(!g_TextGagged[id] && !g_Muted[id])
        return;
   
    new authid[35], bool:text = g_TextGagged[id], mute = g_Muted[id];
    get_user_authid(id, authid, 34);
    if(g_TextGagged[id])
    {
        for(new i=0; i < 100; i++)
        {
            if(!strlen(g_TextGaggedAuthid[i]))
            {
                g_TextGagged[id] = false;
                g_PermTextGagged[i] = g_TextGagTime[id];
                formatex(g_TextGaggedAuthid[i], 34, authid);
                g_TotalTextGagLeaves++;
               
                text = true;
               
                if(task_exists(id + 112233))
                    remove_task(id + 112233);
               
                break;
            }
        }
    }
    if(g_Muted[id])
    {
        for(new i=0; i < 100; i++)
        {
            if(!strlen(g_MutedAuthid[i]))
            {
                g_Muted[id] = false;
                g_PermMuted[i] = g_MutedTime[id];
                formatex(g_MutedAuthid[i], 34, authid);
                g_TotalMutedLeaves++;
               
                mute = true;
               
                if(task_exists(id + 223344))
                    remove_task(id + 223344);
               
                break;
            }
        }
    }
    if(text || mute)
    {
        new name[32], ip[64];
        get_user_name(id, name, 31);
        get_user_ip(id, ip, 63, 0);
        if(text && mute)
        {
            deletei(name, g_TextGagTag);
            deletei(name, g_MutedTag);
            ColorChat(0, "!t[!gAMXX!t] !yA gagged&muted player has left !g%s", name);
        }
        else if(text)
        {
            deletei(name, g_TextGagTag);
            ColorChat(0, "!t[!gAMXX!t] !yA gagged player has left !g%s", name);
        }
        else if(mute)
        {
            deletei(name, g_MutedTag);
            ColorChat(0, "!t[!gAMXX!t] !yA muted player has left !g%s", name);
        }
        ColorChat(0, "!t[!gAMXX!t] !yIP: !g%s", ip);
    }
}
 
public client_infochanged(id)
{
    if(!g_TextGagged[id] && !g_Muted[id])
        return;
   
    if(g_AllowNameChange[id])
    {
        g_AllowNameChange[id] = false;
        return;
    }
   
    new newname[32], oldname[32];
    get_user_name(id, oldname, 31);
    get_user_info(id, "name", newname, 31);
    if(!equali(newname, oldname))
    {
        g_AllowNameChange[id] = true;
        set_user_name(id, oldname);
    }
}
 
public concmd_Gag(id, level, cid)
{
    if(!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED;
   
    new arg[35];
    read_argv(1, arg, 34);
    new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY);
    if(!player)
        return PLUGIN_HANDLED;
   
    if(g_TextGagged[player])
    {
        client_print(id, print_console, "[AMXX] Client is already gagged!");
        return PLUGIN_HANDLED;
    }
   
    new Float:gagtime;
    if(read_argc() > 2)
    {
        read_argv(2, arg, 31);
        gagtime = str_to_float(arg) * 60.0;
        if(gagtime < 60.0)
            gagtime = DEFAULT_GAG_TIME * 60.0;
    }
    else
        gagtime = -1.0;
   
    new gagtype[32];
    if(!(gagtime > -1.0))
        formatex(gagtype, 31, "until next map");
    else
    {
        formatex(gagtype, 31, "for %.2f minutes", gagtime);
        set_task(gagtime, "task_UngagPlayer", id + 112233);
    }
   
    new name_a[32], name_p[32];
    new authid_a[35], authid_p[35];
    get_user_name(id, name_a, 31);
    get_user_name(player, name_p, 31);
    get_user_authid(id, authid_a, 35);
    get_user_authid(id, authid_p, 35);
    show_activity(id, name_a, "gagged %s %s!", name_p, gagtype);
    log_amx("%s <%s> gagged %s <%s> %s", name_a, authid_a, name_p, authid_p, gagtype);
   
    format(name_p, 31, "%s%s", g_TextGagTag, name_p);
    g_AllowNameChange[player] = true;
    set_user_name(player, name_p);
   
    g_TextGagged[player] = true;
    g_TextGagTime[player] = gagtime;
    return PLUGIN_HANDLED;
}
 
public concmd_Ungag(id, level, cid)
{
    if(!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED;
   
    new arg[35];
    read_argv(1, arg, 31);
    new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY);
    if(!player)
        return PLUGIN_HANDLED;
   
    if(!g_TextGagged[player])
    {
        client_print(id, print_console, "[AMXX] Client was not gagged!");
        return PLUGIN_HANDLED;
    }
   
    new name_a[32], name_p[32];
    new authid_a[35], authid_p[35];
    get_user_name(id, name_a, 31);
    get_user_name(player, name_p, 31);
    get_user_authid(id, authid_a, 35);
    get_user_authid(id, authid_p, 35);
    deletei(name_p, g_TextGagTag);
    show_activity(id, name_a, "ungagged %s!", name_p);
    log_amx("%s <%s> ungagged %s <%s>", name_a, authid_a, name_p, authid_p);
   
    g_AllowNameChange[player] = true;
    set_user_name(player, name_p);
   
    g_TextGagged[player] = false;
    g_TextGagTime[player] = 0.0;
    if(task_exists(player + 112233))
        remove_task(player + 112233);
   
    return PLUGIN_HANDLED;
}
 
public concmd_Mute(id, level, cid)
{
    if(!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED;
   
    new arg[35];
    read_argv(1, arg, 34);
    new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY);
    if(!player)
        return PLUGIN_HANDLED;
   
    if(g_Muted[player])
    {
        client_print(id, print_console, "[AMXX] Client is already muted!");
        return PLUGIN_HANDLED;
    }
   
    new Float:mutetime;
    if(read_argc() > 2)
    {
        read_argv(2, arg, 31);
        mutetime = str_to_float(arg) * 60.0;
        if(mutetime < 60.0)
            mutetime = DEFAULT_MUTE_TIME * 60.0;
    }
    else
        mutetime = -1.0;
   
    new mutetype[32];
    if(!(mutetime > -1.0))
        formatex(mutetype, 31, "until next map");
    else
    {
        formatex(mutetype, 31, "for %.2f minutes", mutetime);
        set_task(mutetime, "task_UnmutePlayer", id + 223344);
    }
   
    new name_a[32], name_p[32];
    new authid_a[35], authid_p[35];
    get_user_name(id, name_a, 31);
    get_user_name(player, name_p, 31);
    get_user_authid(id, authid_a, 35);
    get_user_authid(id, authid_p, 35);
    show_activity(id, name_a, "muted %s %s!", name_p, mutetype);
    log_amx("%s <%s> muted %s <%s> %s", name_a, authid_a, name_p, authid_p, mutetype);
   
    format(name_p, 31, "%s%s", g_MutedTag, name_p);
    g_AllowNameChange[player] = true;
    set_user_name(player, name_p);
   
    g_Muted[player] = true;
    g_MutedTime[player] = mutetime;
    set_speak(player, SPEAK_MUTED);
    return PLUGIN_HANDLED;
}
 
public concmd_Unmute(id, level, cid)
{
    if(!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED;
   
    new arg[35];
    read_argv(1, arg, 31);
    new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY);
    if(!player)
        return PLUGIN_HANDLED;
   
    if(!g_Muted[player])
    {
        client_print(id, print_console, "[AMXX] Client was not muted!");
        return PLUGIN_HANDLED;
    }
   
    new name_a[32], name_p[32];
    new authid_a[35], authid_p[35];
    get_user_name(id, name_a, 31);
    get_user_name(player, name_p, 31);
    get_user_authid(id, authid_a, 35);
    get_user_authid(id, authid_p, 35);
    deletei(name_p, g_MutedTag);
    show_activity(id, name_a, "unmuted %s!", name_p);
    log_amx("%s <%s> unmuted %s <%s>", name_a, authid_a, name_p, authid_p);
   
    g_AllowNameChange[player] = true;
    set_user_name(player, name_p);
   
    g_Muted[player] = false;
    g_MutedTime[player] = 0.0;
    if(task_exists(player + 223344))
        remove_task(player + 223344);
   
    return PLUGIN_HANDLED;
}
 
public clcmd_Say(id)
{
    return g_TextGagged[id] ? PLUGIN_HANDLED : PLUGIN_CONTINUE;
}
 
public task_UngagPlayer(id)
{
    id -= 112233;
   
    new name[32];
    get_user_name(id, name, 31);
    ColorChat(0, "!t[!gAMXX!t] !g%s !yis now ungagged!", name);
   
    g_TextGagged[id] = false;
    g_TextGagTime[id] = 0.0;
}
 
public task_UnmutePlayer(id)
{
    id -= 223344;
   
    new name[32];
    get_user_name(id, name, 31);
    ColorChat(0, "!t[!gAMXX!t] !g%s !yis now unmuted!", name);
   
    g_Muted[id] = false;
    g_MutedTime[id] = 0.0;
}
 
set_user_name(id, const name[])
{
    set_user_info(id, "name", name);
    client_cmd(id, "name ^"%s^"", name);
}
 
deletei(text[], const what[])
{
    new pos = containi(text, what);
    new len, i;
    while(pos >= 0)
    {
        len = strlen(what);
        i = 0;
        while(text[pos+len+i] != 0)
        {
            text[pos+i] = text[pos+len+i];
            i++;
        }
        text[pos+i] = '^0';
        pos = containi(text, what);
    }
}
ColorChat.inc

Code: Select all

#include <hamsandwich>

stock ColorChat(const id, const input[], any:...)
{  
    new count = 1, players[32];  
    static msg[192];  
    vformat(msg, 191, input, 3);  

    replace_all(msg, 191, "!g", "^x04"); // Green Color  
    replace_all(msg, 191, "!y", "^x01"); // Default Color  
    replace_all(msg, 191, "!t", "^x03"); // Team Color  

    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();  
            }  
        }  
    }  
}

stock ham_strip_weapon(id,weapon[])
{
    if(!equal(weapon,"weapon_",7)) return 0;

    new wId = get_weaponid(weapon);
    if(!wId) return 0;

    new wEnt;
    while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
    if(!wEnt) return 0;

    if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);

    if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0;
    ExecuteHamB(Ham_Item_Kill,wEnt);

    set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId));

    return 1;
}
My steam account:
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest