hlmod.hu

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



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: Bing [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  [ 9 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: KÉSZ! AFK bombás bomba átadás
HozzászólásElküldve: 2015.08.10. 16:05 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.12.15. 19:13
Hozzászólások: 419
Megköszönt másnak: 212 alkalommal
Megköszönték neki: 13 alkalommal
Hali!
Az alábbi plugint légyszíves valaki alakítsa át úgy, hogy mindazt, amit kiír NE HUD-ba, hanem CHAT-be írja ki és lehessen színezni.

SMA Forráskód: [ Mindet kijelol ]HLMOD.HU Forrás Megtekintés - http://www.hlmod.hu/* AMX Mod X* AFK Bomb Transfer** (c) Copyright 2006 by VEN** This file is provided as is (no warranties)** DESCRIPTION* Plugin allow transfer bomb from AFK terrorist to closest non-AFK teammate.* Plugin will have no effect:* - at the freezetime* - if bomb is planting* - on non-bomb maps (comment #define BOMB_MAP_CHECK to suppress)** MODULES* fakemeta** CVARS* afk_bombtransfer_spawn (N: seconds, default: 7) - max. allowed bomb carrier AFK time* affects on spawned AFK bomb carrier which never moved after spawn** afk_bombtransfer_time (N: seconds, default: 15) - max. allowed bomb carrier AFK time* affects on any AFK bomb carrier except one which obey previous CVAR** HUD MESSAGES* Terrorist team (green color)* Bomb transferred to "NEW_CARRIER_NAME"* since "AFK_CARRIER_NAME" is AFK** New bomb carrier (yellow color)* You got the bomb!** Note: by defult message display time is 7 seconds (define MSG_TIME)** VERSIONS* 0.4 backpack transfer method greatly improved* added pcvar natives support (backward compatibility saved)* few code optimization* 0.3 now fakemeta instead of engine required (efficiency++ if engine is disabled)* "non-bomb map" check can be disabled (//#define BOMB_MAP_CHECK)* backpack finding method improved* few code optimization* added comments to the plugin source code* 0.2 fixed format issue* code optimized* description improved** 0.1 first release*/ /* *************************************************** Init **************************************************** */ #include <amxmodx>#include <fakemeta> // plugin's main information#define PLUGIN_NAME "AFK Bomb Transfer"#define PLUGIN_VERSION "0.4"#define PLUGIN_AUTHOR "VEN" // comment to avoid autodisabling the plugin on maps which not contain bomb targets#define BOMB_MAP_CHECK // float value, hud messages display time (in seconds)#define MSG_TIME 7.0 // CVAR name, affects on spawned AFK bomb carrier which never moved after spawnnew CVAR_SPAWN[] = "afk_bombtransfer_spawn" // CVAR value, max. allowed bomb carrier AFK time (in seconds)new DEFAULT_SPAWN[] = "7" // CVAR name, affects on any AFK bomb carrier except one which obey previous CVARnew CVAR_TIME[] = "afk_bombtransfer_time" // CVAR value, max. allowed bomb carrier AFK time (in seconds)new DEFAULT_TIME[] = "15" // do not set this value less than "maxplayers"#define MAX_PLAYERS 32 // initial AMXX version number supported CVAR pointers in get/set_pcvar_* natives#define CVAR_POINTERS_AMXX_INIT_VER_NUM 170 // determine if get/set_pcvar_* natives can be used#if defined AMXX_VERSION_NUM && AMXX_VERSION_NUM >= CVAR_POINTERS_AMXX_INIT_VER_NUM #define CVAR_POINTERS new g_pcvar_spawn new g_pcvar_time#endif new TEAM[] = "TERRORIST"new WEAPON[] = "weapon_c4" #define FL_ONGROUND (1<<9) new bool:g_freezetime = truenew bool:g_spawnnew bool:g_planting new g_carrier new g_pos[MAX_PLAYERS + 1][3]new g_time[MAX_PLAYERS + 1] new g_maxplayers public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR) #if defined CVAR_POINTERS g_pcvar_spawn = register_cvar(CVAR_SPAWN, DEFAULT_SPAWN) g_pcvar_time = register_cvar(CVAR_TIME, DEFAULT_TIME)#else register_cvar(CVAR_SPAWN, DEFAULT_SPAWN) register_cvar(CVAR_TIME, DEFAULT_TIME)#endif #if defined BOMB_MAP_CHECK // is current map not contain bomb targets? if (!engfunc(EngFunc_FindEntityByString, -1, "classname", "func_bomb_target")) return#endif  register_event("WeapPickup", "event_got_bomb", "be", "1=6") register_event("BarTime", "event_bar_time", "be") register_event("TextMsg", "event_bomb_drop", "bc", "2=#Game_bomb_drop") register_event("TextMsg", "event_bomb_drop", "a", "2=#Bomb_Planted") register_event("HLTV", "event_new_round", "a", "1=0", "2=0")  register_logevent("logevent_round_start", 2, "1=Round_Start")  set_task(1.0, "task_afk_check", _, _, _, "b") // plugin's core loop  g_maxplayers = get_maxplayers()} /* *************************************************** Base **************************************************** */ public event_new_round() { g_freezetime = true g_spawn = true g_planting = false g_carrier = 0} public event_got_bomb(id) { g_carrier = id} public event_bar_time(id) { if (id == g_carrier) { g_planting = bool:read_data(1) get_user_origin(id, g_pos[id]) g_time[id] = 0 }} public event_bomb_drop() { g_spawn = false g_planting = false g_carrier = 0} public logevent_round_start() { new id[32], num get_players(id, num, "ae", TEAM)  if (!num) // is server empty? return  g_freezetime = false  // update afk timers and current positions new x for (new i = 0; i < num; ++i) { x = id get_user_origin(x, g_pos[x]) g_time[x] = 0 }} public task_afk_check() { if (g_freezetime) // is freezetime right now? return  // afk check new id[32], num, x, origin[3] get_players(id, num, "ae", TEAM) for (new i = 0; i < num; ++i) { x = id[i] get_user_origin(x, origin) if (origin[0] != g_pos[x][0] || origin[1] != g_pos[x][1] || (x == g_carrier && g_planting)) { g_time[x] = 0 g_pos[x][0] = origin[0] g_pos[x][1] = origin[1] if (g_spawn && x == g_carrier) g_spawn = false } else g_time[x]++ }  // is bomb not currently carried or Ts number less than 2? if (!g_carrier || num < 2) return #if defined CVAR_POINTERS new max_time = get_pcvar_num(g_spawn ? g_pcvar_spawn : g_pcvar_time)#else new max_time = get_cvar_num(g_spawn ? CVAR_SPAWN : CVAR_TIME)#endif  // is plugin disabled (cvar <= 0) or carrier isn't afk? if (max_time <= 0 || g_time[g_carrier] < max_time) return  // find who from non-afk Ts is the closest to the afk carrier get_user_origin(g_carrier, origin) new min_dist = 999999, dist, recipient, origin2[3] for (new i = 0; i < num; ++i) { x = id[i] if (g_time[x] < max_time) { get_user_origin(x, origin2) dist = get_distance(origin, origin2) if (dist < min_dist) { min_dist = dist recipient = x } } }  if (!recipient) // is all Ts afk? return  new carrier = g_carrier engclient_cmd(carrier, "drop", WEAPON) // drop the backpack new c4 = engfunc(EngFunc_FindEntityByString, -1, "classname", WEAPON) // find weapon_c4 entity if (!c4) return  new backpack = pev(c4, pev_owner) // get backpack entity if (backpack <= g_maxplayers) return  // my backpack transfer trick (improved) set_pev(backpack, pev_flags, pev(backpack, pev_flags) | FL_ONGROUND) dllfunc(DLLFunc_Touch, backpack, recipient)  // hud messages stuff below set_hudmessage(0, 255, 0, 0.35, 0.8, _, _, MSG_TIME) new message[128], c_name[32], r_name[32] get_user_name(carrier, c_name, 31) get_user_name(recipient, r_name, 31) format(message, 127, "A bombat att adtak ^"%s^"^n-nek mert ^"%s^" AFKzik!", r_name, c_name) for (new i = 0; i < num; ++i) show_hudmessage(id[i], "%s", message)  set_hudmessage(255, 255, 0, 0.42, 0.3, _, _, MSG_TIME, _, _, 3) show_hudmessage(recipient, "Meg kaptad a Bombat!")} /* **************************************************** EOF **************************************************** */ 
[i]Előre is köszönöm!

_________________
2021.03.01-re rem. készen lesz az új SNIPER szerverem RENGETEG egyedi dologgal megfűszerezve.
De nem lövök le előre semmit :)


A hozzászólást 2 alkalommal szerkesztették, utoljára ZiT3K 2021.02.13. 02:25-kor.

Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: BOMBA AFK ÁTADÓ(átalakítás)
HozzászólásElküldve: 2015.08.10. 16:16 
Offline
Jómunkásember
Avatar

Csatlakozott: 2015.04.18. 17:14
Hozzászólások: 454
Megköszönt másnak: 48 alkalommal
Megköszönték neki: 32 alkalommal
Szia! Próbáld meg.

Színek: !g = Zöld , !y = Sárga , !t = Csapat Szín [CT= KÉK, T= PIROS, SPEC= Szürke]

SMA Forráskód: [ Mindet kijelol ]
  1.  
  2. #include <amxmodx>
  3. #include <fakemeta>
  4.  
  5. // plugin's main information
  6. #define PLUGIN_NAME "AFK Bomb Transfer"
  7. #define PLUGIN_VERSION "0.4"
  8. #define PLUGIN_AUTHOR "VEN"
  9.  
  10. // comment to avoid autodisabling the plugin on maps which not contain bomb targets
  11. #define BOMB_MAP_CHECK
  12.  
  13. // float value, hud messages display time (in seconds)
  14. #define MSG_TIME 7.0
  15.  
  16. // CVAR name, affects on spawned AFK bomb carrier which never moved after spawn
  17. new CVAR_SPAWN[] = "afk_bombtransfer_spawn"
  18.  
  19. // CVAR value, max. allowed bomb carrier AFK time (in seconds)
  20. new DEFAULT_SPAWN[] = "7"
  21.  
  22. // CVAR name, affects on any AFK bomb carrier except one which obey previous CVAR
  23. new CVAR_TIME[] = "afk_bombtransfer_time"
  24.  
  25. // CVAR value, max. allowed bomb carrier AFK time (in seconds)
  26. new DEFAULT_TIME[] = "15"
  27.  
  28. // do not set this value less than "maxplayers"
  29. #define MAX_PLAYERS 32
  30.  
  31. // initial AMXX version number supported CVAR pointers in get/set_pcvar_* natives
  32. #define CVAR_POINTERS_AMXX_INIT_VER_NUM 170
  33.  
  34. // determine if get/set_pcvar_* natives can be used
  35. #if defined AMXX_VERSION_NUM && AMXX_VERSION_NUM >= CVAR_POINTERS_AMXX_INIT_VER_NUM
  36. #define CVAR_POINTERS
  37. new g_pcvar_spawn
  38. new g_pcvar_time
  39. #endif
  40.  
  41. new TEAM[] = "TERRORIST"
  42. new WEAPON[] = "weapon_c4"
  43.  
  44. #define FL_ONGROUND (1<<9)
  45.  
  46. new bool:g_freezetime = true
  47. new bool:g_spawn
  48. new bool:g_planting
  49.  
  50. new g_carrier
  51.  
  52. new g_pos[MAX_PLAYERS + 1][3]
  53. new g_time[MAX_PLAYERS + 1]
  54.  
  55. new g_maxplayers
  56.  
  57. public plugin_init() {
  58. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
  59.  
  60. #if defined CVAR_POINTERS
  61. g_pcvar_spawn = register_cvar(CVAR_SPAWN, DEFAULT_SPAWN)
  62. g_pcvar_time = register_cvar(CVAR_TIME, DEFAULT_TIME)
  63. #else
  64. register_cvar(CVAR_SPAWN, DEFAULT_SPAWN)
  65. register_cvar(CVAR_TIME, DEFAULT_TIME)
  66. #endif
  67.  
  68. #if defined BOMB_MAP_CHECK
  69. // is current map not contain bomb targets?
  70. if (!engfunc(EngFunc_FindEntityByString, -1, "classname", "func_bomb_target"))
  71. return
  72. #endif
  73.  
  74. register_event("WeapPickup", "event_got_bomb", "be", "1=6")
  75. register_event("BarTime", "event_bar_time", "be")
  76. register_event("TextMsg", "event_bomb_drop", "bc", "2=#Game_bomb_drop")
  77. register_event("TextMsg", "event_bomb_drop", "a", "2=#Bomb_Planted")
  78. register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
  79.  
  80. register_logevent("logevent_round_start", 2, "1=Round_Start")
  81.  
  82. set_task(1.0, "task_afk_check", _, _, _, "b") // plugin's core loop
  83.  
  84. g_maxplayers = get_maxplayers()
  85. }
  86.  
  87. /* *************************************************** Base **************************************************** */
  88.  
  89. public event_new_round() {
  90. g_freezetime = true
  91. g_spawn = true
  92. g_planting = false
  93. g_carrier = 0
  94. }
  95.  
  96. public event_got_bomb(id) {
  97. g_carrier = id
  98. }
  99.  
  100. public event_bar_time(id) {
  101. if (id == g_carrier) {
  102. g_planting = bool:read_data(1)
  103. get_user_origin(id, g_pos[id])
  104. g_time[id] = 0
  105. }
  106. }
  107.  
  108. public event_bomb_drop() {
  109. g_spawn = false
  110. g_planting = false
  111. g_carrier = 0
  112. }
  113.  
  114. public logevent_round_start() {
  115. new id[32], num
  116. get_players(id, num, "ae", TEAM)
  117.  
  118. if (!num) // is server empty?
  119. return
  120.  
  121. g_freezetime = false
  122.  
  123. // update afk timers and current positions
  124. new x
  125. for (new i = 0; i < num; ++i) {
  126. get_user_origin(x, g_pos[x])
  127. g_time[x] = 0
  128. }
  129. }
  130.  
  131. public task_afk_check() {
  132. if (g_freezetime) // is freezetime right now?
  133. return
  134.  
  135. // afk check
  136. new id[32], num, x, origin[3]
  137. get_players(id, num, "ae", TEAM)
  138. for (new i = 0; i < num; ++i) {
  139. x = id[i]
  140. get_user_origin(x, origin)
  141. if (origin[0] != g_pos[x][0] || origin[1] != g_pos[x][1] || (x == g_carrier && g_planting)) {
  142. g_time[x] = 0
  143. g_pos[x][0] = origin[0]
  144. g_pos[x][1] = origin[1]
  145. if (g_spawn && x == g_carrier)
  146. g_spawn = false
  147. }
  148. else
  149. g_time[x]++
  150. }
  151.  
  152. // is bomb not currently carried or Ts number less than 2?
  153. if (!g_carrier || num < 2)
  154. return
  155.  
  156. #if defined CVAR_POINTERS
  157. new max_time = get_pcvar_num(g_spawn ? g_pcvar_spawn : g_pcvar_time)
  158. #else
  159. new max_time = get_cvar_num(g_spawn ? CVAR_SPAWN : CVAR_TIME)
  160. #endif
  161.  
  162. // is plugin disabled (cvar <= 0) or carrier isn't afk?
  163. if (max_time <= 0 || g_time[g_carrier] < max_time)
  164. return
  165.  
  166. // find who from non-afk Ts is the closest to the afk carrier
  167. get_user_origin(g_carrier, origin)
  168. new min_dist = 999999, dist, recipient, origin2[3]
  169. for (new i = 0; i < num; ++i) {
  170. x = id[i]
  171. if (g_time[x] < max_time) {
  172. get_user_origin(x, origin2)
  173. dist = get_distance(origin, origin2)
  174. if (dist < min_dist) {
  175. min_dist = dist
  176. recipient = x
  177. }
  178. }
  179. }
  180.  
  181. if (!recipient) // is all Ts afk?
  182. return
  183.  
  184. new carrier = g_carrier
  185. engclient_cmd(carrier, "drop", WEAPON) // drop the backpack
  186. new c4 = engfunc(EngFunc_FindEntityByString, -1, "classname", WEAPON) // find weapon_c4 entity
  187. if (!c4)
  188. return
  189.  
  190. new backpack = pev(c4, pev_owner) // get backpack entity
  191. if (backpack <= g_maxplayers)
  192. return
  193.  
  194. // my backpack transfer trick (improved)
  195. set_pev(backpack, pev_flags, pev(backpack, pev_flags) | FL_ONGROUND)
  196. dllfunc(DLLFunc_Touch, backpack, recipient)
  197.  
  198. // hud messages stuff below
  199. set_hudmessage(0, 255, 0, 0.35, 0.8, _, _, MSG_TIME)
  200. new c_name[32], r_name[32]
  201. get_user_name(carrier, c_name, 31)
  202. get_user_name(recipient, r_name, 31)
  203.  
  204. print_color(recipient, "!yA bombat att adtak !t^"%s^"!y-nek mert !t^"%s^"!y AFKzik!",r_name,c_name)
  205.  
  206. for (new i = 0; i < num; ++i)
  207.  
  208.  
  209. print_color(recipient, "!g[Információ]!y Megkaptad a !tBombát!y!")
  210.  
  211. }
  212.  
  213.  
  214.  
  215. stock print_color(const id, const input[], any:...)
  216. {
  217. new count = 1, players[32]
  218. static msg[191]
  219. vformat(msg, 190, input, 3)
  220.  
  221. replace_all(msg, 190, "!g", "^4")
  222. replace_all(msg, 190, "!y", "^1")
  223. replace_all(msg, 190, "!t", "^3")
  224. replace_all(msg, 190, "á", "á")
  225. replace_all(msg, 190, "é", "Ă©")
  226. replace_all(msg, 190, "í", "Ă­")
  227. replace_all(msg, 190, "ó", "Ăł")
  228. replace_all(msg, 190, "ö", "ö")
  229. replace_all(msg, 190, "ő", "Ĺ‘")
  230. replace_all(msg, 190, "ú", "Ăş")
  231. replace_all(msg, 190, "ü", "ĂĽ")
  232. replace_all(msg, 190, "ű", "ű")
  233. replace_all(msg, 190, "Á", "Á")
  234. replace_all(msg, 190, "É", "É")
  235. replace_all(msg, 190, "Í", "ĂŤ")
  236. replace_all(msg, 190, "Ó", "Ă“")
  237. replace_all(msg, 190, "Ö", "Ă–")
  238. replace_all(msg, 190, "Ő", "Ő")
  239. replace_all(msg, 190, "Ú", "Ăš")
  240. replace_all(msg, 190, "Ü", "Ăś")
  241. replace_all(msg, 190, "Ű", "Ĺ°")
  242.  
  243. if (id) players[0] = id; else get_players(players, count, "ch")
  244. {
  245. for (new i = 0; i < count; i++)
  246. {
  247. if (is_user_connected(players[i]))
  248. {
  249. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  250. write_byte(players[i])
  251. write_string(msg)
  252. message_end()
  253. }
  254. }
  255. }
  256. return PLUGIN_HANDLED
  257. }
  258.  

_________________
Nem Toretto vagyok!!! hanem s[T]* Levii (És le lehet szállni a Torreto-zásról)

Ts3 Ip: ts.beathost.ml:10005

Ők köszönték meg DecToR nek ezt a hozzászólást (összesen 2): ZiT3K (2015.08.10. 17:50) • $weeT (2015.08.10. 18:01)
  Népszerűség: 4.55%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: BOMBA AFK ÁTADÓ(átalakítás)
HozzászólásElküldve: 2015.08.10. 16:53 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.12.15. 19:13
Hozzászólások: 419
Megköszönt másnak: 212 alkalommal
Megköszönték neki: 13 alkalommal
Sajnos nem ír ki semmit chat-be

_________________
2021.03.01-re rem. készen lesz az új SNIPER szerverem RENGETEG egyedi dologgal megfűszerezve.
De nem lövök le előre semmit :)


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: BOMBA AFK ÁTADÓ(átalakítás)
HozzászólásElküldve: 2015.08.10. 16:57 
Offline
Tag
Avatar

