hlmod.hu

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



Jelenlévő felhasználók

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

A legtöbb felhasználó (2883 fő) 2025.07.30. 16:00-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  [7 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: AFK Slayer
HozzászólásElküldve:2012.07.25. 12:53 
Offline
Őstag
Avatar

Csatlakozott:2012.02.14. 15:09
Hozzászólások:1423
Megköszönték neki: 2 alkalommal
Nem találtam afk slayert csak kickelőt, szóval ha van afk slayer adna valaki egy linket?

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: AFK Slayer
HozzászólásElküldve:2012.07.25. 12:54 
Offline
Developer
Avatar

Csatlakozott:2011.06.01. 21:11
Hozzászólások:7966
Megköszönt másnak: 295 alkalommal
Megköszönték neki: 537 alkalommal
Add sma, átírom

_________________
http://www.easyrankup.eu


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: AFK Slayer
HozzászólásElküldve:2012.07.25. 12:59 
Offline
Őstag
Avatar

Csatlakozott:2012.02.14. 15:09
Hozzászólások:1423
Megköszönték neki: 2 alkalommal
Ezt találtam ami értelmesebb
Kód:
  1. /*

  2. ********************************************************************************

  3. *  AMX Mod X script.

  4. *

  5. *   Hobo AFK Manager (hobo_AFK_manager.sma)

  6. *   Copyright (C) 2008-2009 hoboman

  7. *

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

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

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

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

  12. *

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

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

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

  16. *   GNU General Public License for more details.

  17. *

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

  19. *   when you downloaded AMX Mod X; if not, write to the Free Software

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

  21. *

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

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

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

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

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

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

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

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

  30. *   version.

  31. *

  32. *********************************************************************************

  33. */

  34.  

  35. /*

  36. * For a full plugin description read: http://forums.alliedmods.net/showthread.php?t=69622

  37. */

  38.  

  39. #include <amxmodx>

  40. #include <fakemeta>

  41. #include <hamsandwich>

  42.  

  43. #define PLUGIN  "Hobo AFK Manager"

  44. #define AUTHOR  "hoboman313"

  45. #define VERSION "1.2a"

  46.  

  47. #define MAX_PLAYERS 32

  48. //Admins with this flag cannot be kicked

  49. #define AFK_IMMUNITY ADMIN_IMMUNITY

  50. #define AFK_MOVE_DIST 15

  51.  

  52. #define OFFSET_TEAM 114

  53. #define OFFSET_INTERNALMODEL 126

  54.  

  55. #define PUNISH_UNASSIGNED 0

  56. #define PUNISH_SPECTATOR 1

  57. #define PUNISH_AFK_SPECTATOR 2

  58. #define PUNISH_AFK_KICK 3

  59. #define PUNISH_NOMODEL 4

  60.  

  61.  

  62. enum CsInternalModel

  63. {

  64.     CS_DONTCHANGE = 0,

  65.     CS_CT_URBAN = 1,

  66.     CS_T_TERROR = 2,

  67.     CS_T_LEET = 3,

  68.     CS_T_ARCTIC = 4,

  69.     CS_CT_GSG9 = 5,

  70.     CS_CT_GIGN = 6,

  71.     CS_CT_SAS = 7,

  72.     CS_T_GUERILLA = 8,

  73.     CS_CT_VIP = 9,

  74.     CZ_T_MILITIA = 10,

  75.     CZ_CT_SPETSNAZ = 11

  76. }

  77.  

  78. enum CsTeams

  79. {

  80.     CS_TEAM_UNASSIGNED = 0,

  81.     CS_TEAM_T = 1,

  82.     CS_TEAM_CT = 2,

  83.     CS_TEAM_SPECTATOR = 3

  84. }

  85.  

  86. new g_oldangles[MAX_PLAYERS+1][3], g_afktime[MAX_PLAYERS+1], saved_freq, bool:freezetimeOver

  87. new bool:player_spawned[MAX_PLAYERS+1],  msgSync, maxplayers, bool:selectedNoModel[MAX_PLAYERS+1]

  88. //cvars

  89. new maxAfkTime, aImmunity, kick, kickPlayers, unassignedTime, warning_time, check_frequency

  90.        

  91. public plugin_init()

  92. {

  93.         register_plugin(PLUGIN, VERSION, AUTHOR)

  94.  

  95.         check_frequency= register_cvar("hobo_afk_frequency", "1.0")

  96.         maxAfkTime = register_cvar("hobo_afk_time", "60")

  97.         aImmunity = register_cvar("hobo_afk_immunity", "1")

  98.         kick = register_cvar("hobo_afk_kick", "0")

  99.         kickPlayers = register_cvar("hobo_afk_spectator_kick", "16")

  100.         unassignedTime = register_cvar("hobo_afk_unassigned_time", "60")

  101.         warning_time = register_cvar("hobo_afk_warning_time", "10" )

  102.  

  103.         msgSync = CreateHudSyncObj()

  104.         maxplayers = get_maxplayers()

  105.        

  106.         register_logevent("round_start_event", 2, "1=Round_Start")

  107.  

  108.         RegisterHam(Ham_Spawn, "player", "player_spawn", 1)

  109.        

  110.         if( get_cvar_num("mp_freezetime") > 0 )

  111.                 register_event("HLTV", "event_new_round", "a", "1=0", "2=0")

  112.        

  113.         saved_freq=get_pcvar_num(check_frequency)

  114.         set_task(get_pcvar_float(check_frequency), "checkPlayers", 31337, _, _, "b")

  115. }

  116.  

  117.  

  118. public player_spawn(id)

  119. {

  120.         if( is_user_alive(id) && !is_user_bot(id) )

  121.         {

  122.                 new arrId[1]

  123.                 arrId[0]=id

  124.                 //player isn't considered spawned until he drops to the ground

  125.                 set_task( 0.5, "playerSpawned", id, arrId, 1  )

  126.         }

  127. }

  128.  

  129.  

  130. public event_new_round()

  131.         freezetimeOver=false

  132.  

  133.  

  134. public round_start_event()

  135. {

  136.         for( new i = 1; i <= maxplayers; i++ )

  137.         {

  138.                 player_spawned[i] = false

  139.                

  140.                 if( is_user_connected(i) && ( fm_get_user_team(i) == CS_TEAM_CT || fm_get_user_team(i) == CS_TEAM_T ) && !is_user_alive(i) && checkImmunity(i) )

  141.                 {

  142.                         if( selectedNoModel[i] == true )

  143.                                 punish_player( i, PUNISH_NOMODEL )

  144.                                

  145.                         selectedNoModel[i]=true

  146.                 }

  147.                 else

  148.                         selectedNoModel[i]=false

  149.         }

  150.        

  151.         if( saved_freq != get_pcvar_num(check_frequency) )

  152.         {

  153.                 change_task( 31337, get_pcvar_float(check_frequency) )

  154.                 saved_freq = get_pcvar_num(check_frequency)    

  155.         }

  156.        

  157.         freezetimeOver=true

  158. }

  159.  

  160.  

  161. public checkPlayers()

  162. {

  163.         static newangle[3]

  164.        

  165.         if(freezetimeOver)

  166.         {

  167.                 for ( new i = 1; i <= maxplayers; i++ )

  168.                 {

  169.                         if ( is_user_alive(i) && player_spawned[i] )

  170.                         {

  171.                                 get_user_origin( i, newangle )

  172.  

  173.                                 if ( abs(newangle[0]-g_oldangles[i][0]) < AFK_MOVE_DIST && abs(newangle[1]-g_oldangles[i][1]) < AFK_MOVE_DIST && abs(newangle[2]-g_oldangles[i][2]) < AFK_MOVE_DIST )

  174.                                 {

  175.                                         g_afktime[i] += get_pcvar_num(check_frequency)

  176.                                        

  177.                                         check_afktime(i)

  178.                                 }

  179.                                 else

  180.                                 {

  181.                                         g_oldangles[i][0] = newangle[0]

  182.                                         g_oldangles[i][1] = newangle[1]

  183.                                         g_oldangles[i][2] = newangle[2]

  184.                                         g_afktime[i] = 0

  185.                                 }

  186.                         }

  187.                 }

  188.         }

  189. }

  190.  

  191.  

  192. public check_afktime(id)

  193. {

  194.         new afkTimeTmp = get_pcvar_num( maxAfkTime ), afkTimeLeft, kickOrSpect

  195.        

  196.         static punishName[17]

  197.        

  198.         afkTimeLeft = afkTimeTmp - g_afktime[id]

  199.        

  200.         if ( afkTimeLeft <= get_pcvar_num(warning_time) )

  201.         {      

  202.                 if( ( get_pcvar_num(kick) || get_playersnum() > get_pcvar_num(kickPlayers) ) && checkImmunity(id) )

  203.                 {

  204.                         kickOrSpect=1

  205.                         punishName="kicked"

  206.                 }

  207.                 else

  208.                 {

  209.                         kickOrSpect=0

  210.                         punishName="put to Spectator"

  211.                 }

  212.                

  213.                 if(afkTimeLeft>0)

  214.                 {

  215.                         set_hudmessage(0, 100, 200, -1.0, 0.25, 1, 0.1, 3.0, 0.05, 0.05, -1)

  216.                         ShowSyncHudMsg( id, msgSync, "You have %d seconds to move or you will be %s for being AFK", afkTimeLeft, punishName )

  217.                 }

  218.         }

  219.        

  220.         if( g_afktime[id] >= afkTimeTmp )

  221.         {

  222.                 if( kickOrSpect==1 )

  223.                         punish_player(id, PUNISH_AFK_KICK )    

  224.                 else

  225.                         punish_player(id, PUNISH_AFK_SPECTATOR )

  226.                

  227.                 g_afktime[id]=0

  228.         }

  229. }

  230.  

  231.  

  232. public client_disconnect(id)

  233. {      

  234.         g_afktime[id] = 0

  235.         selectedNoModel[id]= false     

  236. }

  237.  

  238.  

  239. //a player connected so we must find and kick a spectator if there are any

  240. public client_putinserver(id)

  241. {

  242.         if( is_user_bot(id) || is_user_hltv(id) )

  243.                 return

  244.        

  245.         if( checkImmunity(id) )

  246.         {

  247.                 new arrId[1]

  248.                 arrId[0] = id

  249.                 set_task( get_pcvar_float( unassignedTime ), "check_unassigned", id+40, arrId, 1 )

  250.         }

  251.        

  252.         if( get_playersnum() > get_pcvar_num(kickPlayers) )

  253.         {

  254.                 for( new i=1; i<=maxplayers; i++ )

  255.                 {

  256.                         if( is_user_connected(i) && fm_get_user_team(i) == CS_TEAM_SPECTATOR && checkImmunity(i) )

  257.                         {

  258.                                 punish_player( i, PUNISH_SPECTATOR )

  259.                                 break

  260.                         }

  261.                 }

  262.         }

  263. }

  264.  

  265.  

  266. public check_unassigned( arrId[] )

  267. {

  268.         new id=arrId[0]

  269.        

  270.         //if the player is unassigned after x seconds then kick him

  271.         if( is_user_connected(id) && fm_get_user_team( id ) == CS_TEAM_UNASSIGNED )

  272.                 punish_player( id, PUNISH_UNASSIGNED )

  273. }

  274.  

  275.  

  276. public playerSpawned(arrId[])

  277. {

  278.         new id=arrId[0]

  279.         get_user_origin( id, g_oldangles[id] )

  280.         player_spawned[id] = true

  281. }

  282.  

  283.  

  284. stock punish_player( id, punishType )

  285. {

  286.         static name[32]

  287.         get_user_name(id, name, 31)

  288.        

  289.         switch(punishType)

  290.         {

  291.                 case PUNISH_UNASSIGNED:

  292.                 {

  293.                         client_print( 0, print_chat, "%s was kicked for being unnassigned longer than %d seconds", name, get_pcvar_num(unassignedTime) )

  294.                         server_cmd("kick #%d ^"You were kicked for being unassigned for more than %d seconds^"", get_user_userid(id ), get_pcvar_num(unassignedTime) ) 

  295.                 }

  296.                 case PUNISH_SPECTATOR:

  297.                 {

  298.                         client_print( 0, print_chat, "%s was kicked for spectating on a server with more than %d players", name, get_pcvar_num(kickPlayers) )

  299.                         server_cmd( "kick #%d ^"The server is getting too full to allow spectators^"", get_user_userid(id) )

  300.                 }

  301.                 case PUNISH_AFK_KICK:

  302.                 {

  303.                         client_print(0, print_chat, "%s was kicked for being AFK longer than %d seconds", name, get_pcvar_num(maxAfkTime) )

  304.                         server_cmd("kick #%d ^"You were kicked for being AFK longer than %d seconds^"", get_user_userid(id), get_pcvar_num(maxAfkTime) )

  305.                 }

  306.                 case PUNISH_AFK_SPECTATOR:

  307.                 {

  308.                         client_print(0, print_chat, "%s was put to Spectator for being AFK longer than %d seconds", name, get_pcvar_num(maxAfkTime) )

  309.                         user_silentkill(id)

  310.                         fm_set_user_team( id, CS_TEAM_SPECTATOR )

  311.                 }

  312.                 case PUNISH_NOMODEL:

  313.                 {

  314.                         client_print(0, print_chat, "%s was kicked for joining a team and idling without choosing a model.", name )

  315.                         server_cmd("kick #%d ^"You were kicked for joining a team and idling without choosing a model.^"", get_user_userid(id) )

  316.                 }

  317.         }

  318. }

  319.  

  320.  

  321. public checkImmunity(id)

  322. {

  323.         //if immunity is disabled

  324.         if( get_pcvar_num(aImmunity)==0 )

  325.                 return true

  326.         //admin has AFK_IMMUNITY flag

  327.         else if( get_user_flags(id) & AFK_IMMUNITY )

  328.                 return false

  329.        

  330.         return true    

  331. }

  332.  

  333.  

  334. stock fm_set_user_team(id, CsTeams:team)

  335. {

  336.     set_pdata_int(id, OFFSET_TEAM, _:team)

  337.  

  338.     dllfunc(DLLFunc_ClientUserInfoChanged, id)

  339.  

  340.     static teaminfo[12], iMsgid_TeamInfo

  341.     switch(team)

  342.     {

  343.         case CS_TEAM_UNASSIGNED:

  344.                         teaminfo="UNASSIGNED"

  345.         case CS_TEAM_T:

  346.                         teaminfo="TERRORIST"

  347.         case CS_TEAM_CT:

  348.                         teaminfo="CT"

  349.         case CS_TEAM_SPECTATOR:

  350.                         teaminfo="SPECTATOR"

  351.     }

  352.  

  353.     if(!iMsgid_TeamInfo)

  354.         iMsgid_TeamInfo = get_user_msgid("TeamInfo")

  355.        

  356.     message_begin(MSG_ALL, iMsgid_TeamInfo)

  357.     write_byte(id)

  358.     write_string(teaminfo)

  359.     message_end()

  360. }

  361.  

  362.  

  363. stock CsTeams:fm_get_user_team(id)

  364.     return CsTeams:get_pdata_int(id, OFFSET_TEAM)

  365.  

  366.  

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: AFK Slayer
HozzászólásElküldve:2012.07.26. 10:24 
Offline
Őskövület
Avatar

Csatlakozott:2012.02.27. 09:42
Hozzászólások:2588
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 418 alkalommal
tessék : https://forums.alliedmods.net/showthread.php?t=86115
Kód:
  1.  

  2. #include <amxmodx>

  3. #include <amxmisc>

  4. #include <hamsandwich>

  5. #include <fakemeta>

  6. #define TIME 20.0

  7. new Float:player_origin[3][33];

  8. public plugin_init()

  9. {

  10.      RegisterHam(Ham_Spawn, "player", "e_Spawn", 1);

  11. }

  12.  

  13. public e_Spawn(id)

  14. {

  15.      if(is_user_alive(id))

  16.      {

  17.            pev(id, pev_origin, player_origin[id]);

  18.            set_task(TIME, "check_afk", id);

  19.      }

  20.      return HAM_IGNORED;

  21. }

  22.  

  23. public check_afk(id)

  24. {

  25.      if(is_user_alive(id))

  26.      if(same_origin(id))

  27.      {

  28.      user_kill(id);

  29.      new name[33];

  30.      get_user_name(id, name, 32);

  31.      client_print(0, print_chat, "%s was killed for being an AFK.", name);

  32.      }

  33. }

  34.  

  35. public same_origin(id)

  36. {

  37.        new Float:origin[3];

  38.        pev(id, pev_origin, origin);

  39.        for(new i = 0; i < 3; i++)

  40.              if(origin[i] != player_origin[i][id])

  41.                    return 0;

  42.        return 1;

  43. }

  44.  

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: AFK Slayer
HozzászólásElküldve:2012.07.26. 10:27 
Offline
Developer
Avatar

Csatlakozott:2011.06.01. 21:11
Hozzászólások:7966
Megköszönt másnak: 295 alkalommal
Megköszönték neki: 537 alkalommal
Ennek köze nincs hozzá ami kért... Amm mar Silent megcsinalta

_________________
http://www.easyrankup.eu


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: AFK Slayer
HozzászólásElküldve:2012.07.26. 10:30 
Offline
Őskövület
Avatar

Csatlakozott:2012.02.27. 09:42
Hozzászólások:2588
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 418 alkalommal
kiki írta:
Ennek köze nincs hozzá ami kért... Amm mar Silent megcsinalta


nem afk megölőt kért? ez azt csinálja ...

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: AFK Slayer
HozzászólásElküldve:2012.07.26. 10:36 
Offline
Developer
Avatar

Csatlakozott:2011.06.01. 21:11
Hozzászólások:7966
Megköszönt másnak: 295 alkalommal
Megköszönték neki: 537 alkalommal
Ja de, de semmi értelme akkor se!

_________________
http://www.easyrankup.eu


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


Ki van itt

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