hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.07.05. 00:15



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: 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  [5 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: speedhack detector bug
HozzászólásElküldve:2012.08.26. 08:52 
Offline
Őstag
Avatar

Csatlakozott:2010.04.16. 16:50
Hozzászólások:1342
Megköszönt másnak: 42 alkalommal
Megköszönték neki: 58 alkalommal
Az a baj a speedhack detectrorral, hogy az ns eket kickeli csatlakozáskor és ezt kéne kivenni belőle, hogy ugyan úgy beengedje az ns ekete is. Szóval röviden az a baj, hogy akinek VALVE_ID_LAN vagy STEAM_ID_LAN azokat kikickeli csatlakozáskor. Ha nem tévedek az utolsó rész a kódban végzi ezt és azt kéne kivenni vagy átírni.
Kód:
  1. /********************************************************************************

  2. *       AMX Mod X Script.

  3. *

  4. *   Speed Hack Detector

  5. *   Formatright (C) 2009 OT

  6. *

  7. *   This program is free software; you can redistribute it and/or

  8. *   modify it under the terms of the GNU General Public License

  9. *   as published by the Free Software Foundation; either version 2

  10. *   of the License, or (at your option) any later version.

  11. *

  12. *   This program is distributed in the hope that it will be useful,

  13. *   but WITHOUT ANY WARRANTY; without even the implied warranty of

  14. *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

  15. *   GNU General Public License for more details.

  16. *

  17. *   You should have received a copy of the GNU General Public License

  18. *   along with this program; if not, write to the Free Software

  19. *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

  20. *

  21. *   In addition, as a special exception, the author gives permission to

  22. *   link the code of this program with the Half-Life Game Engine ("HL

  23. *   Engine") and Modified Game Libraries ("MODs") developed by Valve,

  24. *   L.L.C ("Valve"). You must obey the GNU General Public License in all

  25. *   respects for all of the code used other than the HL Engine and MODs

  26. *   from Valve. If you modify this file, you may extend this exception

  27. *   to your version of the file, but you are not obligated to do so. If

  28. *   you do not wish to do so, delete this exception statement from your

  29. *   version.

  30. *

  31. **********************************************************************************/

  32.  

  33. /*  [Plugin Link]


  34. */

  35.  

  36. /* [Changelog]

  37. - 2.0  - fixed everything, perfected the detection method, fixed the server lag issue that would ban players! Fixed cvar detections and added clockwindow detection.

  38. - 1.6  - fixed a problem where the plugin would not detect the developer cvar

  39. - 1.5  - added cvar for limit, improved logging

  40. - 1.4  - added developer cvar kick

  41. - 1.3  - improved logging, increaced tolerance

  42. - 1.2  - added more cvars for customization

  43. - 1.1  - added one more option to punishtype cvar

  44. - 1.0  - initial release

  45. */

  46.  

  47. /* [Credits]

  48. Empower - posted all the false bans, suggested improvements, server lag false detection problem, clockwindow information

  49. Connor  - info about corectly detecting developer cvar

  50. */

  51.  

  52. #include <amxmodx>

  53. #include <fakemeta>

  54. #include <hamsandwich>

  55.  

  56. #define add_bot_property(%1)                                            gBS_cl_bot |= (1<<(%1 - 1))

  57. #define del_bot_property(%1)                                            gBS_cl_bot &= ~(1<<(%1 - 1))

  58. #define has_bot_property(%1)                                            (gBS_cl_bot & (1<<(%1 - 1)))

  59. #define add_alive_property(%1)                                          gBS_cl_alive |= (1<<(%1 - 1))

  60. #define del_alive_property(%1)                                          gBS_cl_alive &= ~(1<<(%1 - 1))

  61. #define has_alive_property(%1)                                          (gBS_cl_alive & (1<<(%1 - 1)))

  62.  

  63. const gC_MaxIdle =  2500

  64. const gC_MaxSlots = 32

  65.  

  66. new gBS_cl_alive, gBS_cl_bot

  67. new gPV_punishtype, gPV_enable, gCV_enable, gPV_bantime, gPV_adminonly, gPV_logbans, gPV_limit

  68.  

  69. new gCLI_count[gC_MaxSlots + 1]

  70. new gCLI_loss[gC_MaxSlots + 1]

  71. new gCLI_ping[gC_MaxSlots + 1]

  72. new gCLI_buttons[gC_MaxSlots + 1]

  73. new gCLI_idlecount[gC_MaxSlots + 1]

  74. new Float:gCLF_lasttime[gC_MaxSlots + 1]

  75. new Float:gCLV_views[gC_MaxSlots + 1][3]

  76. new Float:gCLV_pviews[gC_MaxSlots + 1][3]

  77.  

  78. public plugin_init()

  79. {

  80.         register_plugin("Speed Hack Detector", "2.0", "OT")

  81.        

  82.         gPV_enable              = register_cvar("spd_enable",     "1")

  83.         gPV_punishtype  = register_cvar("spd_punishtype", "0")

  84.         gPV_bantime             = register_cvar("spd_bantime",    "0")

  85.         gPV_adminonly   = register_cvar("spd_adminonly",  "1")

  86.         gPV_logbans             = register_cvar("spd_logbans",    "1")

  87.         gPV_limit               = register_cvar("spd_limit",      "150")

  88.        

  89.         RegisterHam(Ham_Spawn, "player", "pfw_PlayerHandleAD", 1)

  90.         RegisterHam(Ham_Killed, "player", "pfw_PlayerHandleAD", 1)

  91.        

  92.         register_forward(FM_CmdStart, "pfw_CmdStart", 1)

  93.        

  94.         set_task(1.0, "tsk_ChacheCvars", 0, "", 0, "b", 0)

  95. }

  96.  

  97. public client_putinserver(id)

  98. {

  99.         del_alive_property(id)

  100.        

  101.         if (is_user_bot(id))

  102.                 add_bot_property(id)

  103.         else

  104.                 del_bot_property(id)

  105. }

  106.  

  107. public client_disconnect(id)

  108. {

  109.         del_alive_property(id)

  110.         del_bot_property(id)

  111. }

  112.  

  113. public tsk_ChacheCvars(id)

  114. {

  115.         // The !! means that we want or 0 or 1 not 34183 values

  116.         gCV_enable =    !!get_pcvar_num(gPV_enable)

  117.        

  118.         return PLUGIN_CONTINUE

  119. }

  120.  

  121. public pfw_CmdStart(id, pUC, seed)

  122. {

  123.         if (!gCV_enable)

  124.                 return FMRES_IGNORED

  125.        

  126.         if (!has_alive_property(id) || has_bot_property(id))

  127.                 return FMRES_IGNORED

  128.        

  129.         new Float:fGameTime, iButtons

  130.         new Float:vView[3]

  131.        

  132.         pev(id, pev_v_angle, vView)

  133.         fGameTime = get_gametime()

  134.         get_uc(pUC, UC_Buttons, iButtons)

  135.        

  136.         if (gCLI_count[id] > 0)

  137.         {

  138.                 if (gCLI_buttons[id] == iButtons)

  139.                 {

  140.                         if (gCLV_pviews[id][0] == vView[0] && gCLV_pviews[id][1] == vView[1] && gCLV_pviews[id][2] == vView[2])

  141.                                 gCLI_idlecount[id]++

  142.                         else

  143.                         gCLI_idlecount[id] = 0

  144.                        

  145.                         if (gCLI_idlecount[id] > gC_MaxIdle)

  146.                         {

  147.                                 gCLV_views[id][0] == -8000.0

  148.                                 gCLI_idlecount[id] = 0

  149.                         }

  150.                 }

  151.                 else

  152.                 {

  153.                         gCLI_idlecount[id] = 0

  154.                         gCLI_buttons[id] = iButtons

  155.                 }

  156.                

  157.                 gCLV_pviews[id][0] = vView[0]

  158.                 gCLV_pviews[id][1] = vView[1]

  159.                 gCLV_pviews[id][2] = vView[2]

  160.         }

  161.        

  162.         if (gCLI_count[id] < 0)

  163.         {

  164.                 gCLI_idlecount[id] = 0

  165.                 gCLI_buttons[id] = iButtons

  166.                 gCLV_pviews[id][0] = vView[0]

  167.                 gCLV_pviews[id][1] = vView[1]

  168.                 gCLV_pviews[id][2] = vView[2]

  169.         }

  170.        

  171.         if (gCLV_views[id][0] == -8000.0 && gCLI_count[id] != -9)

  172.         {

  173.                 gCLI_count[id] = -9

  174.                 return FMRES_IGNORED

  175.         }

  176.        

  177.         if (gCLI_count[id] < -2)

  178.         {

  179.                 gCLI_buttons[id] =  iButtons

  180.                 gCLV_views[id][0] = vView[0]

  181.                 gCLV_views[id][1] = vView[1]

  182.                 gCLV_views[id][2] = vView[2]

  183.                 gCLI_count[id]++

  184.                 return FMRES_IGNORED

  185.         }

  186.        

  187.         // If the user has begun targeting players

  188.         if (gCLV_views[id][0] == vView[0] && gCLV_views[id][1] == vView[1] && gCLV_views[id][2] == vView[2])

  189.         {

  190.                 gCLI_count[id] = -2

  191.                 return FMRES_IGNORED

  192.         }

  193.        

  194.         if (fGameTime - gCLF_lasttime[id] > 1.0)

  195.         {      

  196.                 if (gCLI_count[id] > get_pcvar_num(gPV_limit))

  197.                         punish_player(id)

  198.                

  199.                 if (gCLI_count[id] < 0)

  200.                         gCLI_count[id] ++

  201.                 else

  202.                 gCLI_count[id] = 0

  203.                

  204.                 gCLF_lasttime[id] = fGameTime

  205.                

  206.                 return FMRES_IGNORED

  207.         }

  208.        

  209.         if (gCLI_count[id] >= 0)

  210.         {

  211.                 new loss, ping

  212.                 get_user_ping(id, ping, loss)

  213.                

  214.                 gCLI_loss[id] = floatround(float(gCLI_loss[id] * gCLI_count[id] + loss)/float(gCLI_count[id]))

  215.                 gCLI_ping[id] = floatround(float(gCLI_ping[id] * gCLI_count[id] + ping)/float(gCLI_count[id]))

  216.                

  217.                 gCLI_count[id]++

  218.                

  219.                 if (gCLI_count[id] % 10 == 0)

  220.                 {

  221.                         query_client_cvar(id, "developer", "qcv_developer")

  222.                         query_client_cvar(id, "clockwindow", "qcv_clockwindow")

  223.                 }

  224.         }

  225.        

  226.         return FMRES_IGNORED

  227. }

  228.  

  229. public pfw_PlayerHandleAD(id)

  230. {

  231.         if (is_user_alive(id))

  232.         {

  233.                 if (!has_bot_property(id))

  234.                 {

  235.                         query_client_cvar(id, "developer", "qcv_developer")

  236.                         query_client_cvar(id, "clockwindow", "qcv_clockwindow")

  237.                 }

  238.                

  239.                 gCLF_lasttime[id] = get_gametime()

  240.                 gCLV_views[id][0] = -8000.0

  241.                 gCLI_idlecount[id] = 0

  242.                

  243.                 add_alive_property(id)

  244.         }

  245.         else

  246.                 del_alive_property(id)

  247.        

  248.         return HAM_IGNORED

  249. }

  250.  

  251. public qcv_developer(id, const cvar[], const value[])

  252. {

  253.         // Thank you Connor!

  254.         new len, counter, c, i

  255.        

  256.         len = strlen(value)

  257.         counter = 0

  258.        

  259.         for(i=0; i<len; i++)

  260.         {

  261.                 c = value[i]

  262.                

  263.                 if( c != 48 )

  264.                 {

  265.                         if( c == 46 )

  266.                         {

  267.                                 if( ++counter > 1 )

  268.                                 {

  269.                                         kick_user(id, "Kicked by Speed Hack Detector", "Reason: You cannot play with developer different than 0", "To connect set developer to 0 and leave it that way or else you will be banned.")

  270.                                 }

  271.                         }

  272.                         else

  273.                         {

  274.                                 kick_user(id, "Kicked by Speed Hack Detector", "Reason: You cannot play with developer different than 0", "To connect set developer to 0 and leave it that way or else you will be banned.")

  275.                         }

  276.                 }

  277.         }

  278. }

  279.  

  280. public qcv_clockwindow(id, const cvar[], const value[])

  281. {

  282.         if (value[0] != '0' || value[1] != '.' || value[2] != '5' || value[3] != '^0')

  283.                 kick_user(id, "Kicked by Speed Hack Detector", "Reason: You cannot play with clockwindow different than 0.5", "To connect set clockwindow to 0.5 and leave it that way or else you will be banned.")

  284. }

  285.  

  286. punish_player(id)

  287. {

  288.         new name[32]

  289.         get_user_name(id, name, 31)

  290.        

  291.         new steamid[32]

  292.         get_user_authid(id, steamid, 31)    

  293.        

  294.         new ping, loss

  295.         get_user_ping(id, ping, loss)

  296.        

  297.     // No ping = Lag period (probably false detect). Thanks Empower!

  298.         if(!ping)

  299.                 return 0

  300.        

  301.         switch (get_pcvar_num(gPV_punishtype))

  302.         {

  303.                 case 1: // AMX BANS support

  304.                 {

  305.                         server_cmd("amx_ban %d #%d ^"Speed Hack^"", abs(get_pcvar_num(gPV_bantime)), get_user_userid(id))

  306.                 }

  307.                

  308.                 case 2: // The normal ban included in admincmd.sma

  309.                 {

  310.                         server_cmd("amx_ban #%d %d ^"Speed Hack^"", get_user_userid(id), abs(get_pcvar_num(gPV_bantime)))

  311.                 }

  312.                

  313.                 case 3: // The same as previous, but without extern plugins need.

  314.                 {

  315.                         server_cmd("kick #%d ^"Speed Hack (Banned permanently)^";wait;banid ^"%d.0^" ^"%s^";wait;writeid", get_user_userid(id), abs(get_pcvar_num(gPV_bantime)), steamid)

  316.                 }

  317.                

  318.                 case 4: // IP ban, included in admincmd.sma

  319.                 {

  320.                         server_cmd("amx_banip #%d %d ^"Speed Hack^"", get_user_userid(id), abs(get_pcvar_num(gPV_bantime)))

  321.                 }

  322.                

  323.                 default:

  324.                 {

  325.                         if (get_pcvar_num(gPV_adminonly))

  326.                                 print_toadmin(name)

  327.                         else

  328.                                 client_print(0, print_chat, "[SHD] Player %s was detected using speed hack.", name)

  329.                        

  330.                         return 1

  331.                 }

  332.         }

  333.        

  334.        

  335.         new message[200]

  336.        

  337.         formatex(message, charsmax(message), "[SHD] Name: %s | Steam ID: %s | Counts: %d | Ping: %d | Loss: %d", name, steamid, gCLI_count[id], gCLI_ping[id], gCLI_loss[id])

  338.        

  339.         if (get_pcvar_num(gPV_logbans))

  340.                 log_to_file("shd_bans.log", message)

  341.        

  342.         console_print(0, message)

  343.        

  344.         if (get_pcvar_num(gPV_adminonly))

  345.                 print_toadmin(name)

  346.         else

  347.                 client_print(0, print_chat, "[SHD] Player %s", name, (0 < get_pcvar_num(gPV_punishtype) <= 4) ? "was banned because of the speed hack": "has been detected using speed hack")

  348.        

  349.         return 1

  350. }

  351.  

  352. print_toadmin(name[])

  353. {

  354.         new players[32], num, id

  355.         get_players(players, num)

  356.        

  357.         for (new i=0;i<num;i++)

  358.         {

  359.                 id = players[i]

  360.                

  361.                 if (get_user_flags(id) & ADMIN_CHAT)

  362.                         client_print(id, print_chat, "[SHD][Admin] Player %s", name, (0 < get_pcvar_num(gPV_punishtype) <= 4) ? "was banned because of the speed hack": "has been detected using speed hack")

  363.         }

  364. }

  365.  

  366. kick_user(id, line1[] = "", line2[] = "", line3[] = "")

  367. {

  368.         new msg_content[1024], pl_name[32], pl_userid, pl_authid[35]

  369.        

  370.         /* grab logging infos */

  371.         pl_userid = get_user_userid(id)

  372.         get_user_name(id, pl_name, 31)

  373.         get_user_authid(id, pl_authid, 34)

  374.        

  375.         /* do kick the player */

  376.         format(msg_content, 1023, "%s^n%s^n%s", line1, line2, line3)

  377.         message_begin(MSG_ONE, SVC_DISCONNECT, {0,0,0}, id)

  378.         write_string(msg_content)

  379.         message_end()

  380.        

  381.         /* log the kick as <kick> command do */

  382.         log_message("Kick_ML: ^"%s<%d><%s><>^" was kicked by ^"Console^" (message ^"%s^" ^"%s^" ^"%s^")", pl_name, pl_userid, pl_authid, line1, line2, line3)

  383.        

  384.         return 1

  385. }

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: speedhack detector bug
HozzászólásElküldve:2012.08.26. 12:54 
Offline
Újonc

Csatlakozott:2012.08.09. 14:44
Hozzászólások:14
get_user_authid helyett get_user_userid?
És akkor nem csak a Valve/Steam_ID-t kéri le, hanem a szerveren a játékos ID-t? ( tehát az ns-ekét is )


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: speedhack detector bug
HozzászólásElküldve:2012.08.26. 14:40 
Offline
Őstag
Avatar

Csatlakozott:2010.04.16. 16:50
Hozzászólások:1342
Megköszönt másnak: 42 alkalommal
Megköszönték neki: 58 alkalommal
Nem tom... de sztem nem azt kell átírni.

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: speedhack detector bug
HozzászólásElküldve:2012.08.27. 09:58 
Offline
Őskövület
Avatar

Csatlakozott:2013.01.01. 17:48
Hozzászólások:2441
Megköszönt másnak: 18 alkalommal
Megköszönték neki: 21 alkalommal
Küldjek egy jól bekonfigolt, speedhack detectes, Time Pass AC-t? az sokkal jobb mint az ilyen


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: speedhack detector bug
HozzászólásElküldve:2012.09.09. 09:31 
Offline
Őstag
Avatar

Csatlakozott:2010.04.16. 16:50
Hozzászólások:1342
Megköszönt másnak: 42 alkalommal
Megköszönték neki: 58 alkalommal
Na valaki tudná javitani? Sztem azért kickeli az ns-eket mert nem tartalmaz számokat az id-jük. vagy nem így van?
Nagyon fontos lenne a plugin !

ui: ezt a parancsal dobja ki az ns játékost
Host_Error: UserMsg: Not Present on Client 58 ( és akkor dob ki amikor be lépek a szerverre vagyis amikor csapatot választok )

_________________
Kép


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


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 25 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