hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.06.16. 06:07



Jelenlévő felhasználók

Jelenleg 499 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 499 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználó az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 24 hozzászólás ]  Oldal Előző 1 2 3 Következő
Szerző Üzenet
 Hozzászólás témája: Re: Grab+ | Mind | Ismeretlen
HozzászólásElküldve: 2011.12.22. 19:16 
Offline
Tag

Csatlakozott: 2011.05.25. 13:38
Hozzászólások: 33
Megköszönték neki: 3 alkalommal
Aki szeretné a Színt átírni, annak itt egy kis segítség:
Ezt a sort kell kikeresni az sma-ban:

p_glow_r = register_cvar( "gp_glow_r", "50" )
p_glow_g = register_cvar( "gp_glow_g", "0" )
p_glow_b = register_cvar( "gp_glow_b", "0" )

Ha megvan, akkor menjünk fel ide:
http://drpeterjones.com/colorcalc/

Ha felmentünk a "table" segítségével keressük meg a nekünk tetsző színt majd ezek után az RGB kódját írjuk 3 felé..
pl: fekete - 0 0 0
Ha kiegészítettük a színünkkel azt a 3 sort, akkor az sma-t konvertálni kell .amxx -be.
Ezt szinte bármelyik AMX-el foglalkozó oldalon megteheted.

##
Remélem tudtam segíteni a Színekkel bajlodóknak..
:]


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Grab+ | Mind | Ismeretlen
HozzászólásElküldve: 2012.08.14. 12:30 
Offline
Újonc

Csatlakozott: 2010.06.27. 16:50
Hozzászólások: 1
Vagy csak simán beírod az amxx.cfg legvégére a cvarokat (gp_glow_r 50, gp_glow_g 0, gp_glow_b 0). Elvégül is azért csinált rá cvarokat hogy a plugin átírása nélkül lehessen állítani ...


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Grab+
HozzászólásElküldve: 2014.03.28. 17:09 
Offline
Újonc

Csatlakozott: 2014.03.01. 21:31
Hozzászólások: 9
Valaki elmondaná, hogy hogyan tudom beállítani, hogy sima játékosok ne használhassák a grabbolást? Köszi!


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Grab+
HozzászólásElküldve: 2016.02.13. 16:45 
Offline
GFX-Designer
Avatar

Csatlakozott: 2015.03.12. 15:06
Hozzászólások: 624
Megköszönt másnak: 199 alkalommal
Megköszönték neki: 78 alkalommal
Valaki át tudná írni, hogy csak L jogú használhassa?

