hlmod.hu

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



Jelenlévő felhasználók

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

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot], Google [Bot]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  [2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: AMX RATE MANAGER*
HozzászólásElküldve:2013.05.12. 22:45 
Offline
Minden6ó
Avatar

Csatlakozott:2011.01.19. 12:14
Hozzászólások:4294
Megköszönt másnak: 219 alkalommal
Megköszönték neki: 289 alkalommal
Hali! Valaki le fordítaná nekem?
SMA Forráskód: [ Mindet kijelol ]
  1. /* AMX Mod script.
  2.  
  3. *
  4.  
  5. *
  6.  
  7. * AMX Rate Manager (rate_manager)
  8.  
  9. *
  10.  
  11. * (c) Copyright 2003 by Marach (marach@phreaker.net, ICQ: 242122535, AIM: marach24, MSN IM: marach24@hotmail.com)
  12.  
  13. *
  14.  
  15. * This file is provided as is (no warranties).
  16.  
  17. *
  18.  
  19. *
  20.  
  21. * This plugin will allow you to restrict clients' cl_updaterate and rate CVARs. You can set maximum and minimum
  22.  
  23. * cl_updaterate and rate values a client can use when playing on your server. Plugin checks clients' CVARs and
  24.  
  25. * corrects exceeded CVARs to the limits you set. Local players playing from LAN, players with specific IP and
  26.  
  27. * players with specific steamID can be excluded from plugin calculations (by ping, IP and steamID). Plugin is able
  28.  
  29. * to exclude all players belonging to the same network subnet (192.168.15.x for example) if you want to. Exclusion
  30.  
  31. * by ping, IP and steamID makes it possible to make two groups of clients (excluded clients and normal clients). The
  32.  
  33. * plugin can then use different bandwith limits for each group. Plugin is also able to limit bandwith of dead players
  34.  
  35. * by the percent you set. When a player is dead plugin will lower his CVARs by the set percent and restore them back
  36.  
  37. * when a new round begins. That way you can leave more server's bandwith and CPU power to alive players.
  38.  
  39. *
  40.  
  41. *
  42.  
  43. * Usage:
  44.  
  45. * - open file addons\amx\admin.cfg
  46.  
  47. * - add these lines to admin.cfg only if you don't like defaults:
  48.  
  49. * rm_maxupdr <max cl_updaterate>
  50.  
  51. * rm_minupdr <min cl_updaterate>
  52.  
  53. * rm_maxrate <max rate>
  54.  
  55. * rm_minrate <min rate>
  56.  
  57. * rm_exclmaxupdr <max cl_updaterate>
  58.  
  59. * rm_exclminupdr <min cl_updaterate>
  60.  
  61. * rm_exclmaxrate <max rate>
  62.  
  63. * rm_exclminrate <min rate>
  64.  
  65. * rm_delay <delay>
  66.  
  67. * rm_deadratio <ratio>
  68.  
  69. * rm_localping <ping>
  70.  
  71. * rm_ignoreip <IP> [IP] [IP] [IP] ...
  72.  
  73. * rm_ignoresteamid <steamID> [steamID] [steamID] [steamID] ...
  74.  
  75. * rm_announce <0 or 1>
  76.  
  77. * rm_hello <0 or 1>
  78.  
  79. * - save the changes to file admin.cfg <!-- s:) --><img src=\"{SMILIES_PATH}/icon_e_smile.gif\" alt=\":)\" title=\"mosoly\" /><!-- s:) -->
  80.  
  81. *
  82.  
  83. *
  84.  
  85. * CVAR explanation:
  86.  
  87. * rm_maxupdr - max cl_updaterate a normal client can have (default 36)
  88.  
  89. * rm_minupdr - min cl_updaterate a normal client can have (default 12)
  90.  
  91. * rm_maxrate - max rate and cl_rate a normal client can have (default 9216 = 9kb)
  92.  
  93. * rm_minrate - min rate and cl_rate a normal client can have (default 3072 = 3kb)
  94.  
  95. * rm_exclmaxupdr - max cl_updaterate an excluded client can have (default 60)
  96.  
  97. * rm_exclminupdr - min cl_updaterate an excluded client can have (default 24)
  98.  
  99. * rm_exclmaxrate - max rate and cl_rate an excluded client can have (default 15360 = 15kb)
  100.  
  101. * rm_exclminrate - min rate and cl_rate an excluded client can have (default 6144 = 6kb)
  102.  
  103. * rm_delay - delay in seconds between checking clients (default 20 seconds)
  104.  
  105. * rm_deadratio - lower dead players net setting to this ratio of default net settings (default 0.4 = 40%)
  106.  
  107. * rm_localping - plugin will exclude clients who have ping equal or lower than this value (default 0)
  108.  
  109. * rm_ignoreip - plugin will exclude clients whose IP is listed with this command
  110.  
  111. * rm_ignoresteamid - plugin will exclude clients whose steamID is listen with this command
  112.  
  113. * rm_announce - toggle announcing plugin actions on and off (default 1 = on)
  114.  
  115. * rm_hello - toggle displaying plugin info to connecting players (default 1 = on)
  116.  
  117. *
  118.  
  119. * If you leave defaults (you don't add any lines to admin.cfg) then the plugin will check all clients every 20
  120.  
  121. * seconds. Plugin will announce and correct if a normal client has cl_updaterate set below 12 or over 36. Plugin
  122.  
  123. * will do the same if a normal client has rate set below 3072 or over 9216. Excluded clients (either excluded by
  124.  
  125. * ping or IP) can set their cl_updaterate between 24 and 60, and their rate between 6144 and 15360. Plugin will
  126.  
  127. * never announce excluded clients going over set limits. Plugin will lower all dead players' net settings to 40%
  128.  
  129. * of their default net settings and restore them back when new round begins. Example: if a player has cl_updaterate
  130.  
  131. * set to 30 and rate set to 8000, when he dies plugin will set his cl_updaterate to 18 and rate to 4800. On a new
  132.  
  133. * round plugin will restore that particular player's cl_updaterate back to 30 and rate back to 8000. By default,
  134.  
  135. * players with ping 0 will not be calculated (rm_localping default value is 0). By default, plugin will display
  136.  
  137. * info message to all connecting players.
  138.  
  139. *
  140.  
  141. *
  142.  
  143. * Notes:
  144.  
  145. * - plugin has two parts that can be independently toggled on and off:
  146.  
  147. * a) net settings restriction - toggle it off by setting rm_delay to 0
  148.  
  149. * b) dead players bandwith saver - toggle it off by setting rm_deadratio to 1.0
  150.  
  151. * - set rm_localping to -1 if you want the plugin to take players with ping 0 into calculations
  152.  
  153. * - using more rm_ignoreip commands adds entries to existing ignore IP list (you steam't make a fresh new list)
  154.  
  155. * - you can add IP addresses to the ignore IP list using one rm_ignoreip with many IPs specified in one line or
  156.  
  157. * using more rm_ignoreip commands (to make it more tidy like in below example of custom settings)
  158.  
  159. * - you can exclude the hole subnet of IPs from plugin calculations by using a letter 'x' when specifying IP
  160.  
  161. * with rm_ignoreip (look below example of custom settings to see how to do it)
  162.  
  163. * - player who runs a non-dedicated server and is playing on it can be excluded from plugin calculations by
  164.  
  165. * adding an entry named 'loopback' to ignore IP list (rm_ignoreip loopback) or by ping
  166.  
  167. * - using more rm_ignoresteamid commands only adds entries to existing ignore steamID list (you steam't make a fresh
  168.  
  169. * new list every time use rm_ignoresteamid command)
  170.  
  171. * - you can add steamIDs to the ignore steamID list using one rm_ignoresteamid with many steamIDs specified in one line
  172.  
  173. * or using more rm_ignoresteamid commands (to make it more tidy like in below example of custom settings)
  174.  
  175. *
  176.  
  177. *
  178.  
  179. * Example of custom plugin settings (admin.cfg):
  180.  
  181. * rm_maxupdr 40
  182.  
  183. * rm_minupdr 20
  184.  
  185. * rm_maxrate 15000
  186.  
  187. * rm_minrate 5000
  188.  
  189. * rm_exclmaxupdr 70
  190.  
  191. * rm_exclminupdr 30
  192.  
  193. * rm_exclmaxrate 20000
  194.  
  195. * rm_exclminrate 10000
  196.  
  197. * rm_delay 30
  198.  
  199. * rm_deadratio 0.8
  200.  
  201. * rm_localping 15
  202.  
  203. * rm_ignoreip 192.168.4.12 loopback 68.120.14.155
  204.  
  205. * rm_ignoreip 148.122.5.x 165.12.x.x 195.4.202.15
  206.  
  207. * rm_ignoresteamid 627543 1945822 122986
  208.  
  209. * rm_ignoresteamid 445682
  210.  
  211. * rm_announce 0
  212.  
  213. * rm_hello 0
  214.  
  215. *
  216.  
  217. * Plugin will check clients every 30 seconds. If plugin finds cl_updaterate set below 20 or over 50, rate set below
  218.  
  219. * 5000 or over 15000 on a normal client then plugin will correct it but will not announce it. Excluded players can
  220.  
  221. * have cl_updaterate set from 30 to 70 and rate set from 10000 to 20000. Dead players will have their cl_updaterate
  222.  
  223. * and rate set to 80% of their default settings and restored back when alive again. Players with ping 15 or less will
  224.  
  225. * not be taken into calculation at all. Players having IP 192.168.4.12, 68.120.14.155, 195.4.202.15 and player playing
  226.  
  227. * from loopback (player who's running a non-dedicated server) will not be calculated. All players whose IPs starts with
  228.  
  229. * 148.122.5. and 165.12. (players belonging to subnets 148.122.5.x and 165.12.x.x) will not be taken into calculation
  230.  
  231. * at all. Players with steamIDs 627543, 1945822, 122986 and 445682 will be excluded too. No plugin info message will be
  232.  
  233. * displayed to connecting players.
  234.  
  235. *
  236.  
  237. *
  238.  
  239. */
  240.  
  241.  
  242.  
  243. #include <amxmod>
  244.  
  245.  
  246.  
  247. new origupdr[33], origrate[33], excl[33]
  248.  
  249. #define MAX_IP 32
  250.  
  251. new ignip[MAX_IP][32], ippos=0
  252.  
  253. #define MAX_steamID 128
  254.  
  255. new ignsteamid[MAX_steamID][32], steamidpos=0
  256.  
  257.  
  258.  
  259. public check_rr() {
  260.  
  261. new maxupdr=get_cvar_num("rm_maxupdr")
  262.  
  263. new minupdr=get_cvar_num("rm_minupdr")
  264.  
  265. new maxrate=get_cvar_num("rm_maxrate")
  266.  
  267. new minrate=get_cvar_num("rm_minrate")
  268.  
  269. new announce=get_cvar_num("rm_announce")
  270.  
  271. new players[32], np, i, playername[32]
  272.  
  273. new clupdr[8], clrt[16], msg[256]
  274.  
  275. new tmpupdr, tmprate, cmdexe[32]
  276.  
  277. get_players(players, np, "ac")
  278.  
  279. for(i=0; i<np; i++)
  280.  
  281. if ((players[i]!=0)&&(!is_user_hltv(players[i]))) {
  282.  
  283. get_user_ping(players[i], tmpupdr, tmprate)
  284.  
  285. if ((tmpupdr>get_cvar_num("rm_localping"))&&(excl[players[i]]==0)) {
  286.  
  287. get_user_info(players[i], "cl_updaterate", clupdr, 7)
  288.  
  289. get_user_info(players[i], "rate", clrt, 15)
  290.  
  291. tmpupdr=str_to_num(clupdr)
  292.  
  293. tmprate=str_to_num(clrt)
  294.  
  295. if (announce)
  296.  
  297. get_user_name(players[i],playername,31)
  298.  
  299. if (tmpupdr>maxupdr) {
  300.  
  301. origupdr[players[i]]=maxupdr
  302.  
  303. format(cmdexe, 31, "cl_updaterate %i", maxupdr)
  304.  
  305. client_cmd(players[i], cmdexe)
  306.  
  307. if (announce) {
  308.  
  309. format(msg, 255, "* [AMX_RM] %s set 'cl_updaterate' to '%i' (max '%i') - blocked by plugin !", playername, tmpupdr, maxupdr)
  310.  
  311. client_print(0, print_chat, msg)
  312.  
  313. }
  314.  
  315. }
  316.  
  317. if (tmpupdr<minupdr) {
  318.  
  319. origupdr[players[i]]=minupdr
  320.  
  321. format(cmdexe, 31, "cl_updaterate %i", minupdr)
  322.  
  323. client_cmd(players[i], cmdexe)
  324.  
  325. if (announce) {
  326.  
  327. format(msg, 255, "* [AMX_RM] %s set 'cl_updaterate' to '%i' (min '%i') - blocked by plugin !", playername, tmpupdr, minupdr)
  328.  
  329. client_print(0, print_chat, msg)
  330.  
  331. }
  332.  
  333. }
  334.  
  335. if (tmprate>maxrate) {
  336.  
  337. origrate[players[i]]=maxrate
  338.  
  339. format(cmdexe, 31, "rate %i", maxrate)
  340.  
  341. client_cmd(players[i], cmdexe)
  342.  
  343. format(cmdexe, 31, "cl_rate %i", maxrate)
  344.  
  345. client_cmd(players[i], cmdexe)
  346.  
  347. if (announce) {
  348.  
  349. format(msg, 255, "* [AMX_RM] %s set 'rate' to '%i' (max '%i') - blocked by plugin !", playername, tmprate, maxrate)
  350.  
  351. client_print(0, print_chat, msg)
  352.  
  353. }
  354.  
  355. }
  356.  
  357. if (tmprate<minrate) {
  358.  
  359. origrate[players[i]]=minrate
  360.  
  361. format(cmdexe, 31, "rate %i", minrate)
  362.  
  363. client_cmd(players[i], cmdexe)
  364.  
  365. format(cmdexe, 31, "cl_rate %i", minrate)
  366.  
  367. client_cmd(players[i], cmdexe)
  368.  
  369. if (announce) {
  370.  
  371. format(msg, 255, "* [AMX_RM] %s set 'rate' to '%i' (min '%i') - blocked by plugin !", playername, tmprate, minrate)
  372.  
  373. client_print(0, print_chat, msg)
  374.  
  375. }
  376.  
  377. }
  378.  
  379. }
  380.  
  381. }
  382.  
  383. new Float:freq=get_cvar_float("rm_delay")
  384.  
  385. if (freq > 0.0) set_task(freq, "check_rr")
  386.  
  387. return PLUGIN_CONTINUE
  388.  
  389. }
  390.  
  391.  
  392.  
  393. public alive_again(id) {
  394.  
  395. if ((is_user_bot(id))||(is_user_hltv(id)))
  396.  
  397. return PLUGIN_CONTINUE
  398.  
  399. if (excl[id]==1)
  400.  
  401. return PLUGIN_CONTINUE
  402.  
  403. new Float:ratio=get_cvar_float("rm_deadratio")
  404.  
  405. if (ratio==1.0)
  406.  
  407. return PLUGIN_CONTINUE
  408.  
  409. new ping, loss
  410.  
  411. get_user_ping(id, ping, loss)
  412.  
  413. if (ping>get_cvar_num("rm_localping")) {
  414.  
  415. new cmdexe[32]
  416.  
  417. format(cmdexe, 31, "cl_updaterate %i", origupdr[id])
  418.  
  419. client_cmd(id, cmdexe)
  420.  
  421. format(cmdexe, 31, "rate %i", origrate[id])
  422.  
  423. client_cmd(id, cmdexe)
  424.  
  425. format(cmdexe, 31, "cl_rate %i", origrate[id])
  426.  
  427. client_cmd(id, cmdexe)
  428.  
  429. if (get_cvar_num("rm_announce")) {
  430.  
  431. new msg[256]
  432.  
  433. format(msg, 255, "* [AMX_RM] Your net settings have been restored : 'cl_updaterate' = '%i', 'rate' = '%i'", origupdr[id], origrate[id])
  434.  
  435. client_print(id, print_chat, msg)
  436.  
  437. }
  438.  
  439. }
  440.  
  441. return PLUGIN_CONTINUE
  442.  
  443. }
  444.  
  445.  
  446.  
  447. public dead_now() {
  448.  
  449. new victim=read_data(2)
  450.  
  451. if ((is_user_bot(victim))||(is_user_hltv(victim)))
  452.  
  453. return PLUGIN_CONTINUE
  454.  
  455. if (excl[victim]==1)
  456.  
  457. return PLUGIN_CONTINUE
  458.  
  459. new Float:ratio=get_cvar_float("rm_deadratio")
  460.  
  461. if (ratio==1.0)
  462.  
  463. return PLUGIN_CONTINUE
  464.  
  465. new tmpupdr, tmprate
  466.  
  467. get_user_ping(victim, tmpupdr, tmprate)
  468.  
  469. if (tmpupdr>get_cvar_num("rm_localping")) {
  470.  
  471. new cmdexe[32]
  472.  
  473. tmpupdr=floatround(float(origupdr[victim])*ratio)
  474.  
  475. tmprate=floatround(float(origrate[victim])*ratio)
  476.  
  477. format(cmdexe, 31, "cl_updaterate %i", tmpupdr)
  478.  
  479. client_cmd(victim, cmdexe)
  480.  
  481. format(cmdexe, 31, "rate %i", tmprate)
  482.  
  483. client_cmd(victim, cmdexe)
  484.  
  485. format(cmdexe, 31, "cl_rate %i", tmprate)
  486.  
  487. client_cmd(victim, cmdexe)
  488.  
  489. if (get_cvar_num("rm_announce")) {
  490.  
  491. new msg[256]
  492.  
  493. format(msg, 255, "* [AMX_RM] Your net settings have been lowered : 'cl_updaterate' = '%i', 'rate' = '%i'", tmpupdr, tmprate)
  494.  
  495. client_print(victim, print_chat, msg)
  496.  
  497. }
  498.  
  499. }
  500.  
  501. return PLUGIN_CONTINUE
  502.  
  503. }
  504.  
  505.  
  506.  
  507. public ignore_ip(id) {
  508.  
  509. new argc=read_argc()
  510.  
  511. if (argc<2) {
  512.  
  513. console_print(id, "Usage: rm_ignoreip <IP> [IP] [IP] [IP] ...")
  514.  
  515. return PLUGIN_CONTINUE
  516.  
  517. }
  518.  
  519. for(new i=1; i<argc; i++)
  520.  
  521. if (ippos<MAX_IP) {
  522.  
  523. read_argv(i, ignip[ippos], 31)
  524.  
  525. ippos++
  526.  
  527. }
  528.  
  529. else {
  530.  
  531. console_print(id, "* [AMX_RM] Too many IP addresses added to the ignore IP list")
  532.  
  533. return PLUGIN_CONTINUE
  534.  
  535. }
  536.  
  537. return PLUGIN_CONTINUE
  538.  
  539. }
  540.  
  541.  
  542.  
  543. public ignore_steamid(id) {
  544.  
  545. new argc=read_argc()
  546.  
  547. if (argc<2) {
  548.  
  549. console_print(id, "Usage: rm_ignoresteamid <steamID> [steamID] [steamID] [steamID] ...")
  550.  
  551. return PLUGIN_CONTINUE
  552.  
  553. }
  554.  
  555. new tmp[32]
  556.  
  557. for(new i=1; i<argc; i++)
  558.  
  559. if (steamidpos<MAX_steamID) {
  560.  
  561. read_argv(i, tmp, 31)
  562.  
  563. copy(ignsteamid[steamidpos], 31, tmp)
  564.  
  565. steamidpos++
  566.  
  567. }
  568.  
  569. else {
  570.  
  571. console_print(id, "* [AMX_RM] Too many steamIDs added to the ignore steamID list")
  572.  
  573. return PLUGIN_CONTINUE
  574.  
  575. }
  576.  
  577. return PLUGIN_CONTINUE
  578.  
  579. }
  580.  
  581.  
  582.  
  583. public client_connect(id) {
  584.  
  585. if ((is_user_bot(id))||(is_user_hltv(id)))
  586.  
  587. return PLUGIN_CONTINUE
  588.  
  589. new clupdr[8], clrt[16]
  590.  
  591. get_user_info(id, "cl_updaterate", clupdr, 7)
  592.  
  593. get_user_info(id, "rate", clrt, 15)
  594.  
  595. origupdr[id]=str_to_num(clupdr)
  596.  
  597. origrate[id]=str_to_num(clrt)
  598.  
  599. excl[id]=0
  600.  
  601. new i
  602.  
  603. if (ippos>0) {
  604.  
  605. new userip[32]
  606.  
  607. get_user_ip(id, userip, 31)
  608.  
  609. copyc(userip, 31, userip, ':')
  610.  
  611. new len
  612.  
  613. for(i=0; i<ippos; i++) {
  614.  
  615. len=containi(ignip[i],".x")
  616.  
  617. if (len>-1) {
  618.  
  619. if (equal(userip, ignip[i], len)) {
  620.  
  621. excl[id]=1
  622.  
  623. break
  624.  
  625. }
  626.  
  627. }
  628.  
  629. else if (equal(userip, ignip[i])) {
  630.  
  631. excl[id]=1
  632.  
  633. break
  634.  
  635. }
  636.  
  637. }
  638.  
  639. }
  640.  
  641. if ((steamidpos>0)&&(excl[id]==0)) {
  642.  
  643. new steamid[32]
  644.  
  645. get_user_authid(id, steamid, 31)
  646.  
  647. for(i=0; i<steamidpos; i++)
  648.  
  649. if (equal(steamid,ignsteamid[i])) {
  650.  
  651. excl[id]=1
  652.  
  653. break
  654.  
  655. }
  656.  
  657. }
  658.  
  659. if (get_cvar_num("rm_hello")==0)
  660.  
  661. return PLUGIN_CONTINUE
  662.  
  663. new plgver[16]
  664.  
  665. get_cvar_string("rate_manager", plgver, 15)
  666.  
  667. client_cmd(id, "echo ======================================================================")
  668.  
  669. client_cmd(id, "echo ^"* AMX Rate Manager v%s by Marach, marach@phreaker.net, ICQ: 242122535 *^"", plgver)
  670.  
  671. new Float:freq=get_cvar_float("rm_delay")
  672.  
  673. if (freq>0.0) {
  674.  
  675. new maxupdr=get_cvar_num("rm_maxupdr")
  676.  
  677. new minupdr=get_cvar_num("rm_minupdr")
  678.  
  679. new maxrate=get_cvar_num("rm_maxrate")
  680.  
  681. new minrate=get_cvar_num("rm_minrate")
  682.  
  683. client_cmd(id, "echo ^" - allowed 'cl_updaterate' range : '%i' - '%i', you have '%i'^"", minupdr, maxupdr, origupdr[id])
  684.  
  685. client_cmd(id, "echo ^" - allowed 'rate' range : '%i' - '%i', you have '%i'^"", minrate, maxrate, origrate[id])
  686.  
  687. }
  688.  
  689. new Float:ratio=get_cvar_float("rm_deadratio")
  690.  
  691. if (ratio<1.0)
  692.  
  693. client_cmd(id, "echo ^" - dead players use %2.0f%%%% of their normal net settings^"", (ratio*100.0))
  694.  
  695. client_cmd(id, "echo ======================================================================")
  696.  
  697. return PLUGIN_CONTINUE
  698.  
  699. }
  700.  
  701.  
  702.  
  703. public client_disconnect(id) {
  704.  
  705. if ((is_user_bot(id))||(is_user_hltv(id)))
  706.  
  707. return PLUGIN_CONTINUE
  708.  
  709. origupdr[id]=get_cvar_num("rm_minupdr")
  710.  
  711. origrate[id]=get_cvar_num("rm_minrate")
  712.  
  713. excl[id]=0
  714.  
  715. return PLUGIN_CONTINUE
  716.  
  717. }
  718.  
  719.  
  720.  
  721. public set_servercvars() {
  722.  
  723. new tmp[16]
  724.  
  725. get_cvar_string("rm_exclmaxupdr", tmp, 15)
  726.  
  727. set_cvar_string("sv_maxupdaterate", tmp)
  728.  
  729. get_cvar_string("rm_exclminupdr", tmp, 15)
  730.  
  731. set_cvar_string("sv_minupdaterate", tmp)
  732.  
  733. get_cvar_string("rm_exclmaxrate", tmp, 15)
  734.  
  735. set_cvar_string("sv_maxrate", tmp)
  736.  
  737. get_cvar_string("rm_exclminrate", tmp, 15)
  738.  
  739. set_cvar_string("sv_minrate", tmp)
  740.  
  741. if (get_cvar_num("rm_announce"))
  742.  
  743. console_print(0, "* [AMX_RM] Bandwith limits for excluded players have been set")
  744.  
  745. return PLUGIN_CONTINUE
  746.  
  747. }
  748.  
  749.  
  750.  
  751. public plugin_init() {
  752.  
  753. register_plugin("Rate Manager", "1.2", "Marach")
  754.  
  755. register_cvar("rate_manager", "1.2", FCVAR_SERVER)
  756.  
  757. register_event("ResetHUD", "alive_again", "be","1=1")
  758.  
  759. register_event("DeathMsg","dead_now","a")
  760.  
  761. register_cvar("rm_maxupdr", "101")
  762.  
  763. register_cvar("rm_minupdr", "101")
  764.  
  765. register_cvar("rm_maxrate", "25000")
  766.  
  767. register_cvar("rm_minrate", "25000")
  768.  
  769. register_cvar("rm_exclmaxupdr", "101")
  770.  
  771. register_cvar("rm_exclminupdr", "101")
  772.  
  773. register_cvar("rm_exclmaxrate", "25000")
  774.  
  775. register_cvar("rm_exclminrate", "25000")
  776.  
  777. register_cvar("rm_delay", "30")
  778.  
  779. register_cvar("rm_deadratio", "1")
  780.  
  781. register_cvar("rm_localping", "0")
  782.  
  783. register_cvar("rm_announce", "1")
  784.  
  785. register_cvar("rm_hello", "1")
  786.  
  787. register_srvcmd("rm_ignoreip", "ignore_ip")
  788.  
  789. register_srvcmd("rm_ignoresteamid", "ignore_steamid")
  790.  
  791. new Float:freq=get_cvar_float("rm_delay")
  792.  
  793. if (freq>0.0) {
  794.  
  795. set_task(freq, "check_rr")
  796.  
  797. set_task(5.0, "set_servercvars")
  798.  
  799. }
  800.  
  801. return PLUGIN_CONTINUE
  802.  
  803. }
  804.  

_________________
<<eb@>>Team Website - Közösség
17Buddies - Általam készített pályák.
GameBanana - Általam készített pályák/vágott hangok.

Kép
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: AMX RATE MANAGER*
HozzászólásElküldve:2013.05.12. 22:49 
Offline
Veterán

Csatlakozott:2012.11.01. 20:49
Hozzászólások:1837
Megköszönt másnak: 25 alkalommal
Megköszönték neki: 78 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmod>
  2.  
  3. new origupdr[33], origrate[33], excl[33]
  4. #define MAX_IP 32
  5. new ignip[MAX_IP][32], ippos=0
  6. #define MAX_steamID 128
  7. new ignsteamid[MAX_steamID][32], steamidpos=0
  8.  
  9. public check_rr() {
  10. new maxupdr=get_cvar_num("rm_maxupdr")
  11. new minupdr=get_cvar_num("rm_minupdr")
  12. new maxrate=get_cvar_num("rm_maxrate")
  13. new minrate=get_cvar_num("rm_minrate")
  14. new announce=get_cvar_num("rm_announce")
  15. new players[32], np, i, playername[32]
  16. new clupdr[8], clrt[16], msg[256]
  17. new tmpupdr, tmprate, cmdexe[32]
  18. get_players(players, np, "ac")
  19. for(i=0; i<np; i++)
  20. if ((players[i]!=0)&&(!is_user_hltv(players[i]))) {
  21. get_user_ping(players[i], tmpupdr, tmprate)
  22. if ((tmpupdr>get_cvar_num("rm_localping"))&&(excl[players[i]]==0)) {
  23. get_user_info(players[i], "cl_updaterate", clupdr, 7)
  24. get_user_info(players[i], "rate", clrt, 15)
  25. tmpupdr=str_to_num(clupdr)
  26. tmprate=str_to_num(clrt)
  27. if (announce)
  28. get_user_name(players[i],playername,31)
  29. if (tmpupdr>maxupdr) {
  30. origupdr[players[i]]=maxupdr
  31. format(cmdexe, 31, "cl_updaterate %i", maxupdr)
  32. client_cmd(players[i], cmdexe)
  33. if (announce) {
  34. format(msg, 255, "* [AMX_RM] %s Beallitva 'cl_updaterate' a '%i' (max '%i') - blockolva!", playername, tmpupdr, maxupdr)
  35. client_print(0, print_chat, msg)
  36. }
  37. }
  38. if (tmpupdr<minupdr) {
  39. origupdr[players[i]]=minupdr
  40. format(cmdexe, 31, "cl_updaterate %i", minupdr)
  41. client_cmd(players[i], cmdexe)
  42. if (announce) {
  43. format(msg, 255, "* [AMX_RM] %s Beallitva 'cl_updaterate' a '%i' (min '%i') - blockolva!", playername, tmpupdr, minupdr)
  44. client_print(0, print_chat, msg)
  45. }
  46. }
  47. if (tmprate>maxrate) {
  48. origrate[players[i]]=maxrate
  49. format(cmdexe, 31, "rate %i", maxrate)
  50. client_cmd(players[i], cmdexe)
  51. format(cmdexe, 31, "cl_rate %i", maxrate)
  52. client_cmd(players[i], cmdexe)
  53. if (announce) {
  54. format(msg, 255, "* [AMX_RM] %s Beallitva 'rate' a '%i' (max '%i') - blockolva!", playername, tmprate, maxrate)
  55. client_print(0, print_chat, msg)
  56. }
  57. }
  58. if (tmprate<minrate) {
  59. origrate[players[i]]=minrate
  60. format(cmdexe, 31, "rate %i", minrate)
  61. client_cmd(players[i], cmdexe)
  62. format(cmdexe, 31, "cl_rate %i", minrate)
  63. client_cmd(players[i], cmdexe)
  64. if (announce) {
  65. format(msg, 255, "* [AMX_RM] %s Beallitva 'rate' to '%i' (min '%i') - blockolva!", playername, tmprate, minrate)
  66. client_print(0, print_chat, msg)
  67. }
  68. }
  69. }
  70. }
  71. new Float:freq=get_cvar_float("rm_delay")
  72. if (freq > 0.0) set_task(freq, "check_rr")
  73. return PLUGIN_CONTINUE
  74. }
  75.  
  76. public alive_again(id) {
  77. if ((is_user_bot(id))||(is_user_hltv(id)))
  78. return PLUGIN_CONTINUE
  79. if (excl[id]==1)
  80. return PLUGIN_CONTINUE
  81. new Float:ratio=get_cvar_float("rm_deadratio")
  82. if (ratio==1.0)
  83. return PLUGIN_CONTINUE
  84. new ping, loss
  85. get_user_ping(id, ping, loss)
  86. if (ping>get_cvar_num("rm_localping")) {
  87. new cmdexe[32]
  88. format(cmdexe, 31, "cl_updaterate %i", origupdr[id])
  89. client_cmd(id, cmdexe)
  90. format(cmdexe, 31, "rate %i", origrate[id])
  91. client_cmd(id, cmdexe)
  92. format(cmdexe, 31, "cl_rate %i", origrate[id])
  93. client_cmd(id, cmdexe)
  94. if (get_cvar_num("rm_announce")) {
  95. new msg[256]
  96. format(msg, 255, "* [AMX_RM] Az internet beallitasaid : 'cl_updaterate' = '%i', 'rate' = '%i'", origupdr[id], origrate[id])
  97. client_print(id, print_chat, msg)
  98. }
  99. }
  100. return PLUGIN_CONTINUE
  101. }
  102.  
  103. public dead_now() {
  104. new victim=read_data(2)
  105. if ((is_user_bot(victim))||(is_user_hltv(victim)))
  106. return PLUGIN_CONTINUE
  107. if (excl[victim]==1)
  108. return PLUGIN_CONTINUE
  109. new Float:ratio=get_cvar_float("rm_deadratio")
  110. if (ratio==1.0)
  111. return PLUGIN_CONTINUE
  112. new tmpupdr, tmprate
  113. get_user_ping(victim, tmpupdr, tmprate)
  114. if (tmpupdr>get_cvar_num("rm_localping")) {
  115. new cmdexe[32]
  116. tmpupdr=floatround(float(origupdr[victim])*ratio)
  117. tmprate=floatround(float(origrate[victim])*ratio)
  118. format(cmdexe, 31, "cl_updaterate %i", tmpupdr)
  119. client_cmd(victim, cmdexe)
  120. format(cmdexe, 31, "rate %i", tmprate)
  121. client_cmd(victim, cmdexe)
  122. format(cmdexe, 31, "cl_rate %i", tmprate)
  123. client_cmd(victim, cmdexe)
  124. if (get_cvar_num("rm_announce")) {
  125. new msg[256]
  126. format(msg, 255, "* [AMX_RM] Az internet beallitasaid valtoztak : 'cl_updaterate' = '%i', 'rate' = '%i'", tmpupdr, tmprate)
  127. client_print(victim, print_chat, msg)
  128. }
  129. }
  130. return PLUGIN_CONTINUE
  131. }
  132.  
  133. public ignore_ip(id) {
  134. new argc=read_argc()
  135. if (argc<2) {
  136. console_print(id, "Hasznalat: rm_ignoreip <IP> [IP] [IP] [IP] ...")
  137. return PLUGIN_CONTINUE
  138. }
  139. for(new i=1; i<argc; i++)
  140. if (ippos<MAX_IP) {
  141. read_argv(i, ignip[ippos], 31)
  142. ippos++
  143. }
  144. else {
  145. console_print(id, "* [AMX_RM] Tul sok IP cimet adott hozza a ignore IP lista")
  146. return PLUGIN_CONTINUE
  147. }
  148. return PLUGIN_CONTINUE
  149. }
  150.  
  151. public ignore_steamid(id) {
  152. new argc=read_argc()
  153. if (argc<2) {
  154. console_print(id, "Hasznalat: rm_ignoresteamid <steamID> [steamID] [steamID] [steamID] ...")
  155. return PLUGIN_CONTINUE
  156. }
  157. new tmp[32]
  158. for(new i=1; i<argc; i++)
  159. if (steamidpos<MAX_steamID) {
  160. read_argv(i, tmp, 31)
  161. copy(ignsteamid[steamidpos], 31, tmp)
  162. steamidpos++
  163. }
  164. else {
  165. console_print(id, "* [AMX_RM] Tul sok STEAMID-t adott hozza a ignore IP lista")
  166. return PLUGIN_CONTINUE
  167. }
  168. return PLUGIN_CONTINUE
  169. }
  170.  
  171. public client_connect(id) {
  172. if ((is_user_bot(id))||(is_user_hltv(id)))
  173. return PLUGIN_CONTINUE
  174. new clupdr[8], clrt[16]
  175. get_user_info(id, "cl_updaterate", clupdr, 7)
  176. get_user_info(id, "rate", clrt, 15)
  177. origupdr[id]=str_to_num(clupdr)
  178. origrate[id]=str_to_num(clrt)
  179. excl[id]=0
  180. new i
  181. if (ippos>0) {
  182. new userip[32]
  183. get_user_ip(id, userip, 31)
  184. copyc(userip, 31, userip, ':')
  185. new len
  186. for(i=0; i<ippos; i++) {
  187. len=containi(ignip[i],".x")
  188. if (len>-1) {
  189. if (equal(userip, ignip[i], len)) {
  190. excl[id]=1
  191. break
  192. }
  193. }
  194. else if (equal(userip, ignip[i])) {
  195. excl[id]=1
  196. break
  197. }
  198. }
  199. }
  200. if ((steamidpos>0)&&(excl[id]==0)) {
  201. new steamid[32]
  202. get_user_authid(id, steamid, 31)
  203. for(i=0; i<steamidpos; i++)
  204. if (equal(steamid,ignsteamid[i])) {
  205. excl[id]=1
  206. break
  207. }
  208. }
  209. if (get_cvar_num("rm_hello")==0)
  210. return PLUGIN_CONTINUE
  211. new plgver[16]
  212. get_cvar_string("rate_manager", plgver, 15)
  213. client_cmd(id, "echo ======================================================================")
  214. client_cmd(id, "echo ^"* AMX Rate Manager v%s by Marach, marach@phreaker.net, ICQ: 242122535 *^"", plgver)
  215. new Float:freq=get_cvar_float("rm_delay")
  216. if (freq>0.0) {
  217. new maxupdr=get_cvar_num("rm_maxupdr")
  218. new minupdr=get_cvar_num("rm_minupdr")
  219. new maxrate=get_cvar_num("rm_maxrate")
  220. new minrate=get_cvar_num("rm_minrate")
  221. client_cmd(id, "echo ^" - megengedett 'cl_updaterate' savszelesseg : '%i' - '%i', van '%i'^"", minupdr, maxupdr, origupdr[id])
  222. client_cmd(id, "echo ^" - megengedett 'rate' savszelesseg : '%i' - '%i', van '%i'^"", minrate, maxrate, origrate[id])
  223. }
  224. new Float:ratio=get_cvar_float("rm_deadratio")
  225. if (ratio<1.0)
  226. client_cmd(id, "echo ^" - Halott jatszo emberek %2.0f%%%% normal internet beallitasok^"", (ratio*100.0))
  227. client_cmd(id, "echo ======================================================================")
  228. return PLUGIN_CONTINUE
  229. }
  230.  
  231. public client_disconnect(id) {
  232. if ((is_user_bot(id))||(is_user_hltv(id)))
  233. return PLUGIN_CONTINUE
  234. origupdr[id]=get_cvar_num("rm_minupdr")
  235. origrate[id]=get_cvar_num("rm_minrate")
  236. excl[id]=0
  237. return PLUGIN_CONTINUE
  238. }
  239.  
  240. public set_servercvars() {
  241. new tmp[16]
  242. get_cvar_string("rm_exclmaxupdr", tmp, 15)
  243. set_cvar_string("sv_maxupdaterate", tmp)
  244. get_cvar_string("rm_exclminupdr", tmp, 15)
  245. set_cvar_string("sv_minupdaterate", tmp)
  246. get_cvar_string("rm_exclmaxrate", tmp, 15)
  247. set_cvar_string("sv_maxrate", tmp)
  248. get_cvar_string("rm_exclminrate", tmp, 15)
  249. set_cvar_string("sv_minrate", tmp)
  250. if (get_cvar_num("rm_announce"))
  251. console_print(0, "* [AMX_RM] A savszelessegek beallitva!")
  252. return PLUGIN_CONTINUE
  253. }
  254.  
  255. public plugin_init() {
  256. register_plugin("Rate Manager", "1.2", "Marach")
  257. register_cvar("rate_manager", "1.2", FCVAR_SERVER)
  258. register_event("ResetHUD", "alive_again", "be","1=1")
  259. register_event("DeathMsg","dead_now","a")
  260. register_cvar("rm_maxupdr", "36")
  261. register_cvar("rm_minupdr", "12")
  262. register_cvar("rm_maxrate", "9216")
  263. register_cvar("rm_minrate", "3072")
  264. register_cvar("rm_exclmaxupdr", "60")
  265. register_cvar("rm_exclminupdr", "24")
  266. register_cvar("rm_exclmaxrate", "15360")
  267. register_cvar("rm_exclminrate", "6144")
  268. register_cvar("rm_delay", "20")
  269. register_cvar("rm_deadratio", "0.4")
  270. register_cvar("rm_localping", "0")
  271. register_cvar("rm_announce", "1")
  272. register_cvar("rm_hello", "1")
  273. register_srvcmd("rm_ignoreip", "ignore_ip")
  274. register_srvcmd("rm_ignoresteamid", "ignore_steamid")
  275. new Float:freq=get_cvar_float("rm_delay")
  276. if (freq>0.0) {
  277. set_task(freq, "check_rr")
  278. set_task(5.0, "set_servercvars")
  279. }
  280. return PLUGIN_CONTINUE
  281. }
  282.  


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  [2 hozzászólás ] 


Ki van itt

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


Nyithatsz új 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