Csatlakozott: 2015.08.05. 14:00
Hozzászólások: 39
Megköszönt másnak: 2 alkalommal
Megköszönték neki: 9 alkalommal
Try:

SMA Forráskód: [ Mindet kijelol ]
  1.  
  2. /* AMX Mod X
  3. * AFK Bomb Transfer
  4. *
  5. * (c) Copyright 2006 by VEN
  6. *
  7. * This file is provided as is (no warranties)
  8. *
  9. * DESCRIPTION
  10. * Plugin allow transfer bomb from AFK terrorist to closest non-AFK teammate.
  11. * Plugin will have no effect:
  12. * - at the freezetime
  13. * - if bomb is planting
  14. * - on non-bomb maps (comment #define BOMB_MAP_CHECK to suppress)
  15. *
  16. * MODULES
  17. * fakemeta
  18. *
  19. * CVARS
  20. * afk_bombtransfer_spawn (N: seconds, default: 7) - max. allowed bomb carrier AFK time
  21. * affects on spawned AFK bomb carrier which never moved after spawn
  22. *
  23. * afk_bombtransfer_time (N: seconds, default: 15) - max. allowed bomb carrier AFK time
  24. * affects on any AFK bomb carrier except one which obey previous CVAR
  25. *
  26. * HUD MESSAGES
  27. * Terrorist team (green color)
  28. * Bomb transferred to "NEW_CARRIER_NAME"
  29. * since "AFK_CARRIER_NAME" is AFK
  30. *
  31. * New bomb carrier (yellow color)
  32. * You got the bomb!
  33. *
  34. * Note: by defult message display time is 7 seconds (define MSG_TIME)
  35. *
  36. * VERSIONS
  37. * 0.4 backpack transfer method greatly improved
  38. * added pcvar natives support (backward compatibility saved)
  39. * few code optimization
  40. * 0.3 now fakemeta instead of engine required (efficiency++ if engine is disabled)
  41. * "non-bomb map" check can be disabled (//#define BOMB_MAP_CHECK)
  42. * backpack finding method improved
  43. * few code optimization
  44. * added comments to the plugin source code
  45. * 0.2 fixed format issue
  46. * code optimized
  47. * description improved
  48. *
  49. * 0.1 first release
  50. */
  51.  
  52. /* *************************************************** Init **************************************************** */
  53.  
  54. #include <amxmodx>
  55. #include <fakemeta>
  56. #include <colorchat>
  57.  
  58. // plugin's main information
  59. #define PLUGIN_NAME "AFK Bomb Transfer"
  60. #define PLUGIN_VERSION "0.4"
  61. #define PLUGIN_AUTHOR "VEN"
  62.  
  63. // comment to avoid autodisabling the plugin on maps which not contain bomb targets
  64. #define BOMB_MAP_CHECK
  65.  
  66. // float value, hud messages display time (in seconds)
  67. #define MSG_TIME 7.0
  68.  
  69. // CVAR name, affects on spawned AFK bomb carrier which never moved after spawn
  70. new CVAR_SPAWN[] = "afk_bombtransfer_spawn"
  71.  
  72. // CVAR value, max. allowed bomb carrier AFK time (in seconds)
  73. new DEFAULT_SPAWN[] = "7"
  74.  
  75. // CVAR name, affects on any AFK bomb carrier except one which obey previous CVAR
  76. new CVAR_TIME[] = "afk_bombtransfer_time"
  77.  
  78. // CVAR value, max. allowed bomb carrier AFK time (in seconds)
  79. new DEFAULT_TIME[] = "15"
  80.  
  81. // do not set this value less than "maxplayers"
  82. #define MAX_PLAYERS 32
  83.  
  84. // initial AMXX version number supported CVAR pointers in get/set_pcvar_* natives
  85. #define CVAR_POINTERS_AMXX_INIT_VER_NUM 170
  86.  
  87. // determine if get/set_pcvar_* natives can be used
  88. #if defined AMXX_VERSION_NUM && AMXX_VERSION_NUM >= CVAR_POINTERS_AMXX_INIT_VER_NUM
  89. #define CVAR_POINTERS
  90. new g_pcvar_spawn
  91. new g_pcvar_time
  92. #endif
  93.  
  94. new TEAM[] = "TERRORIST"
  95. new WEAPON[] = "weapon_c4"
  96.  
  97. #define FL_ONGROUND (1<<9)
  98.  
  99. new bool:g_freezetime = true
  100. new bool:g_spawn
  101. new bool:g_planting
  102.  
  103. new g_carrier
  104.  
  105. new g_pos[MAX_PLAYERS + 1][3]
  106. new g_time[MAX_PLAYERS + 1]
  107.  
  108. new g_maxplayers
  109.  
  110. public plugin_init() {
  111. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
  112.  
  113. #if defined CVAR_POINTERS
  114. g_pcvar_spawn = register_cvar(CVAR_SPAWN, DEFAULT_SPAWN)
  115. g_pcvar_time = register_cvar(CVAR_TIME, DEFAULT_TIME)
  116. #else
  117. register_cvar(CVAR_SPAWN, DEFAULT_SPAWN)
  118. register_cvar(CVAR_TIME, DEFAULT_TIME)
  119. #endif
  120.  
  121. #if defined BOMB_MAP_CHECK
  122. // is current map not contain bomb targets?
  123. if (!engfunc(EngFunc_FindEntityByString, -1, "classname", "func_bomb_target"))
  124. return
  125. #endif
  126.  
  127. register_event("WeapPickup", "event_got_bomb", "be", "1=6")
  128. register_event("BarTime", "event_bar_time", "be")
  129. register_event("TextMsg", "event_bomb_drop", "bc", "2=#Game_bomb_drop")
  130. register_event("TextMsg", "event_bomb_drop", "a", "2=#Bomb_Planted")
  131. register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
  132.  
  133. register_logevent("logevent_round_start", 2, "1=Round_Start")
  134.  
  135. set_task(1.0, "task_afk_check", _, _, _, "b") // plugin's core loop
  136.  
  137. g_maxplayers = get_maxplayers()
  138. }
  139.  
  140. /* *************************************************** Base **************************************************** */
  141.  
  142. public event_new_round() {
  143. g_freezetime = true
  144. g_spawn = true
  145. g_planting = false
  146. g_carrier = 0
  147. }
  148.  
  149. public event_got_bomb(id) {
  150. g_carrier = id
  151. }
  152.  
  153. public event_bar_time(id) {
  154. if (id == g_carrier) {
  155. g_planting = bool:read_data(1)
  156. get_user_origin(id, g_pos[id])
  157. g_time[id] = 0
  158. }
  159. }
  160.  
  161. public event_bomb_drop() {
  162. g_spawn = false
  163. g_planting = false
  164. g_carrier = 0
  165. }
  166.  
  167. public logevent_round_start() {
  168. new id[32], num
  169. get_players(id, num, "ae", TEAM)
  170.  
  171. if (!num) // is server empty?
  172. return
  173.  
  174. g_freezetime = false
  175.  
  176. // update afk timers and current positions
  177. new x
  178. for (new i = 0; i < num; ++i) {
  179. x = id[i:dvx8mpbn]
  180. get_user_origin(x, g_pos[x])
  181. g_time[x] = 0
  182. }
  183. }
  184.  
  185. public task_afk_check() {
  186. if (g_freezetime) // is freezetime right now?
  187. return
  188.  
  189. // afk check
  190. new id[32], num, x, origin[3]
  191. get_players(id, num, "ae", TEAM)
  192. for (new i = 0; i < num; ++i) {
  193. x = id[i]
  194. get_user_origin(x, origin)
  195. if (origin[0] != g_pos[x][0] || origin[1] != g_pos[x][1] || (x == g_carrier && g_planting)) {
  196. g_time[x] = 0
  197. g_pos[x][0] = origin[0]
  198. g_pos[x][1] = origin[1]
  199. if (g_spawn && x == g_carrier)
  200. g_spawn = false
  201. }
  202. else
  203. g_time[x]++
  204. }
  205.  
  206. // is bomb not currently carried or Ts number less than 2?
  207. if (!g_carrier || num < 2)
  208. return
  209.  
  210. #if defined CVAR_POINTERS
  211. new max_time = get_pcvar_num(g_spawn ? g_pcvar_spawn : g_pcvar_time)
  212. #else
  213. new max_time = get_cvar_num(g_spawn ? CVAR_SPAWN : CVAR_TIME)
  214. #endif
  215.  
  216. // is plugin disabled (cvar <= 0) or carrier isn't afk?
  217. if (max_time <= 0 || g_time[g_carrier] < max_time)
  218. return
  219.  
  220. // find who from non-afk Ts is the closest to the afk carrier
  221. get_user_origin(g_carrier, origin)
  222. new min_dist = 999999, dist, recipient, origin2[3]
  223. for (new i = 0; i < num; ++i) {
  224. x = id[i]
  225. if (g_time[x] < max_time) {
  226. get_user_origin(x, origin2)
  227. dist = get_distance(origin, origin2)
  228. if (dist < min_dist) {
  229. min_dist = dist
  230. recipient = x
  231. }
  232. }
  233. }
  234.  
  235. if (!recipient) // is all Ts afk?
  236. return
  237.  
  238. new carrier = g_carrier
  239. engclient_cmd(carrier, "drop", WEAPON) // drop the backpack
  240. new c4 = engfunc(EngFunc_FindEntityByString, -1, "classname", WEAPON) // find weapon_c4 entity
  241. if (!c4)
  242. return
  243.  
  244. new backpack = pev(c4, pev_owner) // get backpack entity
  245. if (backpack <= g_maxplayers)
  246. return
  247.  
  248. // my backpack transfer trick (improved)
  249. set_pev(backpack, pev_flags, pev(backpack, pev_flags) | FL_ONGROUND)
  250. dllfunc(DLLFunc_Touch, backpack, recipient)
  251.  
  252. // hud messages stuff below
  253. set_hudmessage(0, 255, 0, 0.35, 0.8, _, _, MSG_TIME)
  254. new message[128], c_name[32], r_name[32]
  255. get_user_name(carrier, c_name, 31)
  256. get_user_name(recipient, r_name, 31)
  257. format(message, 127, "A bombat att adtak ^"%s^"^n-nek mert ^"%s^" AFKzik!", r_name, c_name)
  258. for (new i = 0; i < num; ++i)
  259. show_hudmessage(id[i], "%s", message)
  260.  
  261.  
  262. ColorChat(recipient, GREEN, "Meg kaptad a Bombat!")
  263. }
  264.  
  265. /* **************************************************** EOF **************************************************** */
  266.  