Köszönöm előre!

  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4.  
  5. #define PLUGIN "ADMIN Gag"
  6. #define VERSION "1.0.1"
  7. #define AUTHOR "RaZzoR"
  8.  
  9. #define GAG_FLAG ADMIN_BAN
  10. #define GAG_IMMUNITY ADMIN_IMMUNITY
  11.  
  12. #define DICTIONARY "admin_gag.txt"
  13. #define USE_COLOR_CHAT
  14.  
  15. #if defined USE_COLOR_CHAT
  16.     #include <colorchat>
  17. #endif
  18.  
  19. new const gag_file_name[] = "gagged_users.txt"
  20.  
  21. enum _:GagData {
  22.     gag_name[32],
  23.     gag_steamid[35],
  24.     gag_length,
  25.     ungag_time[32],
  26.     gag_reason[128]
  27. }
  28.  
  29. new Trie:g_trie
  30. new Array:g_array
  31. new total_gags, g_ungag_entity
  32. new gag_file[64], Float:get_gag_time[33], tempid[33]
  33.  
  34. new gag_immunity, gag_ungagcheck
  35.  
  36. public plugin_init() {
  37.     register_plugin(PLUGIN, VERSION, AUTHOR)
  38.  
  39.     #if defined USE_COLOR_CHAT
  40.         register_dictionary_colored(DICTIONARY)
  41.     #else
  42.         register_dictionary(DICTIONARY)
  43.     #endif
  44.  
  45.     gag_immunity = register_cvar("gag_immunity", "1")
  46.     gag_ungagcheck = register_cvar("gag_ungagcheck", "1.0")
  47.  
  48.     register_clcmd("say /gag_menu", "gag_menu")
  49.     register_clcmd("say /ungag_menu", "ungag_menu")
  50.  
  51.     register_clcmd("say", "gag_say")
  52.     register_clcmd("say_team", "gag_say")  
  53.  
  54.     register_clcmd("GAG_TIME", "clcmd_time")
  55.     register_clcmd("GAG_REASON", "clcmd_reason")
  56.  
  57.     register_concmd("gag_authid", "concmd_gag_authid", GAG_FLAG, "<nev, #userid, authid> <ido percben> <ok>")
  58.     register_concmd("gag_ip", "concmd_gag_ip", GAG_FLAG, "<nev, #userid, authid> <ido percben> <ok>")
  59.     register_concmd("gag_add", "concmd_gag_add", GAG_FLAG, "<nev> <authid vagy ip> <ido percben> <ok>")
  60.     register_concmd("gag_list", "concmd_gag_list", GAG_FLAG, "[start] -- megmutat minden nemitast")
  61.     register_concmd("ungag", "concmd_ungag", GAG_FLAG, "<authid vagy ip>")
  62.  
  63.     get_datadir(gag_file, sizeof(gag_file) - 1)
  64.     format(gag_file, sizeof(gag_file) - 1, "%s/%s", gag_file, gag_file_name)
  65.  
  66.     g_trie = TrieCreate()
  67.     g_array = ArrayCreate(GagData)
  68.  
  69.     LoadGags()
  70. }
  71.  
  72. public plugin_cfg() create_ungag_entity()
  73.  
  74. public client_PostThink(id) {
  75.     static authid[35]
  76.     get_user_authid(id, authid, sizeof(authid) - 1)
  77.  
  78.     static ip[35]
  79.     get_user_ip(id, ip, sizeof(ip) - 1, 1)
  80.  
  81.     static array_pos   
  82.     if(TrieGetCell(g_trie, authid, array_pos) || TrieGetCell(g_trie, ip, array_pos)) set_speak(id, SPEAK_MUTED)
  83.     else set_speak(id, SPEAK_LISTENALL)
  84. }
  85.  
  86. public create_ungag_entity() {
  87.     static failtimes
  88.  
  89.     g_ungag_entity = create_entity("info_target")
  90.  
  91.     if(!is_valid_ent(g_ungag_entity)) {
  92.         ++failtimes
  93.  
  94.         log_amx("%L", LANG_SERVER, "FAILED_TO_CREATE_UNGAG_ENTITY", failtimes)
  95.  
  96.         if(failtimes < 10) set_task(1.0, "create_ungag_entity")
  97.         else log_amx("%L", LANG_SERVER, "COULD_NOT_CREATE_UNGAG_ENTITY")
  98.  
  99.         return
  100.     }
  101.  
  102.     entity_set_string(g_ungag_entity, EV_SZ_classname, "ungag_entity")
  103.     entity_set_float(g_ungag_entity, EV_FL_nextthink, get_gametime() + 1.0)
  104.  
  105.     register_think("ungag_entity", "UnGag_Check")
  106. }
  107.  
  108. public UnGag_Check(entity)
  109. {
  110.     if(entity != g_ungag_entity) return
  111.  
  112.     if(total_gags > 0)
  113.     {
  114.         static _hours[5], _minutes[5], _seconds[5], _month[5], _day[5], _year[7]
  115.         format_time(_hours, sizeof(_hours) - 1, "%H")
  116.         format_time(_minutes, sizeof(_minutes) - 1, "%M")
  117.         format_time(_seconds, sizeof(_seconds) - 1, "%S")
  118.         format_time(_month, sizeof(_month) - 1, "%m")
  119.         format_time(_day, sizeof(_day) - 1, "%d")
  120.         format_time(_year, sizeof(_year) - 1, "%Y")
  121.  
  122.  
  123.         new c_hours = str_to_num(_hours)
  124.         new c_minutes = str_to_num(_minutes)
  125.         new c_seconds = str_to_num(_seconds)
  126.         new c_month = str_to_num(_month)
  127.         new c_day = str_to_num(_day)
  128.         new c_year = str_to_num(_year)
  129.  
  130.         static load_ungag_time[32]
  131.         static u_hours, u_minutes, u_seconds, u_month, u_day, u_year
  132.  
  133.         for(new i = 0; i < total_gags; i++) {
  134.             static data[GagData]
  135.             ArrayGetArray(g_array, i, data)
  136.  
  137.             if(data[gag_length] == 0) continue
  138.  
  139.             copy(load_ungag_time, sizeof(load_ungag_time) - 1, data[ungag_time])
  140.  
  141.             replace_all(load_ungag_time, sizeof(load_ungag_time) - 1, ":", " ")
  142.             replace_all(load_ungag_time, sizeof(load_ungag_time) - 1, "/", " ")
  143.  
  144.             parse(load_ungag_time,\
  145.                 _hours, sizeof(_hours) - 1,\
  146.                 _minutes, sizeof(_minutes) - 1,\
  147.                 _seconds, sizeof(_seconds) - 1,\
  148.                 _month, sizeof(_month) - 1,\
  149.                 _day, sizeof(_day) - 1,\
  150.                 _year, sizeof(_year) - 1
  151.                 )
  152.  
  153.             u_hours = str_to_num(_hours)
  154.             u_minutes = str_to_num(_minutes)
  155.             u_seconds = str_to_num(_seconds)
  156.             u_month = str_to_num(_month)
  157.             u_day = str_to_num(_day)
  158.             u_year = str_to_num(_year)
  159.  
  160.             if( u_year < c_year
  161.             || u_year == c_year && u_month < c_month
  162.             || u_year == c_year && u_month == c_month && u_day < c_day
  163.             || u_year == c_year && u_month == c_month && u_day == c_day && u_hours < c_hours
  164.             || u_year == c_year && u_month == c_month && u_day == c_day && u_hours == c_hours && u_minutes < c_minutes
  165.             || u_year == c_year && u_month == c_month && u_day == c_day && u_hours == c_hours && u_minutes == c_minutes && u_seconds <= c_seconds ) {
  166.                 #if defined USE_COLOR_CHAT
  167.                     ColorChat(0, RED, "%L", LANG_PLAYER, "GAG_EXPIRED", data[gag_name], data[gag_steamid], data[gag_reason])
  168.                 #else
  169.                     NoColorChat(0, "%L", LANG_PLAYER, "GAG_EXPIRED", data[gag_name], data[gag_steamid], data[gag_reason])
  170.                 #endif
  171.  
  172.                 RemoveGag(i, data[gag_steamid])
  173.  
  174.                 i--
  175.             }
  176.         }
  177.     }
  178.  
  179.     entity_set_float(g_ungag_entity, EV_FL_nextthink, get_gametime() + get_pcvar_float(gag_ungagcheck))
  180. }
  181.  
  182. public concmd_gag_authid(id, level, cid) {
  183.     if(!cmd_access(id, level, cid, 4)) return PLUGIN_HANDLED
  184.  
  185.     static arg[128]
  186.     read_argv(1, arg, sizeof(arg) - 1)
  187.  
  188.     new target = cmd_target(id, arg, GetTargetFlags(id))
  189.     if(!target) return PLUGIN_HANDLED
  190.  
  191.     static target_authid[35]
  192.     get_user_authid(target, target_authid, sizeof(target_authid) - 1)
  193.  
  194.     if(TrieKeyExists(g_trie, target_authid)) {
  195.         console_print(id, "%L", id, "ALREADY_GAGGED_STEAMID", target_authid)
  196.         return PLUGIN_HANDLED
  197.     }
  198.  
  199.     read_argv(2, arg, sizeof(arg) - 1)
  200.     new Float:length = str_to_float(arg)
  201.  
  202.     static ungag_time2[64], gag_time2[64]
  203.  
  204.     if(length == 0.0) formatex(ungag_time2, sizeof(ungag_time2) - 1, "%L", id, "PERMANENT_GAG")
  205.     else GenerateUnGagTime(length, ungag_time2, sizeof(ungag_time2) - 1)
  206.  
  207.     read_argv(3, arg, sizeof(arg) - 1)
  208.  
  209.     static admin_name[64], target_name[32]
  210.     get_user_name(id, admin_name, sizeof(admin_name) - 1)
  211.     get_user_name(target, target_name, sizeof(target_name) - 1)
  212.  
  213.     static admin_authid[35]
  214.     get_user_authid(id, admin_authid, sizeof(admin_authid) - 1)
  215.  
  216.     GagAdd(target_name, target_authid, arg, floatround(length * 60.0, floatround_floor), ungag_time2)
  217.  
  218.     GetGagTime(id, length, gag_time2, sizeof(gag_time2) - 1)
  219.  
  220.     #if defined USE_COLOR_CHAT
  221.         ColorChat(0, RED, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, arg, gag_time2, ungag_time2)
  222.     #else
  223.         NoColorChat(0, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, arg, gag_time2, ungag_time2)
  224.     #endif
  225.  
  226.     return PLUGIN_HANDLED
  227. }
  228.  
  229. public concmd_gag_ip(id, level, cid) {
  230.     if(!cmd_access(id, level, cid, 4)) return PLUGIN_HANDLED
  231.  
  232.     static arg[128]
  233.     read_argv(1, arg, sizeof(arg) - 1)
  234.  
  235.     new target = cmd_target(id, arg, GetTargetFlags(id))
  236.     if(!target) return PLUGIN_HANDLED
  237.  
  238.     static target_ip[35]
  239.     get_user_ip(target, target_ip, sizeof(target_ip) - 1, 1)
  240.  
  241.     if(TrieKeyExists(g_trie, target_ip)) {
  242.         console_print(id, "%L", id, "ALREADY_GAGGED_IP", target_ip)
  243.         return PLUGIN_HANDLED
  244.     }
  245.  
  246.     read_argv(2, arg, sizeof(arg) - 1)
  247.     new Float:length = str_to_float(arg)
  248.  
  249.     static ungag_time2[64], gag_time2[64]
  250.  
  251.     if(length == 0.0) formatex(ungag_time2, sizeof(ungag_time2) - 1, "%L", id, "PERMANENT_GAG")
  252.     else GenerateUnGagTime(length, ungag_time2, sizeof(ungag_time2) - 1)
  253.  
  254.     read_argv(3, arg, sizeof(arg) - 1)
  255.  
  256.     static admin_name[64], target_name[32]
  257.     get_user_name(id, admin_name, sizeof(admin_name) - 1)
  258.     get_user_name(target, target_name, sizeof(target_name) - 1)
  259.  
  260.     static admin_authid[35]
  261.     get_user_authid(id, admin_authid, sizeof(admin_authid) - 1)
  262.  
  263.     GagAdd(target_name, target_ip, arg, floatround(length * 60.0, floatround_floor), ungag_time2)
  264.  
  265.     GetGagTime(id, length, gag_time2, sizeof(gag_time2) - 1)
  266.  
  267.     #if defined USE_COLOR_CHAT
  268.         ColorChat(0, RED, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, arg, gag_time2, ungag_time2)
  269.     #else
  270.         NoColorChat(0, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, arg, gag_time2, ungag_time2)
  271.     #endif
  272.  
  273.     return PLUGIN_HANDLED
  274. }
  275.  
  276. public concmd_gag_add(id, level, cid) {
  277.     if(!cmd_access(id, level, cid, 5)) return PLUGIN_HANDLED
  278.  
  279.     static target_name[128], target_authid[128], gagtime[128], reason[128]
  280.     read_argv(1, target_name, sizeof(target_name) - 1)
  281.     read_argv(2, target_authid, sizeof(target_authid) - 1)
  282.     read_argv(3, gagtime, sizeof(gagtime) - 1)
  283.     read_argv(4, reason, sizeof(reason) - 1)
  284.  
  285.     new bool:is_ip = bool:(containi(target_authid, ".") != -1)
  286.  
  287.     if(TrieKeyExists(g_trie, target_authid)) {
  288.         console_print(id, "%L", id, is_ip ? "ALREADY_GAGGED_IP" : "ALREADY_GAGGED_STEAMID", target_authid)
  289.         return PLUGIN_HANDLED
  290.     }
  291.  
  292.     new Float:length = str_to_float(gagtime)
  293.     static ungag_time2[64], gag_time2[64]
  294.  
  295.     if(length == 0.0) formatex(ungag_time2, sizeof(ungag_time2) - 1, "%L", id, "PERMANENT_GAG")
  296.     else GenerateUnGagTime(length, ungag_time2, sizeof(ungag_time2) - 1)
  297.  
  298.     static admin_name[64]
  299.     get_user_name(id, admin_name, sizeof(admin_name) - 1)
  300.  
  301.     static admin_authid[35]
  302.     get_user_authid(id, admin_authid, sizeof(admin_authid) - 1)
  303.  
  304.     GagAdd(target_name, target_authid, reason, floatround(length * 60.0, floatround_floor), ungag_time2)
  305.  
  306.     GetGagTime(id, length, gag_time2, sizeof(gag_time2) - 1)
  307.  
  308.     #if defined USE_COLOR_CHAT
  309.         ColorChat(0, RED, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, reason, gag_time2, ungag_time2)
  310.     #else
  311.         NoColorChat(0, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, reason, gag_time2, ungag_time2)
  312.     #endif
  313.  
  314.     return PLUGIN_HANDLED
  315. }  
  316.  
  317. public concmd_ungag(id, level, cid) {
  318.     if(!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED
  319.  
  320.     static arg[35]
  321.     read_argv(1, arg, sizeof(arg) - 1)
  322.  
  323.     if(TrieKeyExists(g_trie, arg)) {
  324.         static array_pos;
  325.         TrieGetCell(g_trie, arg, array_pos);
  326.  
  327.         static data[GagData]
  328.         ArrayGetArray(g_array, array_pos, data)
  329.  
  330.         static admin_name[64]
  331.         get_user_name(id, admin_name, sizeof(admin_name) - 1)
  332.  
  333.         static authid[35]
  334.         get_user_authid(id, authid, sizeof(authid) - 1)
  335.  
  336.         #if defined USE_COLOR_CHAT
  337.             ColorChat(0, RED, "%L", LANG_PLAYER, "UNGAG_PLAYER", admin_name, authid, data[gag_name], data[gag_steamid], data[gag_reason])
  338.         #else
  339.             NoColorChat(0, "%L", LANG_PLAYER, "UNGAG_PLAYER", admin_name, authid, data[gag_name], data[gag_steamid], data[gag_reason])
  340.         #endif
  341.  
  342.         RemoveGag(array_pos, data[gag_steamid])
  343.  
  344.         return PLUGIN_HANDLED
  345.     }
  346.  
  347.     console_print(id, "%L", id, "NOT_IN_GAG_LIST", arg)
  348.  
  349.     return PLUGIN_HANDLED
  350. }
  351.  
  352. public concmd_gag_list(id, level, cid) {
  353.     if(!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED
  354.  
  355.     if(!total_gags) {
  356.         console_print(id, "%L", id, "NO_GAGS")
  357.         return PLUGIN_HANDLED;
  358.     }
  359.  
  360.     static start
  361.     if(read_argc() > 1) {
  362.         static arg[5]
  363.         read_argv(1, arg, sizeof(arg) - 1)
  364.  
  365.         start = min(str_to_num(arg), total_gags) - 1
  366.     }
  367.  
  368.     else start = 0
  369.  
  370.     new last = min(start + 10, total_gags)
  371.  
  372.     if(id == 0) server_cmd("echo ^"%L^"", id, "GAG_LIST_NUM", start + 1, last)
  373.     else console_print(id, "%L", id, "GAG_LIST_NUM", start + 1, last)
  374.  
  375.     for(new i = start; i < last; i++) {
  376.         static data[GagData]
  377.         ArrayGetArray(g_array, i, data)
  378.  
  379.         PrintGagInfosToConsole(id, data[gag_name], data[gag_steamid], data[gag_length], data[gag_reason], data[ungag_time])
  380.     }
  381.  
  382.     if(++last < total_gags) {
  383.         if(id == 0) server_cmd("echo ^"%L^"", id, "GAG_LIST_NEXT", last)
  384.         else console_print(id, "%L", id, "GAG_LIST_NEXT", last)
  385.     }
  386.  
  387.     return PLUGIN_HANDLED
  388. }  
  389.  
  390. public gag_menu(id) {
  391.     if(!(get_user_flags(id) & GAG_FLAG))
  392.         return PLUGIN_HANDLED
  393.  
  394.     new menu_line[64], menu_newline[64], id_data[64]
  395.     format(menu_line, charsmax(menu_line), "\w%L^n%L", id, "GAG_MENU1", id, "GAG_MENU2")
  396.  
  397.     new menu = menu_create(menu_line, "gag_menu_handler")
  398.  
  399.     new players[32], name[32], num
  400.     get_players(players, num, "c")
  401.  
  402.     for(new i = 0; i <num; i++) {
  403.         new pid = players[i]
  404.         get_user_name(pid, name, 31)
  405.         num_to_str(pid, id_data, sizeof(id_data))
  406.  
  407.         format(menu_newline, charsmax(menu_newline), "%s", name)
  408.         menu_additem(menu, menu_newline, id_data, 0)
  409.     }
  410.  
  411.     menu_display(id, menu, 0)
  412.     return PLUGIN_CONTINUE
  413. }
  414.  
  415. public ungag_menu(id) {
  416.     if(!(get_user_flags(id) & GAG_FLAG))
  417.         return PLUGIN_HANDLED
  418.  
  419.     if(!total_gags) {
  420.         #if defined USE_COLOR_CHAT
  421.             ColorChat(id, RED, "%L", id, "NO_GAGS")
  422.         #else
  423.             client_print(id, print_chat, "%L", id, "NO_GAGS")
  424.         #endif
  425.  
  426.         return PLUGIN_HANDLED
  427.     }
  428.  
  429.     new menu_line[99], menu_newline[99]
  430.     format(menu_line, charsmax(menu_line), "\w%L^n%L", id, "GAG_MENU3", id, "GAG_MENU4")
  431.  
  432.     new menu = menu_create(menu_line, "ungag_menu_handler")
  433.  
  434.     for(new i = 0; i < total_gags; i++) {
  435.         static data[GagData]
  436.         ArrayGetArray(g_array, i, data)
  437.  
  438.         format(menu_newline, charsmax(menu_newline), "\r%s \w[%s]", data[gag_steamid], data[gag_reason])
  439.         menu_additem(menu, menu_newline, data[gag_steamid], 0)
  440.     }
  441.  
  442.     menu_display(id, menu, 0)
  443.     return PLUGIN_CONTINUE
  444. }
  445.  
  446. public gag_menu_handler(id, menu, item) {
  447.     if(item == MENU_EXIT) {
  448.         menu_destroy(menu)
  449.         return PLUGIN_HANDLED
  450.     }
  451.  
  452.     new data[64], szName[64]
  453.     new access, callback
  454.     menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback)
  455.  
  456.     tempid[id] = str_to_num(data)
  457.  
  458.     static authid[35]
  459.     get_user_authid(tempid[id], authid, sizeof(authid) - 1)
  460.  
  461.     static ip[35]
  462.     get_user_ip(tempid[id], ip, sizeof(ip) - 1, 1)
  463.     static array_pos   
  464.  
  465.     if(get_user_flags(tempid[id]) & GAG_IMMUNITY) {
  466.         #if defined USE_COLOR_CHAT
  467.             ColorChat(id, RED, "%L", id, "PLAYER_IMMUNITY")
  468.         #else
  469.             NoColorChat(id, "%L", id, "PLAYER_IMMUNITY")
  470.         #endif
  471.  
  472.         gag_menu(id)
  473.  
  474.         return PLUGIN_HANDLED
  475.     }
  476.  
  477.     else if(TrieGetCell(g_trie, authid, array_pos) || TrieGetCell(g_trie, ip, array_pos)) {
  478.         static data[GagData]
  479.         ArrayGetArray(g_array, array_pos, data)
  480.  
  481.         static gag_length2[64]
  482.         new Float:gag_len = float(data[gag_length]) / 60.0
  483.         GetGagTime(id, gag_len, gag_length2, sizeof(gag_length2) - 1)
  484.  
  485.         #if defined USE_COLOR_CHAT
  486.             ColorChat(id, RED, "%L", id, "PLAYER_GAGGED", data[gag_reason], gag_length2, data[ungag_time])
  487.         #else
  488.             NoColorChat(id, "%L", id, "PLAYER_GAGGED", data[gag_reason], gag_length2, data[ungag_time])
  489.         #endif
  490.  
  491.         return PLUGIN_HANDLED
  492.     }
  493.  
  494.     else {
  495.         #if defined USE_COLOR_CHAT
  496.             ColorChat(id, RED, "%L", id, "TYPE_TIME")
  497.         #else
  498.             NoColorChat(id, "%L", id, "TYPE_TIME")
  499.         #endif
  500.  
  501.         client_cmd(id, "messagemode GAG_TIME")
  502.     }
  503.  
  504.     return PLUGIN_CONTINUE
  505. }
  506.  
  507. public ungag_menu_handler(id, menu, item) {
  508.     if(item == MENU_EXIT) {
  509.         menu_destroy(menu)
  510.         return PLUGIN_HANDLED
  511.     }
  512.  
  513.     new data[64], szName[64]
  514.     new access, callback
  515.     menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback)
  516.  
  517.     client_cmd(id, "ungag ^"%s^"", data)
  518.  
  519.     return PLUGIN_CONTINUE
  520. }
  521.  
  522. public clcmd_time(id) {
  523.     if(!(get_user_flags(id) & GAG_FLAG))
  524.         return PLUGIN_HANDLED
  525.  
  526.     new gag_times[33][100]
  527.     read_args(gag_times[id], 99)
  528.     remove_quotes(gag_times[id])
  529.  
  530.     get_gag_time[id] = str_to_float(gag_times[id])
  531.  
  532.     #if defined USE_COLOR_CHAT
  533.         ColorChat(id, RED, "%L", id, "TYPE_REASON")
  534.     #else
  535.         NoColorChat(id, "%L", id, "TYPE_REASON")
  536.     #endif
  537.  
  538.     client_cmd(id, "messagemode GAG_REASON")
  539.  
  540.     return PLUGIN_HANDLED
  541. }
  542.  
  543. public clcmd_reason(id) {
  544.     if(!(get_user_flags(id) & GAG_FLAG))
  545.         return PLUGIN_HANDLED
  546.  
  547.     new get_gag_reason[33][100]
  548.     read_args(get_gag_reason[id], 99)
  549.     remove_quotes(get_gag_reason[id])
  550.  
  551.     static target_name[32]
  552.     get_user_name(tempid[id], target_name, sizeof(target_name) - 1)
  553.  
  554.     if(is_user_steam(tempid[id])) client_cmd(id, "gag_authid ^"%s^" ^"%f^" ^"%s^"", target_name, get_gag_time[id], get_gag_reason[id])
  555.     else client_cmd(id, "gag_ip ^"%s^" ^"%f^" ^"%s^"", target_name, get_gag_time[id], get_gag_reason[id])
  556.  
  557.     return PLUGIN_HANDLED
  558. }
  559.  
  560. public gag_say(id) {
  561.     static authid[35]
  562.     get_user_authid(id, authid, sizeof(authid) - 1)
  563.  
  564.     static ip[35]
  565.     get_user_ip(id, ip, sizeof(ip) - 1, 1)
  566.  
  567.     static array_pos   
  568.     if(TrieGetCell(g_trie, authid, array_pos) || TrieGetCell(g_trie, ip, array_pos)) {
  569.         static data[GagData]
  570.         ArrayGetArray(g_array, array_pos, data)
  571.  
  572.         static gag_length2[64]
  573.         new Float:gag_len = float(data[gag_length]) / 60.0
  574.         GetGagTime(id, gag_len, gag_length2, sizeof(gag_length2) - 1)
  575.  
  576.         #if defined USE_COLOR_CHAT
  577.             ColorChat(id, RED, "%L", id, "YOU_GAGGED", data[gag_reason], gag_length2, data[ungag_time])
  578.         #else
  579.             NoColorChat(id, "%L", id, "YOU_GAGGED", data[gag_reason], gag_length2, data[ungag_time])
  580.         #endif
  581.  
  582.         return PLUGIN_HANDLED
  583.     }
  584.  
  585.     return PLUGIN_CONTINUE
  586. }
  587.  
  588. public PrintGagInfosToConsole(index, const target_name[], const target_steamid[], const target_length, const target_reason[], const target_ungag_time[]) {
  589.     static gag_length2[64]
  590.     new bool:is_ip = bool:(containi(target_steamid, ".") != -1)
  591.  
  592.     if(index == 0) {
  593.         server_print("************************************************")
  594.         server_print("%L", index, "GAG_INFORMATION")
  595.         server_print("%L: %s", index, "GAG_NAME", target_name)
  596.         server_print("%L: %s", index, !is_ip ? "GAG_STEAMID" : "GAG_IP", target_steamid)
  597.         server_print("%L: %s", index, "GAG_REASON", target_reason)
  598.         if(target_length > 0) {
  599.             new Float:gag_len = float(target_length) / 60.0
  600.             GetGagTime(index, gag_len, gag_length2, sizeof(gag_length2) - 1)
  601.  
  602.             server_print("%L: %s", index, "GAG_TIME", gag_length2)
  603.         }
  604.         server_print("%L: %s", index, "UNGAG_TIME", target_ungag_time)
  605.         server_print("************************************************")
  606.     }
  607.  
  608.     else {
  609.         console_print(index, "************************************************")
  610.         console_print(index, "%L", index, "GAG_INFORMATION")
  611.         console_print(index, "%L: %s", index, "GAG_NAME", target_name)
  612.         console_print(index, "%L: %s", index, !is_ip ? "GAG_STEAMID" : "GAG_IP", target_steamid)
  613.         console_print(index, "%L: %s", index, "GAG_REASON", target_reason)
  614.         if(target_length > 0) {
  615.             new Float:gag_len = float(target_length) / 60.0
  616.             GetGagTime(index, gag_len, gag_length2, sizeof(gag_length2) - 1)
  617.  
  618.             console_print(index, "%L: %s", index, "GAG_TIME", gag_length2)
  619.         }
  620.         console_print(index, "%L: %s", index, "UNGAG_TIME", target_ungag_time)
  621.         console_print(index, "************************************************")
  622.     }
  623. }
  624.  
  625. public LoadGags() {
  626.     if(total_gags) {
  627.         TrieClear(g_trie)
  628.         ArrayClear(g_array)
  629.         total_gags = 0
  630.     }
  631.  
  632.     if(file_exists(gag_file)) {
  633.         new f = fopen(gag_file, "rt")
  634.         static filedata[512], length[10]
  635.  
  636.         static data[GagData]
  637.         while(!feof(f)){
  638.             fgets(f, filedata, sizeof(filedata) - 1)
  639.  
  640.             if(!filedata[0]) continue
  641.  
  642.             parse(filedata,\
  643.                 data[gag_steamid], sizeof(data[gag_steamid]) - 1,\
  644.                 data[gag_name], sizeof(data[gag_name]) - 1,\
  645.                 length, sizeof(length) - 1,\
  646.                 data[ungag_time], sizeof(data[ungag_time]) - 1,\
  647.                 data[gag_reason], sizeof(data[gag_reason]) - 1
  648.                 )
  649.  
  650.             data[gag_length] = str_to_num(length)
  651.  
  652.             ArrayPushArray(g_array, data)
  653.             TrieSetCell(g_trie, data[gag_steamid], total_gags)
  654.  
  655.             total_gags++
  656.         }
  657.  
  658.         fclose(f)
  659.     }
  660. }
  661.  
  662. public RemoveGag(pos, const authid[]) {
  663.     TrieDeleteKey(g_trie, authid)
  664.     ArrayDeleteItem(g_array, pos)
  665.  
  666.     total_gags--
  667.  
  668.     new f = fopen(gag_file, "wt")
  669.     new data[GagData]
  670.  
  671.     for(new i = 0; i < total_gags; i++ ) {
  672.         ArrayGetArray(g_array, i, data)
  673.         TrieSetCell(g_trie, data[gag_steamid], i)
  674.  
  675.         fprintf(f, "^"%s^" ^"%s^" %i ^"%s^" ^"%s^"^n",\
  676.             data[gag_steamid],\
  677.             data[gag_name],\
  678.             data[gag_length],\
  679.             data[ungag_time],\
  680.             data[gag_reason]
  681.             )
  682.     }
  683.  
  684.     fclose(f)
  685. }
  686.  
  687. public GagAdd(const target_name[], const target_steamid[], const reason[], const length, const ungag_time3[]) {
  688.     new f = fopen(gag_file, "a+")
  689.  
  690.     fprintf(f, "^"%s^" ^"%s^" %i ^"%s^" ^"%s^"^n",\
  691.         target_steamid,\
  692.         target_name,\
  693.         length,\
  694.         ungag_time3,\
  695.         reason
  696.         )
  697.  
  698.     fclose(f)
  699.  
  700.     static data[GagData]
  701.     copy(data[gag_name], sizeof(data[gag_name]) - 1, target_name)
  702.     copy(data[gag_steamid], sizeof(data[gag_steamid]) - 1, target_steamid)
  703.     data[gag_length] = length
  704.     copy(data[ungag_time], sizeof(data[ungag_time]) - 1, ungag_time3)
  705.     copy(data[gag_reason], sizeof(data[gag_reason]) - 1, reason)
  706.  
  707.     TrieSetCell(g_trie, target_steamid, total_gags)
  708.     ArrayPushArray(g_array, data)
  709.  
  710.     total_gags++
  711. }
  712.  
  713. GetGagTime(index, Float:gagtime, length[], len) {
  714.     new minutes = floatround(gagtime, floatround_floor)
  715.     new seconds = floatround(floatfract(gagtime) * 60, floatround_floor)
  716.     new hours = 0
  717.     new days = 0
  718.  
  719.     while(minutes >= 60) {
  720.         minutes -= 60
  721.         hours++
  722.     }
  723.  
  724.     while(hours >= 24) {
  725.         hours -= 24
  726.         days++
  727.     }
  728.  
  729.     new bool:add_before
  730.     if(seconds) {
  731.         formatex(length, len, "%i %L", seconds, index, "GAG_SECONDS")  
  732.         add_before = true
  733.     }
  734.  
  735.     if(minutes) {
  736.         if(add_before) format(length, len, "%i %L, %s", minutes, index, "GAG_MINUTES", length)
  737.  
  738.         else{
  739.             formatex(length, len, "%i %L", minutes, index, "GAG_MINUTES")          
  740.             add_before = true
  741.         }
  742.     }
  743.  
  744.     if(hours) {
  745.         if(add_before) format(length, len, "%i %L, %s", hours, index, "GAG_HOURS", length)
  746.  
  747.         else{
  748.             formatex(length, len, "%i %L", hours, index, "GAG_HOURS")          
  749.             add_before = true
  750.         }
  751.     }
  752.  
  753.     if(days) {
  754.         if(add_before) format(length, len, "%i %L, %s", days, index, "GAG_DAYS", length)
  755.  
  756.         else {
  757.             formatex(length, len, "%i %L", days, index, "GAG_DAYS")        
  758.             add_before = true
  759.         }
  760.     }
  761.  
  762.     if(!add_before) formatex(length, len, "%L", index, "PERMANENT_GAG")
  763. }
  764.  
  765. GetTargetFlags(index) {
  766.     static const flags_no_immunity = (CMDTARGET_ALLOW_SELF|CMDTARGET_NO_BOTS)
  767.     static const flags_immunity = (CMDTARGET_ALLOW_SELF|CMDTARGET_NO_BOTS|CMDTARGET_OBEY_IMMUNITY)
  768.  
  769.     switch(get_pcvar_num(gag_immunity)) {
  770.         case 1: return flags_immunity
  771.         case 2: return access(index, GAG_IMMUNITY) ? flags_no_immunity : flags_immunity
  772.     }
  773.  
  774.     return flags_no_immunity
  775. }
  776.  
  777. GenerateUnGagTime(const Float:input, output[], const len) {
  778.     static _hours[5], _minutes[5], _seconds[5], _month[5], _day[5], _year[7]
  779.     format_time(_hours, sizeof(_hours) - 1, "%H")
  780.     format_time(_minutes, sizeof(_minutes) - 1, "%M")
  781.     format_time(_seconds, sizeof(_seconds) - 1, "%S")
  782.     format_time(_month, sizeof(_month) - 1, "%m")
  783.     format_time(_day, sizeof(_day) - 1, "%d")
  784.     format_time(_year, sizeof(_year) - 1, "%Y")
  785.  
  786.     new hours = str_to_num(_hours)
  787.     new month = str_to_num(_month)
  788.     new day = str_to_num(_day)
  789.     new year = str_to_num(_year)
  790.  
  791.     new minutes = floatround(input, floatround_floor) + str_to_num(_minutes)
  792.     new seconds = floatround(floatfract(input) * 60, floatround_floor)
  793.  
  794.     while(minutes >= 60) {
  795.         minutes -= 60
  796.         hours++
  797.     }
  798.  
  799.     while(hours >= 24) {
  800.         hours -= 24
  801.         day++
  802.     }
  803.  
  804.     new max_days = GetDaysInMonth(month, year)
  805.     while(day > max_days) {
  806.         day -= max_days
  807.         month++
  808.     }
  809.  
  810.     while(month > 12) {
  811.         month -= 12
  812.         year++
  813.     }
  814.  
  815.     seconds += str_to_num(_seconds)
  816.     if(seconds > 59) {
  817.         seconds -= 60
  818.         if(minutes < 59) minutes++
  819.  
  820.         else {
  821.             minutes = 0
  822.             if(hours < 23) hours++
  823.  
  824.             else {
  825.                 hours = 0
  826.                 if(day < max_days) day++
  827.  
  828.                 else {
  829.                     day = 1
  830.                     if(month < 12) month++
  831.  
  832.                     else {
  833.                         month = 1
  834.                         year++
  835.                     }
  836.                 }
  837.             }
  838.         }
  839.     }  
  840.  
  841.     formatex(output, len, "%i:%02i:%02i %i/%i/%i", hours, minutes, seconds, month, day, year)
  842. }
  843.  
  844. GetDaysInMonth(month, year=0) {
  845.     switch(month) {
  846.         case 1: return 31 // January
  847.         case 2: return ((year % 4) == 0) ? 29 : 28 // February
  848.         case 3: return 31; // March
  849.         case 4: return 30; // April
  850.         case 5: return 31; // May
  851.         case 6: return 30; // June
  852.         case 7: return 31; // July
  853.         case 8: return 31; // August
  854.         case 9: return 30; // September
  855.         case 10: return 31; // October
  856.         case 11: return 30; // November
  857.         case 12: return 31; // December
  858.     }
  859.  
  860.     return 30
  861. }
  862.  
  863. stock NoColorChat(const id, const input[], any:...) {
  864.     new count = 1, players[32], i
  865.     static msg[191]
  866.     vformat(msg, 190, input, 3)
  867.  
  868.     replace_all(msg, 190, "!g", "")
  869.     replace_all(msg, 190, "!n", "")
  870.     replace_all(msg, 190, "!t", "")
  871.  
  872.     if(id)players[0] = id; else get_players(players, count, "ch")
  873.  
  874.     for(i = 0; i < count; i++) {
  875.         if(is_user_connected(players[i])) {
  876.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  877.             write_byte(players[i])
  878.             write_string(msg)
  879.             message_end()
  880.         }
  881.     }
  882. }
  883.  
  884. stock is_user_steam(id) {
  885.         new g_Steam[32]
  886.         get_user_authid(id, g_Steam, charsmax(g_Steam))
  887.  
  888.         return bool:('0' <= g_Steam[8] <= '1')
  889. }

