hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.23. 11:05



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: Majestic-12 [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: colorchat hiba?
HozzászólásElküldve: 2014.02.03. 12:14 
Offline
Lelkes
Avatar

Csatlakozott: 2014.01.26. 14:50
Hozzászólások: 20
Megköszönt másnak: 5 alkalommal
Hello mindenkinek valaki nem tugya mért agya ki a szerver ezeket:


L 02/03/2014 - 11:58:29: [AMXX] Displaying debug trace (plugin "knife_duel.amxx")
L 02/03/2014 - 11:58:29: [AMXX] Run time error 4: index out of bounds
L 02/03/2014 - 11:58:29: [AMXX] [0] colorchat.inc::ColorChat (line 70)
L 02/03/2014 - 11:58:29: [AMXX] [1] knife_duel.sma::Announcement (line 162)
L 02/03/2014 - 11:58:29: [AMXX] Displaying debug trace (plugin "bunnyhop.amxx")
L 02/03/2014 - 11:58:29: [AMXX] Run time error 4: index out of bounds
L 02/03/2014 - 11:58:29: [AMXX] [0] colorchat.inc::ColorChat (line 70)
L 02/03/2014 - 11:58:29: [AMXX] [1] bunnyhop.sma::showUsage (line 66)

a szines irásal van valami gond ha jol gondolom mert ezek a line és szám a szines sornál vanak amit kii ir chat-be


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: colorchat hiba?
HozzászólásElküldve: 2014.02.03. 13:22 
Offline
Minden6ó
Avatar

Csatlakozott: 2011.01.19. 12:14
Hozzászólások: 4292
Megköszönt másnak: 219 alkalommal
Megköszönték neki: 287 alkalommal
szecskaa írta:
Hello mindenkinek valaki nem tugya mért agya ki a szerver ezeket:


L 02/03/2014 - 11:58:29: [AMXX] Displaying debug trace (plugin "knife_duel.amxx")
L 02/03/2014 - 11:58:29: [AMXX] Run time error 4: index out of bounds
L 02/03/2014 - 11:58:29: [AMXX] [0] colorchat.inc::ColorChat (line 70)
L 02/03/2014 - 11:58:29: [AMXX] [1] knife_duel.sma::Announcement (line 162)
L 02/03/2014 - 11:58:29: [AMXX] Displaying debug trace (plugin "bunnyhop.amxx")
L 02/03/2014 - 11:58:29: [AMXX] Run time error 4: index out of bounds
L 02/03/2014 - 11:58:29: [AMXX] [0] colorchat.inc::ColorChat (line 70)
L 02/03/2014 - 11:58:29: [AMXX] [1] bunnyhop.sma::showUsage (line 66)

a szines irásal van valami gond ha jol gondolom mert ezek a line és szám a szines sornál vanak amit kii ir chat-be

Egy plugin sma-t küldj ne az inc fájlt azzal nincs semmi baj!!

_________________
<<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: colorchat hiba?
HozzászólásElküldve: 2014.02.03. 21:17 
Offline
Lelkes
Avatar

Csatlakozott: 2014.01.26. 14:50
Hozzászólások: 20
Megköszönt másnak: 5 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. #define PLUGINNAME "Automatic knife duel"
  2. #define VERSION "0.3"
  3. #define AUTHOR "JGHG"
  4. /*
  5.  
  6. AUTOMATIC KNIFE DUEL
  7. ====================
  8. Where I come from, if you cut the wall repeteadly with your knife it means you're challenging your last opponent to a knife duel. <!-- s;-) --><img src=\"{SMILIES_PATH}/icon_e_wink.gif\" alt=\";-)\" title=\"kacsintás\" /><!-- s;-) -->
  9.  
  10. I decided to automate this process.
  11.  
  12. If only you and another person on the opposite team remain in the round, you can hit a wall (or another object) with your knife, THREE TIMES in fast succession.
  13. By this action you challenge your opponent to a knife duel. The person you challenge gets a menu where he can accept/decline your
  14. challenge. The challenged person has 10 seconds to decide his mind, else the challenge is automatically declined, and the menu should be closed automatically.
  15.  
  16. Should a knife duel start, it works out pretty much like a round of Knife Arena: you can only use the knife (and the C4!).
  17. As soon as the round ends the Knife Arena mode is turned off.
  18.  
  19. /JGHG
  20.  
  21.  
  22. VERSIONS
  23. ========
  24. 050421 0.3 You must now slash with your knife three times in fast succession to challenge someone.
  25. 050208 0.2 Fixed seconds display.
  26. Bots should now respond correctly and a little human like. They will mostly accept challenges. <!-- s;-) --><img src=\"{SMILIES_PATH}/icon_e_wink.gif\" alt=\";-)\" title=\"kacsintás\" /><!-- s;-) -->
  27. Small fixes here and there. <!-- s:-) --><img src=\"{SMILIES_PATH}/icon_e_smile.gif\" alt=\":-)\" title=\"mosoly\" /><!-- s:-) -->
  28. 050208 0.1 First version - largely untested
  29. */
  30.  
  31. #include <amxmodx>
  32. #include <fakemeta>
  33. #include <fun>
  34. #include <colorchat>
  35.  
  36. #define DEBUG
  37.  
  38. #if defined DEBUG
  39. #include <amxmisc>
  40. #endif // defined DEBUG
  41.  
  42. #define MENUSELECT1 0
  43. #define MENUSELECT2 1
  44. #define TASKID_CHALLENGING 2348923
  45. #define TASKID_BOTTHINK 3242321
  46. #define DECIDESECONDS 20
  47. #define ALLOWED_WEAPONS 2
  48. #define KNIFESLASHES 3 // the nr of slashes within a short amount of time until a challenge starts...
  49. // Globals below
  50. new g_allowedWeapons[ALLOWED_WEAPONS] = {CSW_KNIFE, CSW_C4}
  51. new g_MAXPLAYERS
  52. new bool:g_challenging = false
  53. new bool:g_knifeArena = false
  54. new bool:g_noChallengingForAWhile = false
  55. new g_challengemenu
  56. new g_challenger
  57. new g_challenged
  58. new g_challenges[33]
  59. // Globals above
  60.  
  61. public plugin_modules()
  62. {
  63. require_module("fakemeta")
  64. require_module("fun")
  65. }
  66.  
  67. public forward_emitsound(const PIRATE, const Onceuponatimetherewasaverysmall, noise[], const Float:turtlewhoateabiggerturtleand, const Float:afterthatthesmallturtlegot, const veryveryverybig, const theend) {
  68. if (g_noChallengingForAWhile || g_knifeArena || g_challenging || PIRATE < 1 || PIRATE > g_MAXPLAYERS || !is_user_alive(PIRATE) || !equal(noise, "weapons/knife_hitwall1.wav"))
  69. return FMRES_IGNORED
  70.  
  71. new team = get_user_team(PIRATE), otherteam = 0, matchingOpponent = 0
  72. // Make sure exactly one person on each team is alive.
  73. for (new i = 1; i <= g_MAXPLAYERS; i++) {
  74. if (!is_user_connected(i) || !is_user_alive(i) || PIRATE == i)
  75. continue
  76. if (get_user_team(i) == team) {
  77. // No fun.
  78. return FMRES_IGNORED
  79. }
  80. else {
  81. if (++otherteam > 1) {
  82. // No fun.
  83. return FMRES_IGNORED
  84. }
  85. matchingOpponent = i
  86. }
  87. }
  88.  
  89. if (matchingOpponent == 0)
  90. return FMRES_IGNORED
  91.  
  92. if (++g_challenges[PIRATE] >= KNIFESLASHES) {
  93. Challenge(PIRATE, matchingOpponent)
  94. if (is_user_bot(matchingOpponent)) {
  95. new Float:val = float(DECIDESECONDS)
  96. if (val < 2.0)
  97. val = 2.0
  98. remove_task(TASKID_BOTTHINK)
  99. set_task(random_float(1.0, float(DECIDESECONDS) - 1.0), "BotDecides", TASKID_BOTTHINK)
  100. }
  101. g_challenges[PIRATE] = 0
  102. }
  103. else
  104. set_task(1.0, "decreaseChallenges", PIRATE)
  105.  
  106. //client_print(PIRATE, print_chat, "Your challenges: %d", g_challenges[PIRATE])
  107.  
  108. return FMRES_IGNORED
  109. }
  110.  
  111. public decreaseChallenges(id) {
  112. if (--g_challenges[id] < 0)
  113. g_challenges[id] = 0
  114. }
  115.  
  116. public BotDecides() {
  117. if (!g_challenging)
  118. return
  119.  
  120. if (random_num(0,9) > 0)
  121. Accept()
  122. else {
  123. DeclineMsg()
  124. }
  125. g_challenging = false
  126. remove_task(TASKID_CHALLENGING)
  127. }
  128.  
  129. Challenge(challenger, challenged) {
  130. g_challenger = challenger
  131. g_challenged = challenged
  132. g_challenging = true
  133. new challenger_name[32], challenged_name[32]
  134. get_user_name(challenger, challenger_name, 31)
  135. get_user_name(challenged, challenged_name, 31)
  136.  
  137. client_print(challenger, print_chat, "Megakarsz kuzdeni %s -val egy kesparbajban? Varj a valaszara %d masodpercet...", challenged_name, DECIDESECONDS)
  138.  
  139. new menu[1024], keys = MENU_KEY_1 | MENU_KEY_2
  140. format(menu, 1023, "Megakarsz kuzdeni %s egy kesparbajban?^n^nMit teszel? Van %d masodmeprced a valaszra!^n^n\y1\w. Vagjunk bele!^n\y2\w. Nem merek mert gyava kukac vagyok!", challenger_name, DECIDESECONDS)
  141. show_menu(challenged, keys, menu, DECIDESECONDS, "JGHG's automatic knife duel")
  142. set_task(float(DECIDESECONDS), "timed_toolate", TASKID_CHALLENGING)
  143. }
  144.  
  145. public timed_toolate() {
  146. if (g_challenging) {
  147. new challenger_name[32], challenged_name[32]
  148. get_user_name(g_challenger, challenger_name, 31)
  149. get_user_name(g_challenged, challenged_name, 31)
  150. client_print(0, print_chat, "%s Nem válaszolt %s a kihivasara eleg gyorsan...", challenged_name, challenger_name)
  151. CancelAll()
  152. }
  153. }
  154.  
  155. public client_putinserver(id) {
  156. set_task(25.0, "Announcement", id)
  157.  
  158. return PLUGIN_CONTINUE
  159. }
  160.  
  161. public Announcement(id) {
  162. ColorChat(id, RED,"[Knife]^x04: Ha te es egy ellenseged maradt ki tudod hivni kesparbajra, csak verd a kesed a falhoz! ")
  163. }
  164.  
  165. public challenged_menu(id, key) {
  166. switch (key) {
  167. case MENUSELECT1: {
  168. // Accept
  169. Accept()
  170. }
  171. case MENUSELECT2: {
  172. // Decline
  173. DeclineMsg()
  174. }
  175. }
  176. g_challenging = false
  177. remove_task(TASKID_CHALLENGING)
  178.  
  179. return PLUGIN_HANDLED
  180. }
  181.  
  182. DeclineMsg() {
  183. new challenger_name[32], challenged_name[32]
  184. get_user_name(g_challenger, challenger_name, 31)
  185. get_user_name(g_challenged, challenged_name, 31)
  186. client_print(0, print_chat, "%s Nem fogadta el %s a kihivasat...", challenged_name, challenger_name)
  187. }
  188.  
  189. Accept() {
  190. new challenger_name[32], challenged_name[32]
  191. get_user_name(g_challenger, challenger_name, 31)
  192. get_user_name(g_challenged, challenged_name, 31)
  193.  
  194. client_print(0, print_chat, "%s Elfogadta %s a kihivasat!", challenged_name, challenger_name)
  195. g_knifeArena = true
  196. give_item(g_challenger, "weapon_knife")
  197. give_item(g_challenged, "weapon_knife")
  198. engclient_cmd(g_challenger, "weapon_knife")
  199. engclient_cmd(g_challenged, "weapon_knife")
  200. }
  201.  
  202. public event_holdwpn(id) {
  203. if (!g_knifeArena || !is_user_alive(id))
  204. return PLUGIN_CONTINUE
  205.  
  206. new weaponType = read_data(2)
  207.  
  208. for (new i = 0; i < ALLOWED_WEAPONS; i++) {
  209. if (weaponType == g_allowedWeapons[i])
  210. return PLUGIN_CONTINUE
  211. }
  212.  
  213. engclient_cmd(id, "weapon_knife")
  214.  
  215. return PLUGIN_CONTINUE
  216. }
  217.  
  218. public event_roundend() {
  219. if (g_challenging || g_knifeArena)
  220. CancelAll()
  221. g_noChallengingForAWhile = true
  222. set_task(4.0, "NoChallengingForAWhileToFalse")
  223.  
  224. return PLUGIN_CONTINUE
  225. }
  226.  
  227. public NoChallengingForAWhileToFalse() {
  228. g_noChallengingForAWhile = false
  229. }
  230.  
  231. CancelAll() {
  232. if (g_challenging) {
  233. g_challenging = false
  234. // Close menu of challenged
  235. if (is_user_connected(g_challenged)) {
  236. new usermenu, userkeys
  237. get_user_menu(g_challenged, usermenu, userkeys) // get user menu
  238.  
  239. // Hmm this ain't working :-/
  240. if (usermenu == g_challengemenu) // Close it!
  241. show_menu(g_challenged, 0, "blabla") // show empty menu
  242. }
  243. }
  244. if (g_knifeArena) {
  245. g_knifeArena = false
  246. }
  247. remove_task(TASKID_BOTTHINK)
  248. remove_task(TASKID_CHALLENGING)
  249. }
  250.  
  251. public event_death() {
  252. if (g_challenging || g_knifeArena)
  253. CancelAll()
  254.  
  255. return PLUGIN_CONTINUE
  256. }
  257.  
  258. #if defined DEBUG
  259. public challengefn(id, level, cid) {
  260. if (!cmd_access(id, level, cid, 3))
  261. return PLUGIN_HANDLED
  262.  
  263. new challenger[64], challenged[64]
  264. read_argv(1, challenger, 63)
  265. read_argv(2, challenged, 63)
  266.  
  267. console_print(id, "challenger: %s, challenged: %s", challenger, challenged)
  268.  
  269. new r = str_to_num(challenger)
  270. new d = str_to_num(challenged)
  271. Challenge(r, d)
  272. if (is_user_bot(d))
  273. Accept()
  274.  
  275. return PLUGIN_HANDLED
  276. }
  277. #endif // defined DEBUG
  278.  
  279. public plugin_init() {
  280. register_plugin(PLUGINNAME, VERSION, AUTHOR)
  281. register_event("CurWeapon", "event_holdwpn", "be", "1=1")
  282. register_forward(FM_EmitSound, "forward_emitsound")
  283. g_MAXPLAYERS = get_maxplayers()
  284.  
  285. g_challengemenu = register_menuid("JGHG's automatic knife duel"/*"You are challenged"*/)
  286. register_menucmd(g_challengemenu, MENU_KEY_1 | MENU_KEY_2, "challenged_menu")
  287.  
  288. register_event("DeathMsg", "event_death", "a")
  289. register_event("SendAudio", "event_roundend", "a", "2&%!MRAD_terwin")
  290. register_event("SendAudio", "event_roundend", "a", "2&%!MRAD_ctwin")
  291. register_event("SendAudio", "event_roundend", "a", "2&%!MRAD_rounddraw")
  292.  
  293. #if defined DEBUG
  294. register_clcmd("0challenge", "challengefn", ADMIN_CFG, "<challenger> <challenged> - start knife duel challenge")
  295. #endif // defined DEBUG
  296.  
  297. new Float:maptime = get_cvar_float("mp_timelimit")
  298. if (maptime == 0.0)
  299. maptime = 15.0
  300.  
  301. new Float:anntime = 60.0 * 5.0 // 5 minutes
  302. if (maptime < 5.0)
  303. anntime = maptime / 3.0
  304.  
  305. set_task(anntime, "Announcement", 0, "", 0, "b")
  306. }
  307.  
  308.  


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: colorchat hiba?
HozzászólásElküldve: 2014.02.05. 10:11 
Offline
Lelkes
Avatar

Csatlakozott: 2014.01.26. 14:50
Hozzászólások: 20
Megköszönt másnak: 5 alkalommal
valaki nem tudna segiteni?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: colorchat hiba?
HozzászólásElküldve: 2014.03.29. 16:34 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.12.18. 17:35
Hozzászólások: 365
Megköszönt másnak: 152 alkalommal
Megköszönték neki: 31 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. #define PLUGINNAME "Automatic knife duel"
  2. #define VERSION "0.3"
  3. #define AUTHOR "JGHG"
  4. /*
  5.  
  6. AUTOMATIC KNIFE DUEL
  7. ====================
  8. Where I come from, if you cut the wall repeteadly with your knife it means you're challenging your last opponent to a knife duel. <!-- s;-) --><img src=\"{SMILIES_PATH}/icon_e_wink.gif\" alt=\";-)\" title=\"kacsintás\" /><!-- s;-) -->
  9.  
  10. I decided to automate this process.
  11.  
  12. If only you and another person on the opposite team remain in the round, you can hit a wall (or another object) with your knife, THREE TIMES in fast succession.
  13. By this action you challenge your opponent to a knife duel. The person you challenge gets a menu where he can accept/decline your
  14. challenge. The challenged person has 10 seconds to decide his mind, else the challenge is automatically declined, and the menu should be closed automatically.
  15.  
  16. Should a knife duel start, it works out pretty much like a round of Knife Arena: you can only use the knife (and the C4!).
  17. As soon as the round ends the Knife Arena mode is turned off.
  18.  
  19. /JGHG
  20.  
  21.  
  22. VERSIONS
  23. ========
  24. 050421 0.3 You must now slash with your knife three times in fast succession to challenge someone.
  25. 050208 0.2 Fixed seconds display.
  26. Bots should now respond correctly and a little human like. They will mostly accept challenges. <!-- s;-) --><img src=\"{SMILIES_PATH}/icon_e_wink.gif\" alt=\";-)\" title=\"kacsintás\" /><!-- s;-) -->
  27. Small fixes here and there. <!-- s:-) --><img src=\"{SMILIES_PATH}/icon_e_smile.gif\" alt=\":-)\" title=\"mosoly\" /><!-- s:-) -->
  28. 050208 0.1 First version - largely untested
  29. */
  30.  
  31. #include <amxmodx>
  32. #include <fakemeta>
  33. #include <fun>
  34. #include <colorchat>
  35.  
  36. #define DEBUG
  37.  
  38. #if defined DEBUG
  39. #include <amxmisc>
  40. #endif // defined DEBUG
  41.  
  42. #define MENUSELECT1 0
  43. #define MENUSELECT2 1
  44. #define TASKID_CHALLENGING 2348923
  45. #define TASKID_BOTTHINK 3242321
  46. #define DECIDESECONDS 20
  47. #define ALLOWED_WEAPONS 2
  48. #define KNIFESLASHES 3 // the nr of slashes within a short amount of time until a challenge starts...
  49. // Globals below
  50. new g_allowedWeapons[ALLOWED_WEAPONS] = {CSW_KNIFE, CSW_C4}
  51. new g_MAXPLAYERS
  52. new bool:g_challenging = false
  53. new bool:g_knifeArena = false
  54. new bool:g_noChallengingForAWhile = false
  55. new g_challengemenu
  56. new g_challenger
  57. new g_challenged
  58. new g_challenges[33]
  59. // Globals above
  60.  
  61. public plugin_modules()
  62. {
  63. require_module("fakemeta")
  64. require_module("fun")
  65. }
  66.  
  67. public forward_emitsound(const PIRATE, const Onceuponatimetherewasaverysmall, noise[], const Float:turtlewhoateabiggerturtleand, const Float:afterthatthesmallturtlegot, const veryveryverybig, const theend) {
  68. if (g_noChallengingForAWhile || g_knifeArena || g_challenging || PIRATE < 1 || PIRATE > g_MAXPLAYERS || !is_user_alive(PIRATE) || !equal(noise, "weapons/knife_hitwall1.wav"))
  69. return FMRES_IGNORED
  70.  
  71. new team = get_user_team(PIRATE), otherteam = 0, matchingOpponent = 0
  72. // Make sure exactly one person on each team is alive.
  73. for (new i = 1; i <= g_MAXPLAYERS; i++) {
  74. if (!is_user_connected(i) || !is_user_alive(i) || PIRATE == i)
  75. continue
  76. if (get_user_team(i) == team) {
  77. // No fun.
  78. return FMRES_IGNORED
  79. }
  80. else {
  81. if (++otherteam > 1) {
  82. // No fun.
  83. return FMRES_IGNORED
  84. }
  85. matchingOpponent = i
  86. }
  87. }
  88.  
  89. if (matchingOpponent == 0)
  90. return FMRES_IGNORED
  91.  
  92. if (++g_challenges[PIRATE] >= KNIFESLASHES) {
  93. Challenge(PIRATE, matchingOpponent)
  94. if (is_user_bot(matchingOpponent)) {
  95. new Float:val = float(DECIDESECONDS)
  96. if (val < 2.0)
  97. val = 2.0
  98. remove_task(TASKID_BOTTHINK)
  99. set_task(random_float(1.0, float(DECIDESECONDS) - 1.0), "BotDecides", TASKID_BOTTHINK)
  100. }
  101. g_challenges[PIRATE] = 0
  102. }
  103. else
  104. set_task(1.0, "decreaseChallenges", PIRATE)
  105.  
  106. //client_print(PIRATE, print_chat, "Your challenges: %d", g_challenges[PIRATE])
  107.  
  108. return FMRES_IGNORED
  109. }
  110.  
  111. public decreaseChallenges(id) {
  112. if (--g_challenges[id] < 0)
  113. g_challenges[id] = 0
  114. }
  115.  
  116. public BotDecides() {
  117. if (!g_challenging)
  118. return
  119.  
  120. if (random_num(0,9) > 0)
  121. Accept()
  122. else {
  123. DeclineMsg()
  124. }
  125. g_challenging = false
  126. remove_task(TASKID_CHALLENGING)
  127. }
  128.  
  129. Challenge(challenger, challenged) {
  130. g_challenger = challenger
  131. g_challenged = challenged
  132. g_challenging = true
  133. new challenger_name[32], challenged_name[32]
  134. get_user_name(challenger, challenger_name, 31)
  135. get_user_name(challenged, challenged_name, 31)
  136.  
  137. client_print(challenger, print_chat, "Megakarsz kuzdeni %s -val egy kesparbajban? Varj a valaszara %d masodpercet...", challenged_name, DECIDESECONDS)
  138.  
  139. new menu[1024], keys = MENU_KEY_1 | MENU_KEY_2
  140. format(menu, 1023, "Megakarsz kuzdeni %s egy kesparbajban?^n^nMit teszel? Van %d masodmeprced a valaszra!^n^n\y1\w. Vagjunk bele!^n\y2\w. Nem merek mert gyava kukac vagyok!", challenger_name, DECIDESECONDS)
  141. show_menu(challenged, keys, menu, DECIDESECONDS, "JGHG's automatic knife duel")
  142. set_task(float(DECIDESECONDS), "timed_toolate", TASKID_CHALLENGING)
  143. }
  144.  
  145. public timed_toolate() {
  146. if (g_challenging) {
  147. new challenger_name[32], challenged_name[32]
  148. get_user_name(g_challenger, challenger_name, 31)
  149. get_user_name(g_challenged, challenged_name, 31)
  150. client_print(0, print_chat, "%s Nem válaszolt %s a kihivasara eleg gyorsan...", challenged_name, challenger_name)
  151. CancelAll()
  152. }
  153. }
  154.  
  155. public client_putinserver(id) {
  156. set_task(25.0, "Announcement", id)
  157.  
  158. return PLUGIN_CONTINUE
  159. }
  160.  
  161. public Announcement(id) {
  162. ColorChat(id, RED,"[Knife]^x04: Ha te es egy ellenseged maradt ki tudod hivni kesparbajra, csak verd a kesed a falhoz!")
  163. }
  164.  
  165. public challenged_menu(id, key) {
  166. switch (key) {
  167. case MENUSELECT1: {
  168. // Accept
  169. Accept()
  170. }
  171. case MENUSELECT2: {
  172. // Decline
  173. DeclineMsg()
  174. }
  175. }
  176. g_challenging = false
  177. remove_task(TASKID_CHALLENGING)
  178.  
  179. return PLUGIN_HANDLED
  180. }
  181.  
  182. DeclineMsg() {
  183. new challenger_name[32], challenged_name[32]
  184. get_user_name(g_challenger, challenger_name, 31)
  185. get_user_name(g_challenged, challenged_name, 31)
  186. client_print(0, print_chat, "%s Nem fogadta el %s a kihivasat...", challenged_name, challenger_name)
  187. }
  188.  
  189. Accept() {
  190. new challenger_name[32], challenged_name[32]
  191. get_user_name(g_challenger, challenger_name, 31)
  192. get_user_name(g_challenged, challenged_name, 31)
  193.  
  194. client_print(0, print_chat, "%s Elfogadta %s a kihivasat!", challenged_name, challenger_name)
  195. g_knifeArena = true
  196. give_item(g_challenger, "weapon_knife")
  197. give_item(g_challenged, "weapon_knife")
  198. engclient_cmd(g_challenger, "weapon_knife")
  199. engclient_cmd(g_challenged, "weapon_knife")
  200. }
  201.  
  202. public event_holdwpn(id) {
  203. if (!g_knifeArena || !is_user_alive(id))
  204. return PLUGIN_CONTINUE
  205.  
  206. new weaponType = read_data(2)
  207.  
  208. for (new i = 0; i < ALLOWED_WEAPONS; i++) {
  209. if (weaponType == g_allowedWeapons[i])
  210. return PLUGIN_CONTINUE
  211. }
  212.  
  213. engclient_cmd(id, "weapon_knife")
  214.  
  215. return PLUGIN_CONTINUE
  216. }
  217.  
  218. public event_roundend() {
  219. if (g_challenging || g_knifeArena)
  220. CancelAll()
  221. g_noChallengingForAWhile = true
  222. set_task(4.0, "NoChallengingForAWhileToFalse")
  223.  
  224. return PLUGIN_CONTINUE
  225. }
  226.  
  227. public NoChallengingForAWhileToFalse() {
  228. g_noChallengingForAWhile = false
  229. }
  230.  
  231. CancelAll() {
  232. if (g_challenging) {
  233. g_challenging = false
  234. // Close menu of challenged
  235. if (is_user_connected(g_challenged)) {
  236. new usermenu, userkeys
  237. get_user_menu(g_challenged, usermenu, userkeys) // get user menu
  238.  
  239. // Hmm this ain't working :-/
  240. if (usermenu == g_challengemenu) // Close it!
  241. show_menu(g_challenged, 0, "blabla") // show empty menu
  242. }
  243. }
  244. if (g_knifeArena) {
  245. g_knifeArena = false
  246. }
  247. remove_task(TASKID_BOTTHINK)
  248. remove_task(TASKID_CHALLENGING)
  249. }
  250.  
  251. public event_death() {
  252. if (g_challenging || g_knifeArena)
  253. CancelAll()
  254.  
  255. return PLUGIN_CONTINUE
  256. }
  257.  
  258. #if defined DEBUG
  259. public challengefn(id, level, cid) {
  260. if (!cmd_access(id, level, cid, 3))
  261. return PLUGIN_HANDLED
  262.  
  263. new challenger[64], challenged[64]
  264. read_argv(1, challenger, 63)
  265. read_argv(2, challenged, 63)
  266.  
  267. console_print(id, "challenger: %s, challenged: %s", challenger, challenged)
  268.  
  269. new r = str_to_num(challenger)
  270. new d = str_to_num(challenged)
  271. Challenge(r, d)
  272. if (is_user_bot(d))
  273. Accept()
  274.  
  275. return PLUGIN_HANDLED
  276. }
  277. #endif // defined DEBUG
  278.  
  279. public plugin_init() {
  280. register_plugin(PLUGINNAME, VERSION, AUTHOR)
  281. register_event("CurWeapon", "event_holdwpn", "be", "1=1")
  282. register_forward(FM_EmitSound, "forward_emitsound")
  283. g_MAXPLAYERS = get_maxplayers()
  284.  
  285. g_challengemenu = register_menuid("JGHG's automatic knife duel"/*"You are challenged"*/)
  286. register_menucmd(g_challengemenu, MENU_KEY_1 | MENU_KEY_2, "challenged_menu")
  287.  
  288. register_event("DeathMsg", "event_death", "a")
  289. register_event("SendAudio", "event_roundend", "a", "2&%!MRAD_terwin")
  290. register_event("SendAudio", "event_roundend", "a", "2&%!MRAD_ctwin")
  291. register_event("SendAudio", "event_roundend", "a", "2&%!MRAD_rounddraw")
  292.  
  293. #if defined DEBUG
  294. register_clcmd("0challenge", "challengefn", ADMIN_CFG, "<challenger> <challenged> - start knife duel challenge")
  295. #endif // defined DEBUG
  296.  
  297. new Float:maptime = get_cvar_float("mp_timelimit")
  298. if (maptime == 0.0)
  299. maptime = 15.0
  300.  
  301. new Float:anntime = 60.0 * 5.0 // 5 minutes
  302. if (maptime < 5.0)
  303. anntime = maptime / 3.0
  304.  
  305. set_task(anntime, "Announcement", 0, "", 0, "b")
  306. }
  307.  
  308.  


Tessék!

_________________
Ha segítettem használd a gombot!

Kép
KépKé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 89 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