_________________
kiki írta:
Itt senkinek nem kötelessége hogy segítsen neked, így ha megteszi azt köszönd meg, és ha senki sem teszi meg, akkor se okolj senkit érte.

Ők köszönték meg Mr.Freeze nek ezt a hozzászólást: ZiT3K (2015.08.10. 17:50)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: BOMBA AFK ÁTADÓ(átalakítás)
HozzászólásElküldve: 2015.08.10. 17:10 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.12.15. 19:13
Hozzászólások: 419
Megköszönt másnak: 212 alkalommal
Megköszönték neki: 13 alkalommal
https://amx.freakz.ro/
Kód:
AMX Mod X Compiler 1.8.3-manual
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team

Modified for www.Freakz.ro / amx.freakz.ro

bombaafk.sma(179) : error 017: undefined symbol "dvx8mpbn"

1 Error.
Compilarea failed!

_________________
2021.03.01-re rem. készen lesz az új SNIPER szerverem RENGETEG egyedi dologgal megfűszerezve.
De nem lövök le előre semmit :)


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: BOMBA AFK ÁTADÓ(átalakítás)
HozzászólásElküldve: 2015.08.10. 17:16 
Offline
Tag
Avatar

Csatlakozott: 2015.08.05. 14:00
Hozzászólások: 39
Megköszönt másnak: 2 alkalommal
Megköszönték neki: 9 alkalommal
Javítva:

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <colorchat>
  4.  
  5. // plugin's main information
  6. #define PLUGIN_NAME "AFK Bomb Transfer"
  7. #define PLUGIN_VERSION "0.4"
  8. #define PLUGIN_AUTHOR "VEN"
  9.  
  10. // comment to avoid autodisabling the plugin on maps which not contain bomb targets
  11. #define BOMB_MAP_CHECK
  12.  
  13. // float value, hud messages display time (in seconds)
  14. #define MSG_TIME 7.0
  15.  
  16. // CVAR name, affects on spawned AFK bomb carrier which never moved after spawn
  17. new CVAR_SPAWN[] = "afk_bombtransfer_spawn"
  18.  
  19. // CVAR value, max. allowed bomb carrier AFK time (in seconds)
  20. new DEFAULT_SPAWN[] = "7"
  21.  
  22. // CVAR name, affects on any AFK bomb carrier except one which obey previous CVAR
  23. new CVAR_TIME[] = "afk_bombtransfer_time"
  24.  
  25. // CVAR value, max. allowed bomb carrier AFK time (in seconds)
  26. new DEFAULT_TIME[] = "15"
  27.  
  28. // do not set this value less than "maxplayers"
  29. #define MAX_PLAYERS 32
  30.  
  31. // initial AMXX version number supported CVAR pointers in get/set_pcvar_* natives
  32. #define CVAR_POINTERS_AMXX_INIT_VER_NUM 170
  33.  
  34. // determine if get/set_pcvar_* natives can be used
  35. #if defined AMXX_VERSION_NUM && AMXX_VERSION_NUM >= CVAR_POINTERS_AMXX_INIT_VER_NUM
  36. #define CVAR_POINTERS
  37. new g_pcvar_spawn
  38. new g_pcvar_time
  39. #endif
  40.  
  41. new TEAM[] = "TERRORIST"
  42. new WEAPON[] = "weapon_c4"
  43.  
  44. #define FL_ONGROUND (1<<9)
  45.  
  46. new bool:g_freezetime = true
  47. new bool:g_spawn
  48. new bool:g_planting
  49.  
  50. new g_carrier
  51.  
  52. new g_pos[MAX_PLAYERS + 1][3]
  53. new g_time[MAX_PLAYERS + 1]
  54.  
  55. new g_maxplayers
  56.  
  57. public plugin_init() {
  58. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
  59.  
  60. #if defined CVAR_POINTERS
  61. g_pcvar_spawn = register_cvar(CVAR_SPAWN, DEFAULT_SPAWN)
  62. g_pcvar_time = register_cvar(CVAR_TIME, DEFAULT_TIME)
  63. #else
  64. register_cvar(CVAR_SPAWN, DEFAULT_SPAWN)
  65. register_cvar(CVAR_TIME, DEFAULT_TIME)
  66. #endif
  67.  
  68. #if defined BOMB_MAP_CHECK
  69. // is current map not contain bomb targets?
  70. if (!engfunc(EngFunc_FindEntityByString, -1, "classname", "func_bomb_target"))
  71. return
  72. #endif
  73.  
  74. register_event("WeapPickup", "event_got_bomb", "be", "1=6")
  75. register_event("BarTime", "event_bar_time", "be")
  76. register_event("TextMsg", "event_bomb_drop", "bc", "2=#Game_bomb_drop")
  77. register_event("TextMsg", "event_bomb_drop", "a", "2=#Bomb_Planted")
  78. register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
  79.  
  80. register_logevent("logevent_round_start", 2, "1=Round_Start")
  81.  
  82. set_task(1.0, "task_afk_check", _, _, _, "b") // plugin's core loop
  83.  
  84. g_maxplayers = get_maxplayers()
  85. }
  86.  
  87. /* *************************************************** Base **************************************************** */
  88.  
  89. public event_new_round() {
  90. g_freezetime = true
  91. g_spawn = true
  92. g_planting = false
  93. g_carrier = 0
  94. }
  95.  
  96. public event_got_bomb(id) {
  97. g_carrier = id
  98. }
  99.  
  100. public event_bar_time(id) {
  101. if (id == g_carrier) {
  102. g_planting = bool:read_data(1)
  103. get_user_origin(id, g_pos[id])
  104. g_time[id] = 0
  105. }
  106. }
  107.  
  108. public event_bomb_drop() {
  109. g_spawn = false
  110. g_planting = false
  111. g_carrier = 0
  112. }
  113.  
  114. public logevent_round_start() {
  115. new id[32], num
  116. get_players(id, num, "ae", TEAM)
  117.  
  118. if (!num) // is server empty?
  119. return
  120.  
  121. g_freezetime = false
  122.  
  123. // update afk timers and current positions
  124. new x
  125. for (new i = 0; i < num; ++i) {
  126. x = id[i]
  127. get_user_origin(x, g_pos[x])
  128. g_time[x] = 0
  129. }
  130. }
  131.  
  132. public task_afk_check() {
  133. if (g_freezetime) // is freezetime right now?
  134. return
  135.  
  136. // afk check
  137. new id[32], num, x, origin[3]
  138. get_players(id, num, "ae", TEAM)
  139. for (new i = 0; i < num; ++i) {
  140. x = id[i]
  141. get_user_origin(x, origin)
  142. if (origin[0] != g_pos[x][0] || origin[1] != g_pos[x][1] || (x == g_carrier && g_planting)) {
  143. g_time[x] = 0
  144. g_pos[x][0] = origin[0]
  145. g_pos[x][1] = origin[1]
  146. if (g_spawn && x == g_carrier)
  147. g_spawn = false
  148. }
  149. else
  150. g_time[x]++
  151. }
  152.  
  153. // is bomb not currently carried or Ts number less than 2?
  154. if (!g_carrier || num < 2)
  155. return
  156.  
  157. #if defined CVAR_POINTERS
  158. new max_time = get_pcvar_num(g_spawn ? g_pcvar_spawn : g_pcvar_time)
  159. #else
  160. new max_time = get_cvar_num(g_spawn ? CVAR_SPAWN : CVAR_TIME)
  161. #endif
  162.  
  163. // is plugin disabled (cvar <= 0) or carrier isn't afk?
  164. if (max_time <= 0 || g_time[g_carrier] < max_time)
  165. return
  166.  
  167. // find who from non-afk Ts is the closest to the afk carrier
  168. get_user_origin(g_carrier, origin)
  169. new min_dist = 999999, dist, recipient, origin2[3]
  170. for (new i = 0; i < num; ++i) {
  171. x = id[i]
  172. if (g_time[x] < max_time) {
  173. get_user_origin(x, origin2)
  174. dist = get_distance(origin, origin2)
  175. if (dist < min_dist) {
  176. min_dist = dist
  177. recipient = x
  178. }
  179. }
  180. }
  181.  
  182. if (!recipient) // is all Ts afk?
  183. return
  184.  
  185. new carrier = g_carrier
  186. engclient_cmd(carrier, "drop", WEAPON) // drop the backpack
  187. new c4 = engfunc(EngFunc_FindEntityByString, -1, "classname", WEAPON) // find weapon_c4 entity
  188. if (!c4)
  189. return
  190.  
  191. new backpack = pev(c4, pev_owner) // get backpack entity
  192. if (backpack <= g_maxplayers)
  193. return
  194.  
  195. // my backpack transfer trick (improved)
  196. set_pev(backpack, pev_flags, pev(backpack, pev_flags) | FL_ONGROUND)
  197. dllfunc(DLLFunc_Touch, backpack, recipient)
  198.  
  199. // hud messages stuff below
  200. set_hudmessage(0, 255, 0, 0.35, 0.8, _, _, MSG_TIME)
  201. new message[128], c_name[32], r_name[32]
  202. get_user_name(carrier, c_name, 31)
  203. get_user_name(recipient, r_name, 31)
  204. format(message, 127, "A bombat att adtak ^"%s^"^n-nek mert ^"%s^" AFKzik!", r_name, c_name)
  205. for (new i = 0; i < num; ++i)
  206. ColorChat(id[i], GREEN, "%s", message)
  207.  
  208. ColorChat(recipient, GREEN, "Meg kaptad a Bombat!")
  209. }