_________________
„Nem azért felejtünk el játszani, mert megöregszünk, hanem attól öregszünk meg, hogy elfelejtünk játszani.”

-MAXHACKED Website-
-HERViD Website-
► Spoiler mutatása


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Grab+
HozzászólásElküldve: 2016.02.13. 17:10 
Offline
Félisten
Avatar

Csatlakozott: 2015.03.12. 18:30
Hozzászólások: 975
Megköszönt másnak: 67 alkalommal
Megköszönték neki: 136 alkalommal
L jog= rcon

  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4.  
  5. #define PLUGIN "ADMIN Gag"
  6. #define VERSION "1.0.1"
  7. #define AUTHOR "RaZzoR"
  8.  
  9. #define GAG_FLAG ADMIN_RCON
  10. #define GAG_IMMUNITY ADMIN_IMMUNITY
  11.  
  12. #define DICTIONARY "admin_gag.txt"
  13. #define USE_COLOR_CHAT
  14.  
  15. #if defined USE_COLOR_CHAT
  16.     #include <colorchat>
  17. #endif
  18.  
  19. new const gag_file_name[] = "gagged_users.txt"
  20.  
  21. enum _:GagData {
  22.     gag_name[32],
  23.     gag_steamid[35],
  24.     gag_length,
  25.     ungag_time[32],
  26.     gag_reason[128]
  27. }
  28.  
  29. new Trie:g_trie
  30. new Array:g_array
  31. new total_gags, g_ungag_entity
  32. new gag_file[64], Float:get_gag_time[33], tempid[33]
  33.  
  34. new gag_immunity, gag_ungagcheck
  35.  
  36. public plugin_init() {
  37.     register_plugin(PLUGIN, VERSION, AUTHOR)
  38.  
  39.     #if defined USE_COLOR_CHAT
  40.         register_dictionary_colored(DICTIONARY)
  41.     #else
  42.         register_dictionary(DICTIONARY)
  43.     #endif
  44.  
  45.     gag_immunity = register_cvar("gag_immunity", "1")
  46.     gag_ungagcheck = register_cvar("gag_ungagcheck", "1.0")
  47.  
  48.     register_clcmd("say /gag_menu", "gag_menu")
  49.     register_clcmd("say /ungag_menu", "ungag_menu")
  50.  
  51.     register_clcmd("say", "gag_say")
  52.     register_clcmd("say_team", "gag_say")  
  53.  
  54.     register_clcmd("GAG_TIME", "clcmd_time")
  55.     register_clcmd("GAG_REASON", "clcmd_reason")
  56.  
  57.     register_concmd("gag_authid", "concmd_gag_authid", GAG_FLAG, "<nev, #userid, authid> <ido percben> <ok>")
  58.     register_concmd("gag_ip", "concmd_gag_ip", GAG_FLAG, "<nev, #userid, authid> <ido percben> <ok>")
  59.     register_concmd("gag_add", "concmd_gag_add", GAG_FLAG, "<nev> <authid vagy ip> <ido percben> <ok>")
  60.     register_concmd("gag_list", "concmd_gag_list", GAG_FLAG, "[start] -- megmutat minden nemitast")
  61.     register_concmd("ungag", "concmd_ungag", GAG_FLAG, "<authid vagy ip>")
  62.  
  63.     get_datadir(gag_file, sizeof(gag_file) - 1)
  64.     format(gag_file, sizeof(gag_file) - 1, "%s/%s", gag_file, gag_file_name)
  65.  
  66.     g_trie = TrieCreate()
  67.     g_array = ArrayCreate(GagData)
  68.  
  69.     LoadGags()
  70. }
  71.  
  72. public plugin_cfg() create_ungag_entity()
  73.  
  74. public client_PostThink(id) {
  75.     static authid[35]
  76.     get_user_authid(id, authid, sizeof(authid) - 1)
  77.  
  78.     static ip[35]
  79.     get_user_ip(id, ip, sizeof(ip) - 1, 1)
  80.  
  81.     static array_pos  
  82.     if(TrieGetCell(g_trie, authid, array_pos) || TrieGetCell(g_trie, ip, array_pos)) set_speak(id, SPEAK_MUTED)
  83.     else set_speak(id, SPEAK_LISTENALL)
  84. }
  85.  
  86. public create_ungag_entity() {
  87.     static failtimes
  88.  
  89.     g_ungag_entity = create_entity("info_target")
  90.  
  91.     if(!is_valid_ent(g_ungag_entity)) {
  92.         ++failtimes
  93.  
  94.         log_amx("%L", LANG_SERVER, "FAILED_TO_CREATE_UNGAG_ENTITY", failtimes)
  95.  
  96.         if(failtimes < 10) set_task(1.0, "create_ungag_entity")
  97.         else log_amx("%L", LANG_SERVER, "COULD_NOT_CREATE_UNGAG_ENTITY")
  98.  
  99.         return
  100.     }
  101.  
  102.     entity_set_string(g_ungag_entity, EV_SZ_classname, "ungag_entity")
  103.     entity_set_float(g_ungag_entity, EV_FL_nextthink, get_gametime() + 1.0)
  104.  
  105.     register_think("ungag_entity", "UnGag_Check")
  106. }
  107.  
  108. public UnGag_Check(entity)
  109. {
  110.     if(entity != g_ungag_entity) return
  111.  
  112.     if(total_gags > 0)
  113.     {
  114.         static _hours[5], _minutes[5], _seconds[5], _month[5], _day[5], _year[7]
  115.         format_time(_hours, sizeof(_hours) - 1, "%H")
  116.         format_time(_minutes, sizeof(_minutes) - 1, "%M")
  117.         format_time(_seconds, sizeof(_seconds) - 1, "%S")
  118.         format_time(_month, sizeof(_month) - 1, "%m")
  119.         format_time(_day, sizeof(_day) - 1, "%d")
  120.         format_time(_year, sizeof(_year) - 1, "%Y")
  121.  
  122.  
  123.         new c_hours = str_to_num(_hours)
  124.         new c_minutes = str_to_num(_minutes)
  125.         new c_seconds = str_to_num(_seconds)
  126.         new c_month = str_to_num(_month)
  127.         new c_day = str_to_num(_day)
  128.         new c_year = str_to_num(_year)
  129.  
  130.         static load_ungag_time[32]
  131.         static u_hours, u_minutes, u_seconds, u_month, u_day, u_year
  132.  
  133.         for(new i = 0; i < total_gags; i++) {
  134.             static data[GagData]
  135.             ArrayGetArray(g_array, i, data)
  136.  
  137.             if(data[gag_length] == 0) continue
  138.  
  139.             copy(load_ungag_time, sizeof(load_ungag_time) - 1, data[ungag_time])
  140.  
  141.             replace_all(load_ungag_time, sizeof(load_ungag_time) - 1, ":", " ")
  142.             replace_all(load_ungag_time, sizeof(load_ungag_time) - 1, "/", " ")
  143.  
  144.             parse(load_ungag_time,\
  145.                 _hours, sizeof(_hours) - 1,\
  146.                 _minutes, sizeof(_minutes) - 1,\
  147.                 _seconds, sizeof(_seconds) - 1,\
  148.                 _month, sizeof(_month) - 1,\
  149.                 _day, sizeof(_day) - 1,\
  150.                 _year, sizeof(_year) - 1
  151.                 )
  152.  
  153.             u_hours = str_to_num(_hours)
  154.             u_minutes = str_to_num(_minutes)
  155.             u_seconds = str_to_num(_seconds)
  156.             u_month = str_to_num(_month)
  157.             u_day = str_to_num(_day)
  158.             u_year = str_to_num(_year)
  159.  
  160.             if( u_year < c_year
  161.             || u_year == c_year && u_month < c_month
  162.             || u_year == c_year && u_month == c_month && u_day < c_day
  163.             || u_year == c_year && u_month == c_month && u_day == c_day && u_hours < c_hours
  164.             || u_year == c_year && u_month == c_month && u_day == c_day && u_hours == c_hours && u_minutes < c_minutes
  165.             || u_year == c_year && u_month == c_month && u_day == c_day && u_hours == c_hours && u_minutes == c_minutes && u_seconds <= c_seconds ) {
  166.                 #if defined USE_COLOR_CHAT
  167.                     ColorChat(0, RED, "%L", LANG_PLAYER, "GAG_EXPIRED", data[gag_name], data[gag_steamid], data[gag_reason])
  168.                 #else
  169.                     NoColorChat(0, "%L", LANG_PLAYER, "GAG_EXPIRED", data[gag_name], data[gag_steamid], data[gag_reason])
  170.                 #endif
  171.  
  172.                 RemoveGag(i, data[gag_steamid])
  173.  
  174.                 i--
  175.             }
  176.         }
  177.     }
  178.  
  179.     entity_set_float(g_ungag_entity, EV_FL_nextthink, get_gametime() + get_pcvar_float(gag_ungagcheck))
  180. }
  181.  
  182. public concmd_gag_authid(id, level, cid) {
  183.     if(!cmd_access(id, level, cid, 4)) return PLUGIN_HANDLED
  184.  
  185.     static arg[128]
  186.     read_argv(1, arg, sizeof(arg) - 1)
  187.  
  188.     new target = cmd_target(id, arg, GetTargetFlags(id))
  189.     if(!target) return PLUGIN_HANDLED
  190.  
  191.     static target_authid[35]
  192.     get_user_authid(target, target_authid, sizeof(target_authid) - 1)
  193.  
  194.     if(TrieKeyExists(g_trie, target_authid)) {
  195.         console_print(id, "%L", id, "ALREADY_GAGGED_STEAMID", target_authid)
  196.         return PLUGIN_HANDLED
  197.     }
  198.  
  199.     read_argv(2, arg, sizeof(arg) - 1)
  200.     new Float:length = str_to_float(arg)
  201.  
  202.     static ungag_time2[64], gag_time2[64]
  203.  
  204.     if(length == 0.0) formatex(ungag_time2, sizeof(ungag_time2) - 1, "%L", id, "PERMANENT_GAG")
  205.     else GenerateUnGagTime(length, ungag_time2, sizeof(ungag_time2) - 1)
  206.  
  207.     read_argv(3, arg, sizeof(arg) - 1)
  208.  
  209.     static admin_name[64], target_name[32]
  210.     get_user_name(id, admin_name, sizeof(admin_name) - 1)
  211.     get_user_name(target, target_name, sizeof(target_name) - 1)
  212.  
  213.     static admin_authid[35]
  214.     get_user_authid(id, admin_authid, sizeof(admin_authid) - 1)
  215.  
  216.     GagAdd(target_name, target_authid, arg, floatround(length * 60.0, floatround_floor), ungag_time2)
  217.  
  218.     GetGagTime(id, length, gag_time2, sizeof(gag_time2) - 1)
  219.  
  220.     #if defined USE_COLOR_CHAT
  221.         ColorChat(0, RED, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, arg, gag_time2, ungag_time2)
  222.     #else
  223.         NoColorChat(0, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, arg, gag_time2, ungag_time2)
  224.     #endif
  225.  
  226.     return PLUGIN_HANDLED
  227. }
  228.  
  229. public concmd_gag_ip(id, level, cid) {
  230.     if(!cmd_access(id, level, cid, 4)) return PLUGIN_HANDLED
  231.  
  232.     static arg[128]
  233.     read_argv(1, arg, sizeof(arg) - 1)
  234.  
  235.     new target = cmd_target(id, arg, GetTargetFlags(id))
  236.     if(!target) return PLUGIN_HANDLED
  237.  
  238.     static target_ip[35]
  239.     get_user_ip(target, target_ip, sizeof(target_ip) - 1, 1)
  240.  
  241.     if(TrieKeyExists(g_trie, target_ip)) {
  242.         console_print(id, "%L", id, "ALREADY_GAGGED_IP", target_ip)
  243.         return PLUGIN_HANDLED
  244.     }
  245.  
  246.     read_argv(2, arg, sizeof(arg) - 1)
  247.     new Float:length = str_to_float(arg)
  248.  
  249.     static ungag_time2[64], gag_time2[64]
  250.  
  251.     if(length == 0.0) formatex(ungag_time2, sizeof(ungag_time2) - 1, "%L", id, "PERMANENT_GAG")
  252.     else GenerateUnGagTime(length, ungag_time2, sizeof(ungag_time2) - 1)
  253.  
  254.     read_argv(3, arg, sizeof(arg) - 1)
  255.  
  256.     static admin_name[64], target_name[32]
  257.     get_user_name(id, admin_name, sizeof(admin_name) - 1)
  258.     get_user_name(target, target_name, sizeof(target_name) - 1)
  259.  
  260.     static admin_authid[35]
  261.     get_user_authid(id, admin_authid, sizeof(admin_authid) - 1)
  262.  
  263.     GagAdd(target_name, target_ip, arg, floatround(length * 60.0, floatround_floor), ungag_time2)
  264.  
  265.     GetGagTime(id, length, gag_time2, sizeof(gag_time2) - 1)
  266.  
  267.     #if defined USE_COLOR_CHAT
  268.         ColorChat(0, RED, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, arg, gag_time2, ungag_time2)
  269.     #else
  270.         NoColorChat(0, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, arg, gag_time2, ungag_time2)
  271.     #endif
  272.  
  273.     return PLUGIN_HANDLED
  274. }
  275.  
  276. public concmd_gag_add(id, level, cid) {
  277.     if(!cmd_access(id, level, cid, 5)) return PLUGIN_HANDLED
  278.  
  279.     static target_name[128], target_authid[128], gagtime[128], reason[128]
  280.     read_argv(1, target_name, sizeof(target_name) - 1)
  281.     read_argv(2, target_authid, sizeof(target_authid) - 1)
  282.     read_argv(3, gagtime, sizeof(gagtime) - 1)
  283.     read_argv(4, reason, sizeof(reason) - 1)
  284.  
  285.     new bool:is_ip = bool:(containi(target_authid, ".") != -1)
  286.  
  287.     if(TrieKeyExists(g_trie, target_authid)) {
  288.         console_print(id, "%L", id, is_ip ? "ALREADY_GAGGED_IP" : "ALREADY_GAGGED_STEAMID", target_authid)
  289.         return PLUGIN_HANDLED
  290.     }
  291.  
  292.     new Float:length = str_to_float(gagtime)
  293.     static ungag_time2[64], gag_time2[64]
  294.  
  295.     if(length == 0.0) formatex(ungag_time2, sizeof(ungag_time2) - 1, "%L", id, "PERMANENT_GAG")
  296.     else GenerateUnGagTime(length, ungag_time2, sizeof(ungag_time2) - 1)
  297.  
  298.     static admin_name[64]
  299.     get_user_name(id, admin_name, sizeof(admin_name) - 1)
  300.  
  301.     static admin_authid[35]
  302.     get_user_authid(id, admin_authid, sizeof(admin_authid) - 1)
  303.  
  304.     GagAdd(target_name, target_authid, reason, floatround(length * 60.0, floatround_floor), ungag_time2)
  305.  
  306.     GetGagTime(id, length, gag_time2, sizeof(gag_time2) - 1)
  307.  
  308.     #if defined USE_COLOR_CHAT
  309.         ColorChat(0, RED, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, reason, gag_time2, ungag_time2)
  310.     #else
  311.         NoColorChat(0, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, reason, gag_time2, ungag_time2)
  312.     #endif
  313.  
  314.     return PLUGIN_HANDLED
  315. }  
  316.  
  317. public concmd_ungag(id, level, cid) {
  318.     if(!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED
  319.  
  320.     static arg[35]
  321.     read_argv(1, arg, sizeof(arg) - 1)
  322.  
  323.     if(TrieKeyExists(g_trie, arg)) {
  324.         static array_pos;
  325.         TrieGetCell(g_trie, arg, array_pos);
  326.  
  327.         static data[GagData]
  328.         ArrayGetArray(g_array, array_pos, data)
  329.  
  330.         static admin_name[64]
  331.         get_user_name(id, admin_name, sizeof(admin_name) - 1)
  332.  
  333.         static authid[35]
  334.         get_user_authid(id, authid, sizeof(authid) - 1)
  335.  
  336.         #if defined USE_COLOR_CHAT
  337.             ColorChat(0, RED, "%L", LANG_PLAYER, "UNGAG_PLAYER", admin_name, authid, data[gag_name], data[gag_steamid], data[gag_reason])
  338.         #else
  339.             NoColorChat(0, "%L", LANG_PLAYER, "UNGAG_PLAYER", admin_name, authid, data[gag_name], data[gag_steamid], data[gag_reason])
  340.         #endif
  341.  
  342.         RemoveGag(array_pos, data[gag_steamid])
  343.  
  344.         return PLUGIN_HANDLED
  345.     }
  346.  
  347.     console_print(id, "%L", id, "NOT_IN_GAG_LIST", arg)
  348.  
  349.     return PLUGIN_HANDLED
  350. }
  351.  
  352. public concmd_gag_list(id, level, cid) {
  353.     if(!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED
  354.  
  355.     if(!total_gags) {
  356.         console_print(id, "%L", id, "NO_GAGS")
  357.         return PLUGIN_HANDLED;
  358.     }
  359.  
  360.     static start
  361.     if(read_argc() > 1) {
  362.         static arg[5]
  363.         read_argv(1, arg, sizeof(arg) - 1)
  364.  
  365.         start = min(str_to_num(arg), total_gags) - 1
  366.     }
  367.  
  368.     else start = 0
  369.  
  370.     new last = min(start + 10, total_gags)
  371.  
  372.     if(id == 0) server_cmd("echo ^"%L^"", id, "GAG_LIST_NUM", start + 1, last)
  373.     else console_print(id, "%L", id, "GAG_LIST_NUM", start + 1, last)
  374.  
  375.     for(new i = start; i < last; i++) {
  376.         static data[GagData]
  377.         ArrayGetArray(g_array, i, data)
  378.  
  379.         PrintGagInfosToConsole(id, data[gag_name], data[gag_steamid], data[gag_length], data[gag_reason], data[ungag_time])
  380.     }
  381.  
  382.     if(++last < total_gags) {
  383.         if(id == 0) server_cmd("echo ^"%L^"", id, "GAG_LIST_NEXT", last)
  384.         else console_print(id, "%L", id, "GAG_LIST_NEXT", last)
  385.     }
  386.  
  387.     return PLUGIN_HANDLED
  388. }  
  389.  
  390. public gag_menu(id) {
  391.     if(!(get_user_flags(id) & GAG_FLAG))
  392.         return PLUGIN_HANDLED
  393.  
  394.     new menu_line[64], menu_newline[64], id_data[64]
  395.     format(menu_line, charsmax(menu_line), "\w%L^n%L", id, "GAG_MENU1", id, "GAG_MENU2")
  396.  
  397.     new menu = menu_create(menu_line, "gag_menu_handler")
  398.  
  399.     new players[32], name[32], num
  400.     get_players(players, num, "c")
  401.  
  402.     for(new i = 0; i <num; i++) {
  403.         new pid = players[i]
  404.         get_user_name(pid, name, 31)
  405.         num_to_str(pid, id_data, sizeof(id_data))
  406.  
  407.         format(menu_newline, charsmax(menu_newline), "%s", name)
  408.         menu_additem(menu, menu_newline, id_data, 0)
  409.     }
  410.  
  411.     menu_display(id, menu, 0)
  412.     return PLUGIN_CONTINUE
  413. }
  414.  
  415. public ungag_menu(id) {
  416.     if(!(get_user_flags(id) & GAG_FLAG))
  417.         return PLUGIN_HANDLED
  418.  
  419.     if(!total_gags) {
  420.         #if defined USE_COLOR_CHAT
  421.             ColorChat(id, RED, "%L", id, "NO_GAGS")
  422.         #else
  423.             client_print(id, print_chat, "%L", id, "NO_GAGS")
  424.         #endif
  425.  
  426.         return PLUGIN_HANDLED
  427.     }
  428.  
  429.     new menu_line[99], menu_newline[99]
  430.     format(menu_line, charsmax(menu_line), "\w%L^n%L", id, "GAG_MENU3", id, "GAG_MENU4")
  431.  
  432.     new menu = menu_create(menu_line, "ungag_menu_handler")
  433.  
  434.     for(new i = 0; i < total_gags; i++) {
  435.         static data[GagData]
  436.         ArrayGetArray(g_array, i, data)
  437.  
  438.         format(menu_newline, charsmax(menu_newline), "\r%s \w[%s]", data[gag_steamid], data[gag_reason])
  439.         menu_additem(menu, menu_newline, data[gag_steamid], 0)
  440.     }
  441.  
  442.     menu_display(id, menu, 0)
  443.     return PLUGIN_CONTINUE
  444. }
  445.  
  446. public gag_menu_handler(id, menu, item) {
  447.     if(item == MENU_EXIT) {
  448.         menu_destroy(menu)
  449.         return PLUGIN_HANDLED
  450.     }
  451.  
  452.     new data[64], szName[64]
  453.     new access, callback
  454.     menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback)
  455.  
  456.     tempid[id] = str_to_num(data)
  457.  
  458.     static authid[35]
  459.     get_user_authid(tempid[id], authid, sizeof(authid) - 1)
  460.  
  461.     static ip[35]
  462.     get_user_ip(tempid[id], ip, sizeof(ip) - 1, 1)
  463.     static array_pos  
  464.  
  465.     if(get_user_flags(tempid[id]) & GAG_IMMUNITY) {
  466.         #if defined USE_COLOR_CHAT
  467.             ColorChat(id, RED, "%L", id, "PLAYER_IMMUNITY")
  468.         #else
  469.             NoColorChat(id, "%L", id, "PLAYER_IMMUNITY")
  470.         #endif
  471.  
  472.         gag_menu(id)
  473.  
  474.         return PLUGIN_HANDLED
  475.     }
  476.  
  477.     else if(TrieGetCell(g_trie, authid, array_pos) || TrieGetCell(g_trie, ip, array_pos)) {
  478.         static data[GagData]
  479.         ArrayGetArray(g_array, array_pos, data)
  480.  
  481.         static gag_length2[64]
  482.         new Float:gag_len = float(data[gag_length]) / 60.0
  483.         GetGagTime(id, gag_len, gag_length2, sizeof(gag_length2) - 1)
  484.  
  485.         #if defined USE_COLOR_CHAT
  486.             ColorChat(id, RED, "%L", id, "PLAYER_GAGGED", data[gag_reason], gag_length2, data[ungag_time])
  487.         #else
  488.             NoColorChat(id, "%L", id, "PLAYER_GAGGED", data[gag_reason], gag_length2, data[ungag_time])
  489.         #endif
  490.  
  491.         return PLUGIN_HANDLED
  492.     }
  493.  
  494.     else {
  495.         #if defined USE_COLOR_CHAT
  496.             ColorChat(id, RED, "%L", id, "TYPE_TIME")
  497.         #else
  498.             NoColorChat(id, "%L", id, "TYPE_TIME")
  499.         #endif
  500.  
  501.         client_cmd(id, "messagemode GAG_TIME")
  502.     }
  503.  
  504.     return PLUGIN_CONTINUE
  505. }
  506.  
  507. public ungag_menu_handler(id, menu, item) {
  508.     if(item == MENU_EXIT) {
  509.         menu_destroy(menu)
  510.         return PLUGIN_HANDLED
  511.     }
  512.  
  513.     new data[64], szName[64]
  514.     new access, callback
  515.     menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback)
  516.  
  517.     client_cmd(id, "ungag ^"%s^"", data)
  518.  
  519.     return PLUGIN_CONTINUE
  520. }
  521.  
  522. public clcmd_time(id) {
  523.     if(!(get_user_flags(id) & GAG_FLAG))
  524.         return PLUGIN_HANDLED
  525.  
  526.     new gag_times[33][100]
  527.     read_args(gag_times[id], 99)
  528.     remove_quotes(gag_times[id])
  529.  
  530.     get_gag_time[id] = str_to_float(gag_times[id])
  531.  
  532.     #if defined USE_COLOR_CHAT
  533.         ColorChat(id, RED, "%L", id, "TYPE_REASON")
  534.     #else
  535.         NoColorChat(id, "%L", id, "TYPE_REASON")
  536.     #endif
  537.  
  538.     client_cmd(id, "messagemode GAG_REASON")
  539.  
  540.     return PLUGIN_HANDLED
  541. }
  542.  
  543. public clcmd_reason(id) {
  544.     if(!(get_user_flags(id) & GAG_FLAG))
  545.         return PLUGIN_HANDLED
  546.  
  547.     new get_gag_reason[33][100]
  548.     read_args(get_gag_reason[id], 99)
  549.     remove_quotes(get_gag_reason[id])
  550.  
  551.     static target_name[32]
  552.     get_user_name(tempid[id], target_name, sizeof(target_name) - 1)
  553.  
  554.     if(is_user_steam(tempid[id])) client_cmd(id, "gag_authid ^"%s^" ^"%f^" ^"%s^"", target_name, get_gag_time[id], get_gag_reason[id])
  555.     else client_cmd(id, "gag_ip ^"%s^" ^"%f^" ^"%s^"", target_name, get_gag_time[id], get_gag_reason[id])
  556.  
  557.     return PLUGIN_HANDLED
  558. }
  559.  
  560. public gag_say(id) {
  561.     static authid[35]
  562.     get_user_authid(id, authid, sizeof(authid) - 1)
  563.  
  564.     static ip[35]
  565.     get_user_ip(id, ip, sizeof(ip) - 1, 1)
  566.  
  567.     static array_pos  
  568.     if(TrieGetCell(g_trie, authid, array_pos) || TrieGetCell(g_trie, ip, array_pos)) {
  569.         static data[GagData]
  570.         ArrayGetArray(g_array, array_pos, data)
  571.  
  572.         static gag_length2[64]
  573.         new Float:gag_len = float(data[gag_length]) / 60.0
  574.         GetGagTime(id, gag_len, gag_length2, sizeof(gag_length2) - 1)
  575.  
  576.         #if defined USE_COLOR_CHAT
  577.             ColorChat(id, RED, "%L", id, "YOU_GAGGED", data[gag_reason], gag_length2, data[ungag_time])
  578.         #else
  579.             NoColorChat(id, "%L", id, "YOU_GAGGED", data[gag_reason], gag_length2, data[ungag_time])
  580.         #endif
  581.  
  582.         return PLUGIN_HANDLED
  583.     }
  584.  
  585.     return PLUGIN_CONTINUE
  586. }
  587.  
  588. public PrintGagInfosToConsole(index, const target_name[], const target_steamid[], const target_length, const target_reason[], const target_ungag_time[]) {
  589.     static gag_length2[64]
  590.     new bool:is_ip = bool:(containi(target_steamid, ".") != -1)
  591.  
  592.     if(index == 0) {
  593.         server_print("************************************************")
  594.         server_print("%L", index, "GAG_INFORMATION")
  595.         server_print("%L: %s", index, "GAG_NAME", target_name)
  596.         server_print("%L: %s", index, !is_ip ? "GAG_STEAMID" : "GAG_IP", target_steamid)
  597.         server_print("%L: %s", index, "GAG_REASON", target_reason)
  598.         if(target_length > 0) {
  599.             new Float:gag_len = float(target_length) / 60.0
  600.             GetGagTime(index, gag_len, gag_length2, sizeof(gag_length2) - 1)
  601.  
  602.             server_print("%L: %s", index, "GAG_TIME", gag_length2)
  603.         }
  604.         server_print("%L: %s", index, "UNGAG_TIME", target_ungag_time)
  605.         server_print("************************************************")
  606.     }
  607.  
  608.     else {
  609.         console_print(index, "************************************************")
  610.         console_print(index, "%L", index, "GAG_INFORMATION")
  611.         console_print(index, "%L: %s", index, "GAG_NAME", target_name)
  612.         console_print(index, "%L: %s", index, !is_ip ? "GAG_STEAMID" : "GAG_IP", target_steamid)
  613.         console_print(index, "%L: %s", index, "GAG_REASON", target_reason)
  614.         if(target_length > 0) {
  615.             new Float:gag_len = float(target_length) / 60.0
  616.             GetGagTime(index, gag_len, gag_length2, sizeof(gag_length2) - 1)
  617.  
  618.             console_print(index, "%L: %s", index, "GAG_TIME", gag_length2)
  619.         }
  620.         console_print(index, "%L: %s", index, "UNGAG_TIME", target_ungag_time)
  621.         console_print(index, "************************************************")
  622.     }
  623. }
  624.  
  625. public LoadGags() {
  626.     if(total_gags) {
  627.         TrieClear(g_trie)
  628.         ArrayClear(g_array)
  629.         total_gags = 0
  630.     }
  631.  
  632.     if(file_exists(gag_file)) {
  633.         new f = fopen(gag_file, "rt")
  634.         static filedata[512], length[10]
  635.  
  636.         static data[GagData]
  637.         while(!feof(f)){
  638.             fgets(f, filedata, sizeof(filedata) - 1)
  639.  
  640.             if(!filedata[0]) continue
  641.  
  642.             parse(filedata,\
  643.                 data[gag_steamid], sizeof(data[gag_steamid]) - 1,\
  644.                 data[gag_name], sizeof(data[gag_name]) - 1,\
  645.                 length, sizeof(length) - 1,\
  646.                 data[ungag_time], sizeof(data[ungag_time]) - 1,\
  647.                 data[gag_reason], sizeof(data[gag_reason]) - 1
  648.                 )
  649.  
  650.             data[gag_length] = str_to_num(length)
  651.  
  652.             ArrayPushArray(g_array, data)
  653.             TrieSetCell(g_trie, data[gag_steamid], total_gags)
  654.  
  655.             total_gags++
  656.         }
  657.  
  658.         fclose(f)
  659.     }
  660. }
  661.  
  662. public RemoveGag(pos, const authid[]) {
  663.     TrieDeleteKey(g_trie, authid)
  664.     ArrayDeleteItem(g_array, pos)
  665.  
  666.     total_gags--
  667.  
  668.     new f = fopen(gag_file, "wt")
  669.     new data[GagData]
  670.  
  671.     for(new i = 0; i < total_gags; i++ ) {
  672.         ArrayGetArray(g_array, i, data)
  673.         TrieSetCell(g_trie, data[gag_steamid], i)
  674.  
  675.         fprintf(f, "^"%s^" ^"%s^" %i ^"%s^" ^"%s^"^n",\
  676.             data[gag_steamid],\
  677.             data[gag_name],\
  678.             data[gag_length],\
  679.             data[ungag_time],\
  680.             data[gag_reason]
  681.             )
  682.     }
  683.  
  684.     fclose(f)
  685. }
  686.  
  687. public GagAdd(const target_name[], const target_steamid[], const reason[], const length, const ungag_time3[]) {
  688.     new f = fopen(gag_file, "a+")
  689.  
  690.     fprintf(f, "^"%s^" ^"%s^" %i ^"%s^" ^"%s^"^n",\
  691.         target_steamid,\
  692.         target_name,\
  693.         length,\
  694.         ungag_time3,\
  695.         reason
  696.         )
  697.  
  698.     fclose(f)
  699.  
  700.     static data[GagData]
  701.     copy(data[gag_name], sizeof(data[gag_name]) - 1, target_name)
  702.     copy(data[gag_steamid], sizeof(data[gag_steamid]) - 1, target_steamid)
  703.     data[gag_length] = length
  704.     copy(data[ungag_time], sizeof(data[ungag_time]) - 1, ungag_time3)
  705.     copy(data[gag_reason], sizeof(data[gag_reason]) - 1, reason)
  706.  
  707.     TrieSetCell(g_trie, target_steamid, total_gags)
  708.     ArrayPushArray(g_array, data)
  709.  
  710.     total_gags++
  711. }
  712.  
  713. GetGagTime(index, Float:gagtime, length[], len) {
  714.     new minutes = floatround(gagtime, floatround_floor)
  715.     new seconds = floatround(floatfract(gagtime) * 60, floatround_floor)
  716.     new hours = 0
  717.     new days = 0
  718.  
  719.     while(minutes >= 60) {
  720.         minutes -= 60
  721.         hours++
  722.     }
  723.  
  724.     while(hours >= 24) {
  725.         hours -= 24
  726.         days++
  727.     }
  728.  
  729.     new bool:add_before
  730.     if(seconds) {
  731.         formatex(length, len, "%i %L", seconds, index, "GAG_SECONDS")  
  732.         add_before = true
  733.     }
  734.  
  735.     if(minutes) {
  736.         if(add_before) format(length, len, "%i %L, %s", minutes, index, "GAG_MINUTES", length)
  737.  
  738.         else{
  739.             formatex(length, len, "%i %L", minutes, index, "GAG_MINUTES")          
  740.             add_before = true
  741.         }
  742.     }
  743.  
  744.     if(hours) {
  745.         if(add_before) format(length, len, "%i %L, %s", hours, index, "GAG_HOURS", length)
  746.  
  747.         else{
  748.             formatex(length, len, "%i %L", hours, index, "GAG_HOURS")          
  749.             add_before = true
  750.         }
  751.     }
  752.  
  753.     if(days) {
  754.         if(add_before) format(length, len, "%i %L, %s", days, index, "GAG_DAYS", length)
  755.  
  756.         else {
  757.             formatex(length, len, "%i %L", days, index, "GAG_DAYS")        
  758.             add_before = true
  759.         }
  760.     }
  761.  
  762.     if(!add_before) formatex(length, len, "%L", index, "PERMANENT_GAG")
  763. }
  764.  
  765. GetTargetFlags(index) {
  766.     static const flags_no_immunity = (CMDTARGET_ALLOW_SELF|CMDTARGET_NO_BOTS)
  767.     static const flags_immunity = (CMDTARGET_ALLOW_SELF|CMDTARGET_NO_BOTS|CMDTARGET_OBEY_IMMUNITY)
  768.  
  769.     switch(get_pcvar_num(gag_immunity)) {
  770.         case 1: return flags_immunity
  771.         case 2: return access(index, GAG_IMMUNITY) ? flags_no_immunity : flags_immunity
  772.     }
  773.  
  774.     return flags_no_immunity
  775. }
  776.  
  777. GenerateUnGagTime(const Float:input, output[], const len) {
  778.     static _hours[5], _minutes[5], _seconds[5], _month[5], _day[5], _year[7]
  779.     format_time(_hours, sizeof(_hours) - 1, "%H")
  780.     format_time(_minutes, sizeof(_minutes) - 1, "%M")
  781.     format_time(_seconds, sizeof(_seconds) - 1, "%S")
  782.     format_time(_month, sizeof(_month) - 1, "%m")
  783.     format_time(_day, sizeof(_day) - 1, "%d")
  784.     format_time(_year, sizeof(_year) - 1, "%Y")
  785.  
  786.     new hours = str_to_num(_hours)
  787.     new month = str_to_num(_month)
  788.     new day = str_to_num(_day)
  789.     new year = str_to_num(_year)
  790.  
  791.     new minutes = floatround(input, floatround_floor) + str_to_num(_minutes)
  792.     new seconds = floatround(floatfract(input) * 60, floatround_floor)
  793.  
  794.     while(minutes >= 60) {
  795.         minutes -= 60
  796.         hours++
  797.     }
  798.  
  799.     while(hours >= 24) {
  800.         hours -= 24
  801.         day++
  802.     }
  803.  
  804.     new max_days = GetDaysInMonth(month, year)
  805.     while(day > max_days) {
  806.         day -= max_days
  807.         month++
  808.     }
  809.  
  810.     while(month > 12) {
  811.         month -= 12
  812.         year++
  813.     }
  814.  
  815.     seconds += str_to_num(_seconds)
  816.     if(seconds > 59) {
  817.         seconds -= 60
  818.         if(minutes < 59) minutes++
  819.  
  820.         else {
  821.             minutes = 0
  822.             if(hours < 23) hours++
  823.  
  824.             else {
  825.                 hours = 0
  826.                 if(day < max_days) day++
  827.  
  828.                 else {
  829.                     day = 1
  830.                     if(month < 12) month++
  831.  
  832.                     else {
  833.                         month = 1
  834.                         year++
  835.                     }
  836.                 }
  837.             }
  838.         }
  839.     }  
  840.  
  841.     formatex(output, len, "%i:%02i:%02i %i/%i/%i", hours, minutes, seconds, month, day, year)
  842. }
  843.  
  844. GetDaysInMonth(month, year=0) {
  845.     switch(month) {
  846.         case 1: return 31 // January
  847.         case 2: return ((year % 4) == 0) ? 29 : 28 // February
  848.         case 3: return 31; // March
  849.         case 4: return 30; // April
  850.         case 5: return 31; // May
  851.         case 6: return 30; // June
  852.         case 7: return 31; // July
  853.         case 8: return 31; // August
  854.         case 9: return 30; // September
  855.         case 10: return 31; // October
  856.         case 11: return 30; // November
  857.         case 12: return 31; // December
  858.     }
  859.  
  860.     return 30
  861. }
  862.  
  863. stock NoColorChat(const id, const input[], any:...) {
  864.     new count = 1, players[32], i
  865.     static msg[191]
  866.     vformat(msg, 190, input, 3)
  867.  
  868.     replace_all(msg, 190, "!g", "")
  869.     replace_all(msg, 190, "!n", "")
  870.     replace_all(msg, 190, "!t", "")
  871.  
  872.     if(id)players[0] = id; else get_players(players, count, "ch")
  873.  
  874.     for(i = 0; i < count; i++) {
  875.         if(is_user_connected(players[i])) {
  876.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  877.             write_byte(players[i])
  878.             write_string(msg)
  879.             message_end()
  880.         }
  881.     }
  882. }
  883.  
  884. stock is_user_steam(id) {
  885.         new g_Steam[32]
  886.         get_user_authid(id, g_Steam, charsmax(g_Steam))
  887.  
  888.         return bool:('0' <= g_Steam[8] <= '1')
  889. }