_________________
kiki írta:
Itt senkinek nem kötelessége hogy segítsen neked, így ha megteszi azt köszönd meg, és ha senki sem teszi meg, akkor se okolj senkit érte.


A hozzászólást 1 alkalommal szerkesztették, utoljára Mr.Freeze 2015.08.10. 17:30-kor.

Ők köszönték meg Mr.Freeze nek ezt a hozzászólást: ZiT3K (2015.08.10. 17:50)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: BOMBA AFK ÁTADÓ(átalakítás)
HozzászólásElküldve: 2015.08.10. 17:23 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.12.15. 19:13
Hozzászólások: 419
Megköszönt másnak: 212 alkalommal
Megköszönték neki: 13 alkalommal
Ez HUD-ba írja ki, amit kiír én úgy szeretném, ha chat-be írná ki.

_________________
2021.03.01-re rem. készen lesz az új SNIPER szerverem RENGETEG egyedi dologgal megfűszerezve.
De nem lövök le előre semmit :)


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: BOMBA AFK ÁTADÓ(átalakítás)
HozzászólásElküldve: 2015.08.10. 17:31 
Offline
Tag
Avatar

Csatlakozott: 2015.08.05. 14:00
Hozzászólások: 39
Megköszönt másnak: 2 alkalommal
Megköszönték neki: 9 alkalommal
ZiT3K írta:
Ez HUD-ba írja ki, amit kiír én úgy szeretném, ha chat-be írná ki.


Előző javítva!

_________________
kiki írta:
Itt senkinek nem kötelessége hogy segítsen neked, így ha megteszi azt köszönd meg, és ha senki sem teszi meg, akkor se okolj senkit érte.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: BOMBA AFK ÁTADÓ(átalakítás)
HozzászólásElküldve: 2015.08.10. 17:49 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.12.15. 19:13
Hozzászólások: 419
Megköszönt másnak: 212 alkalommal
Megköszönték neki: 13 alkalommal
MŰKÖDIK, köszi!
Mr.Freeze írta:
Javítva:

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <colorchat>
  4.  
  5. // plugin's main information
  6. #define PLUGIN_NAME "AFK Bomb Transfer"
  7. #define PLUGIN_VERSION "0.4"
  8. #define PLUGIN_AUTHOR "VEN"
  9.  
  10. // comment to avoid autodisabling the plugin on maps which not contain bomb targets
  11. #define BOMB_MAP_CHECK
  12.  
  13. // float value, hud messages display time (in seconds)
  14. #define MSG_TIME 7.0
  15.  
  16. // CVAR name, affects on spawned AFK bomb carrier which never moved after spawn
  17. new CVAR_SPAWN[] = "afk_bombtransfer_spawn"
  18.  
  19. // CVAR value, max. allowed bomb carrier AFK time (in seconds)
  20. new DEFAULT_SPAWN[] = "7"
  21.  
  22. // CVAR name, affects on any AFK bomb carrier except one which obey previous CVAR
  23. new CVAR_TIME[] = "afk_bombtransfer_time"
  24.  
  25. // CVAR value, max. allowed bomb carrier AFK time (in seconds)
  26. new DEFAULT_TIME[] = "15"
  27.  
  28. // do not set this value less than "maxplayers"
  29. #define MAX_PLAYERS 32
  30.  
  31. // initial AMXX version number supported CVAR pointers in get/set_pcvar_* natives
  32. #define CVAR_POINTERS_AMXX_INIT_VER_NUM 170
  33.  
  34. // determine if get/set_pcvar_* natives can be used
  35. #if defined AMXX_VERSION_NUM && AMXX_VERSION_NUM >= CVAR_POINTERS_AMXX_INIT_VER_NUM
  36. #define CVAR_POINTERS
  37. new g_pcvar_spawn
  38. new g_pcvar_time
  39. #endif
  40.  
  41. new TEAM[] = "TERRORIST"
  42. new WEAPON[] = "weapon_c4"
  43.  
  44. #define FL_ONGROUND (1<<9)
  45.  
  46. new bool:g_freezetime = true
  47. new bool:g_spawn
  48. new bool:g_planting
  49.  
  50. new g_carrier
  51.  
  52. new g_pos[MAX_PLAYERS + 1][3]
  53. new g_time[MAX_PLAYERS + 1]
  54.  
  55. new g_maxplayers
  56.  
  57. public plugin_init() {
  58. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
  59.  
  60. #if defined CVAR_POINTERS
  61. g_pcvar_spawn = register_cvar(CVAR_SPAWN, DEFAULT_SPAWN)
  62. g_pcvar_time = register_cvar(CVAR_TIME, DEFAULT_TIME)
  63. #else
  64. register_cvar(CVAR_SPAWN, DEFAULT_SPAWN)
  65. register_cvar(CVAR_TIME, DEFAULT_TIME)
  66. #endif
  67.  
  68. #if defined BOMB_MAP_CHECK
  69. // is current map not contain bomb targets?
  70. if (!engfunc(EngFunc_FindEntityByString, -1, "classname", "func_bomb_target"))
  71. return
  72. #endif
  73.  
  74. register_event("WeapPickup", "event_got_bomb", "be", "1=6")
  75. register_event("BarTime", "event_bar_time", "be")
  76. register_event("TextMsg", "event_bomb_drop", "bc", "2=#Game_bomb_drop")
  77. register_event("TextMsg", "event_bomb_drop", "a", "2=#Bomb_Planted")
  78. register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
  79.  
  80. register_logevent("logevent_round_start", 2, "1=Round_Start")
  81.  
  82. set_task(1.0, "task_afk_check", _, _, _, "b") // plugin's core loop
  83.  
  84. g_maxplayers = get_maxplayers()
  85. }
  86.  
  87. /* *************************************************** Base **************************************************** */
  88.  
  89. public event_new_round() {
  90. g_freezetime = true
  91. g_spawn = true
  92. g_planting = false
  93. g_carrier = 0
  94. }
  95.  
  96. public event_got_bomb(id) {
  97. g_carrier = id
  98. }
  99.  
  100. public event_bar_time(id) {
  101. if (id == g_carrier) {
  102. g_planting = bool:read_data(1)
  103. get_user_origin(id, g_pos[id])
  104. g_time[id] = 0
  105. }
  106. }
  107.  
  108. public event_bomb_drop() {
  109. g_spawn = false
  110. g_planting = false
  111. g_carrier = 0
  112. }
  113.  
  114. public logevent_round_start() {
  115. new id[32], num
  116. get_players(id, num, "ae", TEAM)
  117.  
  118. if (!num) // is server empty?
  119. return
  120.  
  121. g_freezetime = false
  122.  
  123. // update afk timers and current positions
  124. new x
  125. for (new i = 0; i < num; ++i) {
  126. x = id[i]
  127. get_user_origin(x, g_pos[x])
  128. g_time[x] = 0
  129. }
  130. }
  131.  
  132. public task_afk_check() {
  133. if (g_freezetime) // is freezetime right now?
  134. return
  135.  
  136. // afk check
  137. new id[32], num, x, origin[3]
  138. get_players(id, num, "ae", TEAM)
  139. for (new i = 0; i < num; ++i) {
  140. x = id[i]
  141. get_user_origin(x, origin)
  142. if (origin[0] != g_pos[x][0] || origin[1] != g_pos[x][1] || (x == g_carrier && g_planting)) {
  143. g_time[x] = 0
  144. g_pos[x][0] = origin[0]
  145. g_pos[x][1] = origin[1]
  146. if (g_spawn && x == g_carrier)
  147. g_spawn = false
  148. }
  149. else
  150. g_time[x]++
  151. }
  152.  
  153. // is bomb not currently carried or Ts number less than 2?
  154. if (!g_carrier || num < 2)
  155. return
  156.  
  157. #if defined CVAR_POINTERS
  158. new max_time = get_pcvar_num(g_spawn ? g_pcvar_spawn : g_pcvar_time)
  159. #else
  160. new max_time = get_cvar_num(g_spawn ? CVAR_SPAWN : CVAR_TIME)
  161. #endif
  162.  
  163. // is plugin disabled (cvar <= 0) or carrier isn't afk?
  164. if (max_time <= 0 || g_time[g_carrier] < max_time)
  165. return
  166.  
  167. // find who from non-afk Ts is the closest to the afk carrier
  168. get_user_origin(g_carrier, origin)
  169. new min_dist = 999999, dist, recipient, origin2[3]
  170. for (new i = 0; i < num; ++i) {
  171. x = id[i]
  172. if (g_time[x] < max_time) {
  173. get_user_origin(x, origin2)
  174. dist = get_distance(origin, origin2)
  175. if (dist < min_dist) {
  176. min_dist = dist
  177. recipient = x
  178. }
  179. }
  180. }
  181.  
  182. if (!recipient) // is all Ts afk?
  183. return
  184.  
  185. new carrier = g_carrier
  186. engclient_cmd(carrier, "drop", WEAPON) // drop the backpack
  187. new c4 = engfunc(EngFunc_FindEntityByString, -1, "classname", WEAPON) // find weapon_c4 entity
  188. if (!c4)
  189. return
  190.  
  191. new backpack = pev(c4, pev_owner) // get backpack entity
  192. if (backpack <= g_maxplayers)
  193. return
  194.  
  195. // my backpack transfer trick (improved)
  196. set_pev(backpack, pev_flags, pev(backpack, pev_flags) | FL_ONGROUND)
  197. dllfunc(DLLFunc_Touch, backpack, recipient)
  198.  
  199. // hud messages stuff below
  200. set_hudmessage(0, 255, 0, 0.35, 0.8, _, _, MSG_TIME)
  201. new message[128], c_name[32], r_name[32]
  202. get_user_name(carrier, c_name, 31)
  203. get_user_name(recipient, r_name, 31)
  204. format(message, 127, "A bombat att adtak ^"%s^"^n-nek mert ^"%s^" AFKzik!", r_name, c_name)
  205. for (new i = 0; i < num; ++i)
  206. ColorChat(id[i], GREEN, "%s", message)
  207.  
  208. ColorChat(recipient, GREEN, "Meg kaptad a Bombat!")
  209. }

_________________
2021.03.01-re rem. készen lesz az új SNIPER szerverem RENGETEG egyedi dologgal megfűszerezve.
De nem lövök le előre semmit :)


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


Ki van itt

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