_________________
Fórumi aktivitásom véget ért: 2017.09.07.
Innentől esetleg steamen vagyok elérhető.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Grab+
HozzászólásElküldve: 2016.02.13. 19:41 
Offline
GFX-Designer
Avatar

Csatlakozott: 2015.03.12. 15:06
Hozzászólások: 624
Megköszönt másnak: 199 alkalommal
Megköszönték neki: 78 alkalommal
kengurumancs írta:
L jog= rcon


És ebben át írtad?

_________________
„Nem azért felejtünk el játszani, mert megöregszünk, hanem attól öregszünk meg, hogy elfelejtünk játszani.”

-MAXHACKED Website-
-HERViD Website-
► Spoiler mutatása


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Grab+
HozzászólásElküldve: 2016.02.13. 19:42 
Offline
Félisten
Avatar

Csatlakozott: 2015.03.12. 18:30
Hozzászólások: 975
Megköszönt másnak: 67 alkalommal
Megköszönték neki: 136 alkalommal
Aha.

_________________
Fórumi aktivitásom véget ért: 2017.09.07.
Innentől esetleg steamen vagyok elérhető.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Grab+
HozzászólásElküldve: 2016.02.13. 19:43 
Offline
Tiszteletbeli
Avatar

Csatlakozott: 2015.04.10. 19:49
Hozzászólások: 610
Megköszönt másnak: 53 alkalommal
Megköszönték neki: 147 alkalommal
Legalább az első tíz sorba néznél már bele, ha segít... Több önállóságot.
"#define GAG_FLAG ADMIN_RCON"

_________________
Néha itt, de többször nem.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Grab+
HozzászólásElküldve: 2016.02.13. 19:43 
Offline
GFX-Designer
Avatar

Csatlakozott: 2015.03.12. 15:06
Hozzászólások: 624
Megköszönt másnak: 199 alkalommal
Megköszönték neki: 78 alkalommal
kengurumancs írta:
Aha.


Köszi, teszelem!

---------------
Szerkesztve:

A 40-ik sorban talál valami bibit :?
---------------

_________________
„Nem azért felejtünk el játszani, mert megöregszünk, hanem attól öregszünk meg, hogy elfelejtünk játszani.”

-MAXHACKED Website-
-HERViD Website-
► Spoiler mutatása


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Grab+
HozzászólásElküldve: 2016.02.13. 19:59 
Offline
Félisten
Avatar

Csatlakozott: 2015.03.12. 18:30
Hozzászólások: 975
Megköszönt másnak: 67 alkalommal
Megköszönték neki: 136 alkalommal
Javítva!
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4.  
  5. #define PLUGIN "ADMIN Gag"
  6. #define VERSION "1.0.1"
  7. #define AUTHOR "RaZzoR"
  8.  
  9. #define GAG_FLAG ADMIN_RCON
  10. #define GAG_IMMUNITY ADMIN_IMMUNITY
  11.  
  12. #define DICTIONARY "admin_gag.txt"
  13. #define USE_COLOR_CHAT
  14.  
  15. #if defined USE_COLOR_CHAT
  16.     #include <colorchat>
  17. #endif
  18.  
  19. new const gag_file_name[] = "gagged_users.txt"
  20.  
  21. enum _:GagData {
  22.     gag_name[32],
  23.     gag_steamid[35],
  24.     gag_length,
  25.     ungag_time[32],
  26.     gag_reason[128]
  27. }
  28.  
  29. new Trie:g_trie
  30. new Array:g_array
  31. new total_gags, g_ungag_entity
  32. new gag_file[64], Float:get_gag_time[33], tempid[33]
  33.  
  34. new gag_immunity, gag_ungagcheck
  35.  
  36. public plugin_init() {
  37.     register_plugin(PLUGIN, VERSION, AUTHOR)
  38.  
  39.     #if defined USE_COLOR_CHAT
  40.         register_dictionary(DICTIONARY)
  41.     #else
  42.         register_dictionary(DICTIONARY)
  43.     #endif
  44.  
  45.     gag_immunity = register_cvar("gag_immunity", "1")
  46.     gag_ungagcheck = register_cvar("gag_ungagcheck", "1.0")
  47.  
  48.     register_clcmd("say /gag_menu", "gag_menu")
  49.     register_clcmd("say /ungag_menu", "ungag_menu")
  50.  
  51.     register_clcmd("say", "gag_say")
  52.     register_clcmd("say_team", "gag_say")  
  53.  
  54.     register_clcmd("GAG_TIME", "clcmd_time")
  55.     register_clcmd("GAG_REASON", "clcmd_reason")
  56.  
  57.     register_concmd("gag_authid", "concmd_gag_authid", GAG_FLAG, "<nev, #userid, authid> <ido percben> <ok>")
  58.     register_concmd("gag_ip", "concmd_gag_ip", GAG_FLAG, "<nev, #userid, authid> <ido percben> <ok>")
  59.     register_concmd("gag_add", "concmd_gag_add", GAG_FLAG, "<nev> <authid vagy ip> <ido percben> <ok>")
  60.     register_concmd("gag_list", "concmd_gag_list", GAG_FLAG, "[start] -- megmutat minden nemitast")
  61.     register_concmd("ungag", "concmd_ungag", GAG_FLAG, "<authid vagy ip>")
  62.  
  63.     get_datadir(gag_file, sizeof(gag_file) - 1)
  64.     format(gag_file, sizeof(gag_file) - 1, "%s/%s", gag_file, gag_file_name)
  65.  
  66.     g_trie = TrieCreate()
  67.     g_array = ArrayCreate(GagData)
  68.  
  69.     LoadGags()
  70. }
  71.  
  72. public plugin_cfg() create_ungag_entity()
  73.  
  74. public client_PostThink(id) {
  75.     static authid[35]
  76.     get_user_authid(id, authid, sizeof(authid) - 1)
  77.  
  78.     static ip[35]
  79.     get_user_ip(id, ip, sizeof(ip) - 1, 1)
  80.  
  81.     static array_pos  
  82.     if(TrieGetCell(g_trie, authid, array_pos) || TrieGetCell(g_trie, ip, array_pos)) set_speak(id, SPEAK_MUTED)
  83.     else set_speak(id, SPEAK_LISTENALL)
  84. }
  85.  
  86. public create_ungag_entity() {
  87.     static failtimes
  88.  
  89.     g_ungag_entity = create_entity("info_target")
  90.  
  91.     if(!is_valid_ent(g_ungag_entity)) {
  92.         ++failtimes
  93.  
  94.         log_amx("%L", LANG_SERVER, "FAILED_TO_CREATE_UNGAG_ENTITY", failtimes)
  95.  
  96.         if(failtimes < 10) set_task(1.0, "create_ungag_entity")
  97.         else log_amx("%L", LANG_SERVER, "COULD_NOT_CREATE_UNGAG_ENTITY")
  98.  
  99.         return
  100.     }
  101.  
  102.     entity_set_string(g_ungag_entity, EV_SZ_classname, "ungag_entity")
  103.     entity_set_float(g_ungag_entity, EV_FL_nextthink, get_gametime() + 1.0)
  104.  
  105.     register_think("ungag_entity", "UnGag_Check")
  106. }
  107.  
  108. public UnGag_Check(entity)
  109. {
  110.     if(entity != g_ungag_entity) return
  111.  
  112.     if(total_gags > 0)
  113.     {
  114.         static _hours[5], _minutes[5], _seconds[5], _month[5], _day[5], _year[7]
  115.         format_time(_hours, sizeof(_hours) - 1, "%H")
  116.         format_time(_minutes, sizeof(_minutes) - 1, "%M")
  117.         format_time(_seconds, sizeof(_seconds) - 1, "%S")
  118.         format_time(_month, sizeof(_month) - 1, "%m")
  119.         format_time(_day, sizeof(_day) - 1, "%d")
  120.         format_time(_year, sizeof(_year) - 1, "%Y")
  121.  
  122.  
  123.         new c_hours = str_to_num(_hours)
  124.         new c_minutes = str_to_num(_minutes)
  125.         new c_seconds = str_to_num(_seconds)
  126.         new c_month = str_to_num(_month)
  127.         new c_day = str_to_num(_day)
  128.         new c_year = str_to_num(_year)
  129.  
  130.         static load_ungag_time[32]
  131.         static u_hours, u_minutes, u_seconds, u_month, u_day, u_year
  132.  
  133.         for(new i = 0; i < total_gags; i++) {
  134.             static data[GagData]
  135.             ArrayGetArray(g_array, i, data)
  136.  
  137.             if(data[gag_length] == 0) continue
  138.  
  139.             copy(load_ungag_time, sizeof(load_ungag_time) - 1, data[ungag_time])
  140.  
  141.             replace_all(load_ungag_time, sizeof(load_ungag_time) - 1, ":", " ")
  142.             replace_all(load_ungag_time, sizeof(load_ungag_time) - 1, "/", " ")
  143.  
  144.             parse(load_ungag_time,\
  145.                 _hours, sizeof(_hours) - 1,\
  146.                 _minutes, sizeof(_minutes) - 1,\
  147.                 _seconds, sizeof(_seconds) - 1,\
  148.                 _month, sizeof(_month) - 1,\
  149.                 _day, sizeof(_day) - 1,\
  150.                 _year, sizeof(_year) - 1
  151.                 )
  152.  
  153.             u_hours = str_to_num(_hours)
  154.             u_minutes = str_to_num(_minutes)
  155.             u_seconds = str_to_num(_seconds)
  156.             u_month = str_to_num(_month)
  157.             u_day = str_to_num(_day)
  158.             u_year = str_to_num(_year)
  159.  
  160.             if( u_year < c_year
  161.             || u_year == c_year && u_month < c_month
  162.             || u_year == c_year && u_month == c_month && u_day < c_day
  163.             || u_year == c_year && u_month == c_month && u_day == c_day && u_hours < c_hours
  164.             || u_year == c_year && u_month == c_month && u_day == c_day && u_hours == c_hours && u_minutes < c_minutes
  165.             || u_year == c_year && u_month == c_month && u_day == c_day && u_hours == c_hours && u_minutes == c_minutes && u_seconds <= c_seconds ) {
  166.                 #if defined USE_COLOR_CHAT
  167.                     ColorChat(0, RED, "%L", LANG_PLAYER, "GAG_EXPIRED", data[gag_name], data[gag_steamid], data[gag_reason])
  168.                 #else
  169.                     NoColorChat(0, "%L", LANG_PLAYER, "GAG_EXPIRED", data[gag_name], data[gag_steamid], data[gag_reason])
  170.                 #endif
  171.  
  172.                 RemoveGag(i, data[gag_steamid])
  173.  
  174.                 i--
  175.             }
  176.         }
  177.     }
  178.  
  179.     entity_set_float(g_ungag_entity, EV_FL_nextthink, get_gametime() + get_pcvar_float(gag_ungagcheck))
  180. }
  181.  
  182. public concmd_gag_authid(id, level, cid) {
  183.     if(!cmd_access(id, level, cid, 4)) return PLUGIN_HANDLED
  184.  
  185.     static arg[128]
  186.     read_argv(1, arg, sizeof(arg) - 1)
  187.  
  188.     new target = cmd_target(id, arg, GetTargetFlags(id))
  189.     if(!target) return PLUGIN_HANDLED
  190.  
  191.     static target_authid[35]
  192.     get_user_authid(target, target_authid, sizeof(target_authid) - 1)
  193.  
  194.     if(TrieKeyExists(g_trie, target_authid)) {
  195.         console_print(id, "%L", id, "ALREADY_GAGGED_STEAMID", target_authid)
  196.         return PLUGIN_HANDLED
  197.     }
  198.  
  199.     read_argv(2, arg, sizeof(arg) - 1)
  200.     new Float:length = str_to_float(arg)
  201.  
  202.     static ungag_time2[64], gag_time2[64]
  203.  
  204.     if(length == 0.0) formatex(ungag_time2, sizeof(ungag_time2) - 1, "%L", id, "PERMANENT_GAG")
  205.     else GenerateUnGagTime(length, ungag_time2, sizeof(ungag_time2) - 1)
  206.  
  207.     read_argv(3, arg, sizeof(arg) - 1)
  208.  
  209.     static admin_name[64], target_name[32]
  210.     get_user_name(id, admin_name, sizeof(admin_name) - 1)
  211.     get_user_name(target, target_name, sizeof(target_name) - 1)
  212.  
  213.     static admin_authid[35]
  214.     get_user_authid(id, admin_authid, sizeof(admin_authid) - 1)
  215.  
  216.     GagAdd(target_name, target_authid, arg, floatround(length * 60.0, floatround_floor), ungag_time2)
  217.  
  218.     GetGagTime(id, length, gag_time2, sizeof(gag_time2) - 1)
  219.  
  220.     #if defined USE_COLOR_CHAT
  221.         ColorChat(0, RED, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, arg, gag_time2, ungag_time2)
  222.     #else
  223.         NoColorChat(0, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, arg, gag_time2, ungag_time2)
  224.     #endif
  225.  
  226.     return PLUGIN_HANDLED
  227. }
  228.  
  229. public concmd_gag_ip(id, level, cid) {
  230.     if(!cmd_access(id, level, cid, 4)) return PLUGIN_HANDLED
  231.  
  232.     static arg[128]
  233.     read_argv(1, arg, sizeof(arg) - 1)
  234.  
  235.     new target = cmd_target(id, arg, GetTargetFlags(id))
  236.     if(!target) return PLUGIN_HANDLED
  237.  
  238.     static target_ip[35]
  239.     get_user_ip(target, target_ip, sizeof(target_ip) - 1, 1)
  240.  
  241.     if(TrieKeyExists(g_trie, target_ip)) {
  242.         console_print(id, "%L", id, "ALREADY_GAGGED_IP", target_ip)
  243.         return PLUGIN_HANDLED
  244.     }
  245.  
  246.     read_argv(2, arg, sizeof(arg) - 1)
  247.     new Float:length = str_to_float(arg)
  248.  
  249.     static ungag_time2[64], gag_time2[64]
  250.  
  251.     if(length == 0.0) formatex(ungag_time2, sizeof(ungag_time2) - 1, "%L", id, "PERMANENT_GAG")
  252.     else GenerateUnGagTime(length, ungag_time2, sizeof(ungag_time2) - 1)
  253.  
  254.     read_argv(3, arg, sizeof(arg) - 1)
  255.  
  256.     static admin_name[64], target_name[32]
  257.     get_user_name(id, admin_name, sizeof(admin_name) - 1)
  258.     get_user_name(target, target_name, sizeof(target_name) - 1)
  259.  
  260.     static admin_authid[35]
  261.     get_user_authid(id, admin_authid, sizeof(admin_authid) - 1)
  262.  
  263.     GagAdd(target_name, target_ip, arg, floatround(length * 60.0, floatround_floor), ungag_time2)
  264.  
  265.     GetGagTime(id, length, gag_time2, sizeof(gag_time2) - 1)
  266.  
  267.     #if defined USE_COLOR_CHAT
  268.         ColorChat(0, RED, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, arg, gag_time2, ungag_time2)
  269.     #else
  270.         NoColorChat(0, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, arg, gag_time2, ungag_time2)
  271.     #endif
  272.  
  273.     return PLUGIN_HANDLED
  274. }
  275.  
  276. public concmd_gag_add(id, level, cid) {
  277.     if(!cmd_access(id, level, cid, 5)) return PLUGIN_HANDLED
  278.  
  279.     static target_name[128], target_authid[128], gagtime[128], reason[128]
  280.     read_argv(1, target_name, sizeof(target_name) - 1)
  281.     read_argv(2, target_authid, sizeof(target_authid) - 1)
  282.     read_argv(3, gagtime, sizeof(gagtime) - 1)
  283.     read_argv(4, reason, sizeof(reason) - 1)
  284.  
  285.     new bool:is_ip = bool:(containi(target_authid, ".") != -1)
  286.  
  287.     if(TrieKeyExists(g_trie, target_authid)) {
  288.         console_print(id, "%L", id, is_ip ? "ALREADY_GAGGED_IP" : "ALREADY_GAGGED_STEAMID", target_authid)
  289.         return PLUGIN_HANDLED
  290.     }
  291.  
  292.     new Float:length = str_to_float(gagtime)
  293.     static ungag_time2[64], gag_time2[64]
  294.  
  295.     if(length == 0.0) formatex(ungag_time2, sizeof(ungag_time2) - 1, "%L", id, "PERMANENT_GAG")
  296.     else GenerateUnGagTime(length, ungag_time2, sizeof(ungag_time2) - 1)
  297.  
  298.     static admin_name[64]
  299.     get_user_name(id, admin_name, sizeof(admin_name) - 1)
  300.  
  301.     static admin_authid[35]
  302.     get_user_authid(id, admin_authid, sizeof(admin_authid) - 1)
  303.  
  304.     GagAdd(target_name, target_authid, reason, floatround(length * 60.0, floatround_floor), ungag_time2)
  305.  
  306.     GetGagTime(id, length, gag_time2, sizeof(gag_time2) - 1)
  307.  
  308.     #if defined USE_COLOR_CHAT
  309.         ColorChat(0, RED, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, reason, gag_time2, ungag_time2)
  310.     #else
  311.         NoColorChat(0, "%L", LANG_PLAYER, "GAG_PLAYER", admin_name, admin_authid, target_name, reason, gag_time2, ungag_time2)
  312.     #endif
  313.  
  314.     return PLUGIN_HANDLED
  315. }  
  316.  
  317. public concmd_ungag(id, level, cid) {
  318.     if(!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED
  319.  
  320.     static arg[35]
  321.     read_argv(1, arg, sizeof(arg) - 1)
  322.  
  323.     if(TrieKeyExists(g_trie, arg)) {
  324.         static array_pos;
  325.         TrieGetCell(g_trie, arg, array_pos);
  326.  
  327.         static data[GagData]
  328.         ArrayGetArray(g_array, array_pos, data)
  329.  
  330.         static admin_name[64]
  331.         get_user_name(id, admin_name, sizeof(admin_name) - 1)
  332.  
  333.         static authid[35]
  334.         get_user_authid(id, authid, sizeof(authid) - 1)
  335.  
  336.         #if defined USE_COLOR_CHAT
  337.             ColorChat(0, RED, "%L", LANG_PLAYER, "UNGAG_PLAYER", admin_name, authid, data[gag_name], data[gag_steamid], data[gag_reason])
  338.         #else
  339.             NoColorChat(0, "%L", LANG_PLAYER, "UNGAG_PLAYER", admin_name, authid, data[gag_name], data[gag_steamid], data[gag_reason])
  340.         #endif
  341.  
  342.         RemoveGag(array_pos, data[gag_steamid])
  343.  
  344.         return PLUGIN_HANDLED
  345.     }
  346.  
  347.     console_print(id, "%L", id, "NOT_IN_GAG_LIST", arg)
  348.  
  349.     return PLUGIN_HANDLED
  350. }
  351.  
  352. public concmd_gag_list(id, level, cid) {
  353.     if(!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED
  354.  
  355.     if(!total_gags) {
  356.         console_print(id, "%L", id, "NO_GAGS")
  357.         return PLUGIN_HANDLED;
  358.     }
  359.  
  360.     static start
  361.     if(read_argc() > 1) {
  362.         static arg[5]
  363.         read_argv(1, arg, sizeof(arg) - 1)
  364.  
  365.         start = min(str_to_num(arg), total_gags) - 1
  366.     }
  367.  
  368.     else start = 0
  369.  
  370.     new last = min(start + 10, total_gags)
  371.  
  372.     if(id == 0) server_cmd("echo ^"%L^"", id, "GAG_LIST_NUM", start + 1, last)
  373.     else console_print(id, "%L", id, "GAG_LIST_NUM", start + 1, last)
  374.  
  375.     for(new i = start; i < last; i++) {
  376.         static data[GagData]
  377.         ArrayGetArray(g_array, i, data)
  378.  
  379.         PrintGagInfosToConsole(id, data[gag_name], data[gag_steamid], data[gag_length], data[gag_reason], data[ungag_time])
  380.     }
  381.  
  382.     if(++last < total_gags) {
  383.         if(id == 0) server_cmd("echo ^"%L^"", id, "GAG_LIST_NEXT", last)
  384.         else console_print(id, "%L", id, "GAG_LIST_NEXT", last)
  385.     }
  386.  
  387.     return PLUGIN_HANDLED
  388. }  
  389.  
  390. public gag_menu(id) {
  391.     if(!(get_user_flags(id) & GAG_FLAG))
  392.         return PLUGIN_HANDLED
  393.  
  394.     new menu_line[64], menu_newline[64], id_data[64]
  395.     format(menu_line, charsmax(menu_line), "\w%L^n%L", id, "GAG_MENU1", id, "GAG_MENU2")
  396.  
  397.     new menu = menu_create(menu_line, "gag_menu_handler")
  398.  
  399.     new players[32], name[32], num
  400.     get_players(players, num, "c")
  401.  
  402.     for(new i = 0; i <num; i++) {
  403.         new pid = players[i]
  404.         get_user_name(pid, name, 31)
  405.         num_to_str(pid, id_data, sizeof(id_data))
  406.  
  407.         format(menu_newline, charsmax(menu_newline), "%s", name)
  408.         menu_additem(menu, menu_newline, id_data, 0)
  409.     }
  410.  
  411.     menu_display(id, menu, 0)
  412.     return PLUGIN_CONTINUE
  413. }
  414.  
  415. public ungag_menu(id) {
  416.     if(!(get_user_flags(id) & GAG_FLAG))
  417.         return PLUGIN_HANDLED
  418.  
  419.     if(!total_gags) {
  420.         #if defined USE_COLOR_CHAT
  421.             ColorChat(id, RED, "%L", id, "NO_GAGS")
  422.         #else
  423.             client_print(id, print_chat, "%L", id, "NO_GAGS")
  424.         #endif
  425.  
  426.         return PLUGIN_HANDLED
  427.     }
  428.  
  429.     new menu_line[99], menu_newline[99]
  430.     format(menu_line, charsmax(menu_line), "\w%L^n%L", id, "GAG_MENU3", id, "GAG_MENU4")
  431.  
  432.     new menu = menu_create(menu_line, "ungag_menu_handler")
  433.  
  434.     for(new i = 0; i < total_gags; i++) {
  435.         static data[GagData]
  436.         ArrayGetArray(g_array, i, data)
  437.  
  438.         format(menu_newline, charsmax(menu_newline), "\r%s \w[%s]", data[gag_steamid], data[gag_reason])
  439.         menu_additem(menu, menu_newline, data[gag_steamid], 0)
  440.     }
  441.  
  442.     menu_display(id, menu, 0)
  443.     return PLUGIN_CONTINUE
  444. }
  445.  
  446. public gag_menu_handler(id, menu, item) {
  447.     if(item == MENU_EXIT) {
  448.         menu_destroy(menu)
  449.         return PLUGIN_HANDLED
  450.     }
  451.  
  452.     new data[64], szName[64]
  453.     new access, callback
  454.     menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback)
  455.  
  456.     tempid[id] = str_to_num(data)
  457.  
  458.     static authid[35]
  459.     get_user_authid(tempid[id], authid, sizeof(authid) - 1)
  460.  
  461.     static ip[35]
  462.     get_user_ip(tempid[id], ip, sizeof(ip) - 1, 1)
  463.     static array_pos  
  464.  
  465.     if(get_user_flags(tempid[id]) & GAG_IMMUNITY) {
  466.         #if defined USE_COLOR_CHAT
  467.             ColorChat(id, RED, "%L", id, "PLAYER_IMMUNITY")
  468.         #else
  469.             NoColorChat(id, "%L", id, "PLAYER_IMMUNITY")
  470.         #endif
  471.  
  472.         gag_menu(id)
  473.  
  474.         return PLUGIN_HANDLED
  475.     }
  476.  
  477.     else if(TrieGetCell(g_trie, authid, array_pos) || TrieGetCell(g_trie, ip, array_pos)) {
  478.         static data[GagData]
  479.         ArrayGetArray(g_array, array_pos, data)
  480.  
  481.         static gag_length2[64]
  482.         new Float:gag_len = float(data[gag_length]) / 60.0
  483.         GetGagTime(id, gag_len, gag_length2, sizeof(gag_length2) - 1)
  484.  
  485.         #if defined USE_COLOR_CHAT
  486.             ColorChat(id, RED, "%L", id, "PLAYER_GAGGED", data[gag_reason], gag_length2, data[ungag_time])
  487.         #else
  488.             NoColorChat(id, "%L", id, "PLAYER_GAGGED", data[gag_reason], gag_length2, data[ungag_time])
  489.         #endif
  490.  
  491.         return PLUGIN_HANDLED
  492.     }
  493.  
  494.     else {
  495.         #if defined USE_COLOR_CHAT
  496.             ColorChat(id, RED, "%L", id, "TYPE_TIME")
  497.         #else
  498.             NoColorChat(id, "%L", id, "TYPE_TIME")
  499.         #endif
  500.  
  501.         client_cmd(id, "messagemode GAG_TIME")
  502.     }
  503.  
  504.     return PLUGIN_CONTINUE
  505. }
  506.  
  507. public ungag_menu_handler(id, menu, item) {
  508.     if(item == MENU_EXIT) {
  509.         menu_destroy(menu)
  510.         return PLUGIN_HANDLED
  511.     }
  512.  
  513.     new data[64], szName[64]
  514.     new access, callback
  515.     menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback)
  516.  
  517.     client_cmd(id, "ungag ^"%s^"", data)
  518.  
  519.     return PLUGIN_CONTINUE
  520. }
  521.  
  522. public clcmd_time(id) {
  523.     if(!(get_user_flags(id) & GAG_FLAG))
  524.         return PLUGIN_HANDLED
  525.  
  526.     new gag_times[33][100]
  527.     read_args(gag_times[id], 99)
  528.     remove_quotes(gag_times[id])
  529.  
  530.     get_gag_time[id] = str_to_float(gag_times[id])
  531.  
  532.     #if defined USE_COLOR_CHAT
  533.         ColorChat(id, RED, "%L", id, "TYPE_REASON")
  534.     #else
  535.         NoColorChat(id, "%L", id, "TYPE_REASON")
  536.     #endif
  537.  
  538.     client_cmd(id, "messagemode GAG_REASON")
  539.  
  540.     return PLUGIN_HANDLED
  541. }
  542.  
  543. public clcmd_reason(id) {
  544.     if(!(get_user_flags(id) & GAG_FLAG))
  545.         return PLUGIN_HANDLED
  546.  
  547.     new get_gag_reason[33][100]
  548.     read_args(get_gag_reason[id], 99)
  549.     remove_quotes(get_gag_reason[id])
  550.  
  551.     static target_name[32]
  552.     get_user_name(tempid[id], target_name, sizeof(target_name) - 1)
  553.  
  554.     if(is_user_steam(tempid[id])) client_cmd(id, "gag_authid ^"%s^" ^"%f^" ^"%s^"", target_name, get_gag_time[id], get_gag_reason[id])
  555.     else client_cmd(id, "gag_ip ^"%s^" ^"%f^" ^"%s^"", target_name, get_gag_time[id], get_gag_reason[id])
  556.  
  557.     return PLUGIN_HANDLED
  558. }
  559.  
  560. public gag_say(id) {
  561.     static authid[35]
  562.     get_user_authid(id, authid, sizeof(authid) - 1)
  563.  
  564.     static ip[35]
  565.     get_user_ip(id, ip, sizeof(ip) - 1, 1)
  566.  
  567.     static array_pos  
  568.     if(TrieGetCell(g_trie, authid, array_pos) || TrieGetCell(g_trie, ip, array_pos)) {
  569.         static data[GagData]
  570.         ArrayGetArray(g_array, array_pos, data)
  571.  
  572.         static gag_length2[64]
  573.         new Float:gag_len = float(data[gag_length]) / 60.0
  574.         GetGagTime(id, gag_len, gag_length2, sizeof(gag_length2) - 1)
  575.  
  576.         #if defined USE_COLOR_CHAT
  577.             ColorChat(id, RED, "%L", id, "YOU_GAGGED", data[gag_reason], gag_length2, data[ungag_time])
  578.         #else
  579.             NoColorChat(id, "%L", id, "YOU_GAGGED", data[gag_reason], gag_length2, data[ungag_time])
  580.         #endif
  581.  
  582.         return PLUGIN_HANDLED
  583.     }
  584.  
  585.     return PLUGIN_CONTINUE
  586. }
  587.  
  588. public PrintGagInfosToConsole(index, const target_name[], const target_steamid[], const target_length, const target_reason[], const target_ungag_time[]) {
  589.     static gag_length2[64]
  590.     new bool:is_ip = bool:(containi(target_steamid, ".") != -1)
  591.  
  592.     if(index == 0) {
  593.         server_print("************************************************")
  594.         server_print("%L", index, "GAG_INFORMATION")
  595.         server_print("%L: %s", index, "GAG_NAME", target_name)
  596.         server_print("%L: %s", index, !is_ip ? "GAG_STEAMID" : "GAG_IP", target_steamid)
  597.         server_print("%L: %s", index, "GAG_REASON", target_reason)
  598.         if(target_length > 0) {
  599.             new Float:gag_len = float(target_length) / 60.0
  600.             GetGagTime(index, gag_len, gag_length2, sizeof(gag_length2) - 1)
  601.  
  602.             server_print("%L: %s", index, "GAG_TIME", gag_length2)
  603.         }
  604.         server_print("%L: %s", index, "UNGAG_TIME", target_ungag_time)
  605.         server_print("************************************************")
  606.     }
  607.  
  608.     else {
  609.         console_print(index, "************************************************")
  610.         console_print(index, "%L", index, "GAG_INFORMATION")
  611.         console_print(index, "%L: %s", index, "GAG_NAME", target_name)
  612.         console_print(index, "%L: %s", index, !is_ip ? "GAG_STEAMID" : "GAG_IP", target_steamid)
  613.         console_print(index, "%L: %s", index, "GAG_REASON", target_reason)
  614.         if(target_length > 0) {
  615.             new Float:gag_len = float(target_length) / 60.0
  616.             GetGagTime(index, gag_len, gag_length2, sizeof(gag_length2) - 1)
  617.  
  618.             console_print(index, "%L: %s", index, "GAG_TIME", gag_length2)
  619.         }
  620.         console_print(index, "%L: %s", index, "UNGAG_TIME", target_ungag_time)
  621.         console_print(index, "************************************************")
  622.     }
  623. }
  624.  
  625. public LoadGags() {
  626.     if(total_gags) {
  627.         TrieClear(g_trie)
  628.         ArrayClear(g_array)
  629.         total_gags = 0
  630.     }
  631.  
  632.     if(file_exists(gag_file)) {
  633.         new f = fopen(gag_file, "rt")
  634.         static filedata[512], length[10]
  635.  
  636.         static data[GagData]
  637.         while(!feof(f)){
  638.             fgets(f, filedata, sizeof(filedata) - 1)
  639.  
  640.             if(!filedata[0]) continue
  641.  
  642.             parse(filedata,\
  643.                 data[gag_steamid], sizeof(data[gag_steamid]) - 1,\
  644.                 data[gag_name], sizeof(data[gag_name]) - 1,\
  645.                 length, sizeof(length) - 1,\
  646.                 data[ungag_time], sizeof(data[ungag_time]) - 1,\
  647.                 data[gag_reason], sizeof(data[gag_reason]) - 1
  648.                 )
  649.  
  650.             data[gag_length] = str_to_num(length)
  651.  
  652.             ArrayPushArray(g_array, data)
  653.             TrieSetCell(g_trie, data[gag_steamid], total_gags)
  654.  
  655.             total_gags++
  656.         }
  657.  
  658.         fclose(f)
  659.     }
  660. }
  661.  
  662. public RemoveGag(pos, const authid[]) {
  663.     TrieDeleteKey(g_trie, authid)
  664.     ArrayDeleteItem(g_array, pos)
  665.  
  666.     total_gags--
  667.  
  668.     new f = fopen(gag_file, "wt")
  669.     new data[GagData]
  670.  
  671.     for(new i = 0; i < total_gags; i++ ) {
  672.         ArrayGetArray(g_array, i, data)
  673.         TrieSetCell(g_trie, data[gag_steamid], i)
  674.  
  675.         fprintf(f, "^"%s^" ^"%s^" %i ^"%s^" ^"%s^"^n",\
  676.             data[gag_steamid],\
  677.             data[gag_name],\
  678.             data[gag_length],\
  679.             data[ungag_time],\
  680.             data[gag_reason]
  681.             )
  682.     }
  683.  
  684.     fclose(f)
  685. }
  686.  
  687. public GagAdd(const target_name[], const target_steamid[], const reason[], const length, const ungag_time3[]) {
  688.     new f = fopen(gag_file, "a+")
  689.  
  690.     fprintf(f, "^"%s^" ^"%s^" %i ^"%s^" ^"%s^"^n",\
  691.         target_steamid,\
  692.         target_name,\
  693.         length,\
  694.         ungag_time3,\
  695.         reason
  696.         )
  697.  
  698.     fclose(f)
  699.  
  700.     static data[GagData]
  701.     copy(data[gag_name], sizeof(data[gag_name]) - 1, target_name)
  702.     copy(data[gag_steamid], sizeof(data[gag_steamid]) - 1, target_steamid)
  703.     data[gag_length] = length
  704.     copy(data[ungag_time], sizeof(data[ungag_time]) - 1, ungag_time3)
  705.     copy(data[gag_reason], sizeof(data[gag_reason]) - 1, reason)
  706.  
  707.     TrieSetCell(g_trie, target_steamid, total_gags)
  708.     ArrayPushArray(g_array, data)
  709.  
  710.     total_gags++
  711. }
  712.  
  713. GetGagTime(index, Float:gagtime, length[], len) {
  714.     new minutes = floatround(gagtime, floatround_floor)
  715.     new seconds = floatround(floatfract(gagtime) * 60, floatround_floor)
  716.     new hours = 0
  717.     new days = 0
  718.  
  719.     while(minutes >= 60) {
  720.         minutes -= 60
  721.         hours++
  722.     }
  723.  
  724.     while(hours >= 24) {
  725.         hours -= 24
  726.         days++
  727.     }
  728.  
  729.     new bool:add_before
  730.     if(seconds) {
  731.         formatex(length, len, "%i %L", seconds, index, "GAG_SECONDS")  
  732.         add_before = true
  733.     }
  734.  
  735.     if(minutes) {
  736.         if(add_before) format(length, len, "%i %L, %s", minutes, index, "GAG_MINUTES", length)
  737.  
  738.         else{
  739.             formatex(length, len, "%i %L", minutes, index, "GAG_MINUTES")          
  740.             add_before = true
  741.         }
  742.     }
  743.  
  744.     if(hours) {
  745.         if(add_before) format(length, len, "%i %L, %s", hours, index, "GAG_HOURS", length)
  746.  
  747.         else{
  748.             formatex(length, len, "%i %L", hours, index, "GAG_HOURS")          
  749.             add_before = true
  750.         }
  751.     }
  752.  
  753.     if(days) {
  754.         if(add_before) format(length, len, "%i %L, %s", days, index, "GAG_DAYS", length)
  755.  
  756.         else {
  757.             formatex(length, len, "%i %L", days, index, "GAG_DAYS")        
  758.             add_before = true
  759.         }
  760.     }
  761.  
  762.     if(!add_before) formatex(length, len, "%L", index, "PERMANENT_GAG")
  763. }
  764.  
  765. GetTargetFlags(index) {
  766.     static const flags_no_immunity = (CMDTARGET_ALLOW_SELF|CMDTARGET_NO_BOTS)
  767.     static const flags_immunity = (CMDTARGET_ALLOW_SELF|CMDTARGET_NO_BOTS|CMDTARGET_OBEY_IMMUNITY)
  768.  
  769.     switch(get_pcvar_num(gag_immunity)) {
  770.         case 1: return flags_immunity
  771.         case 2: return access(index, GAG_IMMUNITY) ? flags_no_immunity : flags_immunity
  772.     }
  773.  
  774.     return flags_no_immunity
  775. }
  776.  
  777. GenerateUnGagTime(const Float:input, output[], const len) {
  778.     static _hours[5], _minutes[5], _seconds[5], _month[5], _day[5], _year[7]
  779.     format_time(_hours, sizeof(_hours) - 1, "%H")
  780.     format_time(_minutes, sizeof(_minutes) - 1, "%M")
  781.     format_time(_seconds, sizeof(_seconds) - 1, "%S")
  782.     format_time(_month, sizeof(_month) - 1, "%m")
  783.     format_time(_day, sizeof(_day) - 1, "%d")
  784.     format_time(_year, sizeof(_year) - 1, "%Y")
  785.  
  786.     new hours = str_to_num(_hours)
  787.     new month = str_to_num(_month)
  788.     new day = str_to_num(_day)
  789.     new year = str_to_num(_year)
  790.  
  791.     new minutes = floatround(input, floatround_floor) + str_to_num(_minutes)
  792.     new seconds = floatround(floatfract(input) * 60, floatround_floor)
  793.  
  794.     while(minutes >= 60) {
  795.         minutes -= 60
  796.         hours++
  797.     }
  798.  
  799.     while(hours >= 24) {
  800.         hours -= 24
  801.         day++
  802.     }
  803.  
  804.     new max_days = GetDaysInMonth(month, year)
  805.     while(day > max_days) {
  806.         day -= max_days
  807.         month++
  808.     }
  809.  
  810.     while(month > 12) {
  811.         month -= 12
  812.         year++
  813.     }
  814.  
  815.     seconds += str_to_num(_seconds)
  816.     if(seconds > 59) {
  817.         seconds -= 60
  818.         if(minutes < 59) minutes++
  819.  
  820.         else {
  821.             minutes = 0
  822.             if(hours < 23) hours++
  823.  
  824.             else {
  825.                 hours = 0
  826.                 if(day < max_days) day++
  827.  
  828.                 else {
  829.                     day = 1
  830.                     if(month < 12) month++
  831.  
  832.                     else {
  833.                         month = 1
  834.                         year++
  835.                     }
  836.                 }
  837.             }
  838.         }
  839.     }  
  840.  
  841.     formatex(output, len, "%i:%02i:%02i %i/%i/%i", hours, minutes, seconds, month, day, year)
  842. }
  843.  
  844. GetDaysInMonth(month, year=0) {
  845.     switch(month) {
  846.         case 1: return 31 // January
  847.         case 2: return ((year % 4) == 0) ? 29 : 28 // February
  848.         case 3: return 31; // March
  849.         case 4: return 30; // April
  850.         case 5: return 31; // May
  851.         case 6: return 30; // June
  852.         case 7: return 31; // July
  853.         case 8: return 31; // August
  854.         case 9: return 30; // September
  855.         case 10: return 31; // October
  856.         case 11: return 30; // November
  857.         case 12: return 31; // December
  858.     }
  859.  
  860.     return 30
  861. }
  862.  
  863. stock NoColorChat(const id, const input[], any:...) {
  864.     new count = 1, players[32], i
  865.     static msg[191]
  866.     vformat(msg, 190, input, 3)
  867.  
  868.     replace_all(msg, 190, "!g", "")
  869.     replace_all(msg, 190, "!n", "")
  870.     replace_all(msg, 190, "!t", "")
  871.  
  872.     if(id)players[0] = id; else get_players(players, count, "ch")
  873.  
  874.     for(i = 0; i < count; i++) {
  875.         if(is_user_connected(players[i])) {
  876.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  877.             write_byte(players[i])
  878.             write_string(msg)
  879.             message_end()
  880.         }
  881.     }
  882. }
  883.  
  884. stock is_user_steam(id) {
  885.         new g_Steam[32]
  886.         get_user_authid(id, g_Steam, charsmax(g_Steam))
  887.  
  888.         return bool:('0' <= g_Steam[8] <= '1')
  889. }


1.8.3 amxx-hez nem kell a colored.
  1. register_dictionary_colored(DICTIONARY)

_________________
Fórumi aktivitásom véget ért: 2017.09.07.
Innentől esetleg steamen vagyok elérhető.


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 24 hozzászólás ]  Oldal Előző 1 2 3 Következő


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 53 vendég


Nem nyithatsz témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole