hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.24. 04:52



Jelenlévő felhasználók

Jelenleg 515 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 514 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  [ 2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Sniper limit
HozzászólásElküldve: 2013.09.30. 20:27 
Offline
Jómunkásember
Avatar

Csatlakozott: 2012.12.24. 13:27
Hozzászólások: 447
Megköszönt másnak: 20 alkalommal
Megköszönték neki: 14 alkalommal
Ezt a plugint úgy kéne be állitani hogy 4v4 től lehessen venni wp-t! max 2 db-t és magozót egyáltalán ne lehessen!

http://amxmodx.crys.hu/site/?p=pluginz& ... niperlimit


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Sniper limit
HozzászólásElküldve: 2013.09.30. 21:36 
Offline
Nagyúr
Avatar

Csatlakozott: 2013.09.04. 15:21
Hozzászólások: 635
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 141 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. /* AMX Mod X script.
  2. * *******************************************
  3. * Fordítás:
  4. * Bence98007
  5. *
  6. *
  7. **********************************************
  8. * Drop AWP with Team Limit and Win limit v1.5 (CS & CS:CZ)
  9. * By SuicideDog & MattOG
  10. *
  11. * Modded orignal from JustinHoMi
  12. *
  13. *Up-To Version 0.5: ASpiRin
  14. *******************************************
  15. *
  16. *
  17. * VERSION: 1.0: MattOG
  18. **********************
  19. *
  20. * Combined all 3 plugins (g3sg1/sg550/awp limit) into one.
  21. * Added seperate commands to control Auto's and Awps. (different limits/rounds)
  22. * Fixed bug with old-style menu's still being able to buy guns. (Credit to bAnTAi, I used his Y.A.S.C. plugin to help with the code).
  23. *
  24. * I didn't make it stop bots:
  25. * 1. All bots come with built in weapon restrictions.
  26. * 2. Bots tend not to be AWP whores <!-- s;) --><img src=\"{SMILIES_PATH}/icon_e_wink.gif\" alt=\";)\" title=\"kacsintás\" /><!-- s;) -->
  27. *
  28. *
  29. * VERSION 1.1: MattOG
  30. *********************
  31. * Changed Maxawps/autos and winspreads to cvars to enable on-the-fly changing, and to allow changes to be set in server/amxx/map configs.
  32. *
  33. *
  34. * VERSION: 1.2: MattOG
  35. **********************
  36. *
  37. * Minor bug fix where old style menu's couldn't buy at all. (Thanks to Olie for pointing it out).
  38. *
  39. *
  40. * VERSION: 1.3: SuicideDog/DaSoul
  41. **********************
  42. *
  43. * Added DaSoul's code to allow it to work with PTB correctly
  44. *
  45. * VERSION: 1.4: KWo
  46. **********************
  47. *
  48. * Little bug fixes causing Run Time Errors etc...
  49. * Blocking pickup limited weapon
  50. * Bots are affected by this plugin, too but it doesn't prevent them from buying (they drop limited weapons after buying)
  51. * Optimized usage of cvars by using pcvar functions.
  52. *
  53. **********************
  54. *
  55. * VERSION: 1.5: KWo
  56. *
  57. * Added support for team balancing (if someone has an awp or auto sniper and get switched alive to the opposite team)
  58. *
  59. **********************
  60. *
  61. * VERSION: 1.52: KWo
  62. *
  63. * Added min_players setting (cvar) to allow awps/autos if at least min_players amount in each team is reached
  64. *
  65. **********************
  66. * CVARS:
  67. ***********
  68. *
  69. * max_awps <2> - Maximum Awps Allowed
  70. * max_autos <xx> - Maximum Autos Allowed
  71. * winspread_awp <xx> - When This Many Rounds Ahead, No Awps Allowed
  72. * winspread_auto <xx> - When This Many Rounds Ahead, No Autos Allowed
  73. * min_players <4> - Below this amount of players in team, awp/auto are completly restricted (no matter of max_awps and max_autos)
  74. * autolimit <1> - 1 = Restrict Auto, 0 = Don't
  75. * awplimit <1/0> - 1 = Restrict Awp, 0 = Don't
  76. * checkrebuy <1/0> - 1 = Prevent Rebuy Command, 0 = Don't
  77. *
  78. * TIPS:
  79. * To ALWAYS restrict to X number of awps/autos set winspread_awp/auto to 0 and max_awps/autos to however many awps/autos
  80. * To ONLY restrict after X number of rounds ahead, set max_awps/autos to 20 and winspread_awp/autos to however many rounds
  81. *
  82. * KNOWN BUG/ISSUES:
  83. ************
  84. * Updating the CVARS in game will only take effect after the following round has finished.
  85. * Bots can buy limitted weapon, but they drop it immediatelly after buying. They cannot pickup dropped limited weapons
  86. * (like human players), so it's not a big issue.
  87. *
  88. * TO DO:
  89. ********
  90. * Dunno, you tell me <!-- s;) --><img src=\"{SMILIES_PATH}/icon_e_wink.gif\" alt=\";)\" title=\"kacsintás\" /><!-- s;) --> Possibly will look at that following round thing, though it isn't too much hassle so I may not bother. You Decide.
  91. *
  92. */
  93.  
  94. #include <amxmodx>
  95. #include <fakemeta>
  96.  
  97. new plist[33] = { 0, ... } // 0 = no awp; 1 = carrying awp
  98. new plist2[33] = {0, ... } // 0 = no auto; 1 = carrying auto
  99. new awp_count[3] // 1 = T; 2 = CT
  100. new auto_count[3] // 1 = T; 2 = CT
  101. new ctscore = 0
  102. new tscore = 0
  103. new pl_team[33]
  104.  
  105. /* PCvars */
  106. new pv_awplimit
  107. new pv_max_awps
  108. new pv_winspread_awp
  109. new pv_autolimit
  110. new pv_max_autos
  111. new pv_winspread_auto
  112. new pv_checkrebuy
  113. new pv_minplayers
  114.  
  115. /* handles restricting the menu */
  116. public menu_awp(id,key)
  117. {
  118. if (get_pcvar_num(pv_awplimit) != 1) return PLUGIN_CONTINUE
  119.  
  120. new team = get_user_team(id)
  121. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  122. new min_players = get_pcvar_num(pv_minplayers)
  123. new team1_num, team2_num
  124. new players[32]
  125.  
  126. get_players(players,team1_num,"e","TERRORIST")
  127. get_players(players,team2_num,"e","CT")
  128.  
  129. if ((team1_num < min_players) || (team2_num < min_players))
  130. {
  131. engclient_cmd(id,"menuselect","10")
  132. client_print(id,print_center,"Nincs eleg ember az egyik csapatban, nem tudod hasznalni az AWP-t!")
  133. return PLUGIN_HANDLED
  134. }
  135.  
  136. if (((team == 2 && ctscore-tscore >= winspread_awp) || (team == 1 && tscore-ctscore >= winspread_awp))
  137. && winspread_awp)
  138. {
  139. engclient_cmd(id,"menuselect","10")
  140. client_print(id,print_center,"Te a nyertes csapatban vagy, nem tudod hasznalni az AWP-t!")
  141. return PLUGIN_HANDLED
  142. }
  143.  
  144. if (awp_count[team] >= get_pcvar_num(pv_max_awps))
  145. {
  146. engclient_cmd(id,"menuselect","10")
  147. client_print(id,print_center,"A csapatodban tul sok AWP van!")
  148. return PLUGIN_HANDLED
  149. }
  150.  
  151. return PLUGIN_CONTINUE
  152. }
  153.  
  154. /* handles restricting the menu */
  155. public menu_auto(id,key)
  156. {
  157. if (get_pcvar_num(pv_autolimit) != 1) return PLUGIN_CONTINUE
  158.  
  159. new team = get_user_team(id)
  160. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  161. new min_players = get_pcvar_num(pv_minplayers)
  162. new team1_num, team2_num
  163. new players[32]
  164.  
  165. get_players(players,team1_num,"e","TERRORIST")
  166. get_players(players,team2_num,"e","CT")
  167.  
  168. if ((team1_num < min_players) || (team2_num < min_players))
  169. {
  170. engclient_cmd(id,"menuselect","10")
  171. client_print(id,print_center,"Nincs eleg ember az egyik csapatban, nem tudod hasznalni a Magozot!")
  172. return PLUGIN_HANDLED
  173. }
  174.  
  175. if (((team == 2 && ctscore-tscore >= winspread_auto) || (team == 1 && tscore-ctscore >= winspread_auto))
  176. && winspread_auto)
  177. {
  178. engclient_cmd(id,"menuselect","10")
  179. client_print(id,print_center,"Te a nyertes csapatban vagy, nem tudod hasznalni a Magozot!")
  180. return PLUGIN_HANDLED
  181. }
  182.  
  183. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  184. {
  185. engclient_cmd(id,"menuselect","10")
  186. client_print(id,print_center,"A csapatodban tul sok Magozo van!")
  187. return PLUGIN_HANDLED
  188. }
  189.  
  190. return PLUGIN_CONTINUE
  191. }
  192.  
  193. /* handles if they script the AWP buy*/
  194. public cmdawp(id)
  195. {
  196. if (get_pcvar_num(pv_awplimit) != 1) return PLUGIN_CONTINUE
  197.  
  198. new team = get_user_team(id)
  199.  
  200. if ((team < 1) || (team > 2)) return PLUGIN_CONTINUE
  201.  
  202. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  203. new name[32]
  204. get_user_name(id,name,31)
  205. new min_players = get_pcvar_num(pv_minplayers)
  206. new team1_num, team2_num
  207. new players[32]
  208.  
  209. get_players(players,team1_num,"e","TERRORIST")
  210. get_players(players,team2_num,"e","CT")
  211.  
  212. if ((team1_num < min_players) || (team2_num < min_players))
  213. {
  214. engclient_cmd(id,"menuselect","10")
  215. client_print(id,print_center,"Nincs eleg ember az egyik csapatban, nem tudod hasznalni az AWP-t!")
  216. return PLUGIN_HANDLED
  217. }
  218.  
  219. if (((team == 2 && ctscore-tscore >= winspread_awp) || (team == 1 && tscore-ctscore >= winspread_awp))
  220. && winspread_awp)
  221. {
  222. client_print(id,print_center,"Te a nyertes csapatban vagy, nem tudod hasznalni az AWP-t!")
  223. return PLUGIN_HANDLED
  224. }
  225.  
  226. if (awp_count[team] >= get_pcvar_num(pv_max_awps))
  227. {
  228. client_print(id,print_center,"A csapatodban tul sok AWP van!")
  229. // client_print(id,print_chat,"You are about to buy an awp. There was currently %d awps in Your team %d - too many to buy.", awp_count[team], team)
  230. // log_message("The player %s was about to buy an awp. There was %d awps in his team %d - too many to buy.", name, awp_count[team], team)
  231. return PLUGIN_HANDLED
  232. }
  233. // client_print(id,print_chat,"You are about to buy an awp. There was currently %d awps in Your team before You bought it.", awp_count[team])
  234. // log_message("The player %s is about to buy an awp. There was %d awps in his team %d before he bought it.", name, awp_count[team], team)
  235.  
  236. return PLUGIN_CONTINUE
  237. }
  238.  
  239. /* handles if they script the AUTO buy*/
  240. public cmdauto(id)
  241. {
  242. if (get_pcvar_num(pv_autolimit) != 1) return PLUGIN_CONTINUE
  243.  
  244. new team = get_user_team(id)
  245. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  246. new min_players = get_pcvar_num(pv_minplayers)
  247. new team1_num, team2_num
  248. new players[32]
  249.  
  250. get_players(players,team1_num,"e","TERRORIST")
  251. get_players(players,team2_num,"e","CT")
  252.  
  253. if ((team1_num < min_players) || (team2_num < min_players))
  254. {
  255. engclient_cmd(id,"menuselect","10")
  256. client_print(id,print_center,"Nincs eleg ember az egyik csapatban, nem tudod hasznalni a Magozot!")
  257. return PLUGIN_HANDLED
  258. }
  259.  
  260. if (((team == 2 && ctscore-tscore >= winspread_auto) || (team == 1 && tscore-ctscore >= winspread_auto))
  261. && winspread_auto)
  262. {
  263. client_print(id,print_center,"Te a nyertes csapatban vagy, nem tudod hasznalni a Magozot!")
  264. return PLUGIN_HANDLED
  265. }
  266.  
  267. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  268. {
  269. client_print(id,print_center,"A csapatodban tul sok Magozo van!")
  270. return PLUGIN_HANDLED
  271. }
  272. return PLUGIN_CONTINUE
  273. }
  274.  
  275. /* handles when a player drops his weapon */
  276. public handle_drop_weapon(id)
  277. {
  278. new tmp1,tmp2
  279. new curweapon = get_user_weapon(id,tmp1,tmp2)
  280. new team = get_user_team(id)
  281.  
  282. /* handles when a player drops their awp */
  283. if (curweapon == CSW_AWP)
  284. {
  285. if (get_pcvar_num(pv_awplimit) != 1)
  286. return PLUGIN_CONTINUE
  287.  
  288. if ((plist[id]==1) && (awp_count[team] > 0))
  289. awp_count[team]--
  290. plist[id] = 0
  291. return PLUGIN_CONTINUE
  292. }
  293. /* handles when a player drops his auto */
  294. else if ((curweapon == CSW_SG550) || (curweapon == CSW_G3SG1))
  295. {
  296. if (get_pcvar_num(pv_autolimit) != 1)
  297. return PLUGIN_CONTINUE
  298.  
  299. if ((plist2[id]==1) && (auto_count[team] > 0))
  300. auto_count[team]--
  301. plist2[id] = 0
  302. return PLUGIN_CONTINUE
  303. }
  304. return PLUGIN_CONTINUE
  305. }
  306.  
  307.  
  308. /* handles when a player picks up an awp */
  309. public handle_pickup_awp(id)
  310. {
  311. if (get_pcvar_num(pv_awplimit) != 1) return PLUGIN_CONTINUE
  312.  
  313. new team = get_user_team(id)
  314. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  315. new name[32]
  316. get_user_name(id,name,31)
  317. new min_players = get_pcvar_num(pv_minplayers)
  318. new team1_num, team2_num
  319. new players[32]
  320.  
  321. get_players(players,team1_num,"e","TERRORIST")
  322. get_players(players,team2_num,"e","CT")
  323.  
  324. if ((team1_num < min_players) || (team2_num < min_players))
  325. {
  326. set_task(0.5, "drop_awp", id)
  327. client_print(id,print_center,"Nincs eleg ember az egyik csapatban, nem tudod hasznalni az AWP-t!")
  328. return PLUGIN_CONTINUE
  329. }
  330.  
  331. if (((team == 2 && ctscore-tscore >= winspread_awp) || (team == 1 && tscore-ctscore >= winspread_awp))
  332. && winspread_awp)
  333. {
  334. client_print(id,print_center,"Te a nyertes csapatban vagy, nem tudod hasznalni az AWP-t!")
  335. set_task(0.5, "drop_awp", id)
  336. return PLUGIN_CONTINUE
  337. }
  338.  
  339. if (awp_count[team] >= get_pcvar_num(pv_max_awps))
  340. {
  341. client_print(id,print_center,"A csapatodban tul sok AWP van!")
  342. // log_message("The player %s bought or picked-up an awp. There is %d awps in his %d team. He should drop it.", name, awp_count[team], team)
  343. set_task(0.5, "drop_awp", id)
  344. // engclient_cmd(id, "drop", "weapon_awp")
  345. // client_cmd(id,"weapon_awp;wait;wait;wait;drop")
  346. return PLUGIN_CONTINUE
  347. }
  348. else
  349. {
  350. plist[id] = 1
  351. awp_count[team]++
  352. // client_print(id,print_chat,"You have bought or picked-up an awp. There is %d awps in Your team.", awp_count[team])
  353. // log_message("The player %s bought or picked-up an awp. There is %d awps in his team %d.", name, awp_count[team], team)
  354. }
  355. return PLUGIN_CONTINUE
  356. }
  357.  
  358. public drop_awp(id)
  359. {
  360. new team
  361.  
  362. if (!is_user_connected(id)) return
  363.  
  364. engclient_cmd(id, "drop", "weapon_awp")
  365.  
  366. if (is_user_bot(id)) // we cannot hook when the bot drops his weapon
  367. {
  368. team = get_user_team(id)
  369. plist[id] = 0
  370. if (awp_count[team] > 0)
  371. awp_count[team]--
  372. }
  373. }
  374.  
  375. /* handles when a player picks up a g3sg1 */
  376. public handle_pickup_g3sg1(id)
  377. {
  378. if (get_pcvar_num(pv_autolimit) != 1) return PLUGIN_CONTINUE
  379.  
  380. new team = get_user_team(id)
  381. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  382. new min_players = get_pcvar_num(pv_minplayers)
  383. new team1_num, team2_num
  384. new players[32]
  385.  
  386. get_players(players,team1_num,"e","TERRORIST")
  387. get_players(players,team2_num,"e","CT")
  388.  
  389. if ((team1_num < min_players) || (team2_num < min_players))
  390. {
  391. client_print(id,print_center,"Nincs eleg ember az egyik csapatban, nem tudod hasznalni a Magozot!")
  392. set_task(0.5, "drop_g3sg1", id)
  393. return PLUGIN_CONTINUE
  394. }
  395.  
  396. if (((team == 2 && ctscore-tscore >= winspread_auto) || (team == 1 && tscore-ctscore >= winspread_auto))
  397. && winspread_auto)
  398. {
  399. client_print(id,print_center,"Te a nyertes csapatban vagy, nem tudod hasznalni a Magozot!")
  400. set_task(0.5, "drop_g3sg1", id)
  401. return PLUGIN_CONTINUE
  402. }
  403.  
  404. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  405. {
  406. client_print(id,print_center,"A csapatodban tul sok Magozo van!")
  407. set_task(0.5, "drop_g3sg1", id)
  408. return PLUGIN_CONTINUE
  409. }
  410. else
  411. {
  412. plist2[id] = 1
  413. auto_count[team]++
  414. }
  415. return PLUGIN_CONTINUE
  416. }
  417.  
  418. public drop_g3sg1(id)
  419. {
  420. new team
  421.  
  422. if (!is_user_connected(id)) return
  423.  
  424. engclient_cmd(id, "drop", "weapon_g3sg1")
  425.  
  426. if (is_user_bot(id)) // we cannot hook when the bot drops his weapon
  427. {
  428. team = get_user_team(id)
  429. plist2[id] = 0
  430. if (auto_count[team] > 0)
  431. auto_count[team]--
  432. }
  433. }
  434.  
  435. /* handles when a player picks up a sg550 */
  436. public handle_pickup_sg550(id)
  437. {
  438. if (get_pcvar_num(pv_autolimit) != 1) return PLUGIN_CONTINUE
  439.  
  440. new team = get_user_team(id)
  441. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  442. new min_players = get_pcvar_num(pv_minplayers)
  443. new team1_num, team2_num
  444. new players[32]
  445.  
  446. get_players(players,team1_num,"e","TERRORIST")
  447. get_players(players,team2_num,"e","CT")
  448.  
  449. if ((team1_num < min_players) || (team2_num < min_players))
  450. {
  451. client_print(id,print_center,"Nincs eleg ember az egyik csapatban, nem tudod hasznalni a Magozot!")
  452. set_task(0.5, "drop_sg550", id)
  453. return PLUGIN_CONTINUE
  454. }
  455.  
  456. if (((team == 2 && ctscore-tscore >= winspread_auto) || (team == 1 && tscore-ctscore >= winspread_auto))
  457. && winspread_auto)
  458. {
  459. client_print(id,print_center,"Te a nyertes csapatban vagy, nem tudod hasznalni a Magozot!")
  460. set_task(0.5, "drop_sg550", id)
  461. return PLUGIN_CONTINUE
  462. }
  463.  
  464. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  465. {
  466. client_print(id,print_center,"A csapatodban tul sok Magozo van!")
  467. set_task(0.5, "drop_sg550", id)
  468. return PLUGIN_CONTINUE
  469. }
  470. else
  471. {
  472. plist2[id] = 1
  473. auto_count[team]++
  474. }
  475. return PLUGIN_CONTINUE
  476. }
  477.  
  478. public drop_sg550(id)
  479. {
  480. new team
  481.  
  482. if (!is_user_connected(id)) return
  483.  
  484. engclient_cmd(id, "drop", "weapon_sg550")
  485.  
  486. if (is_user_bot(id)) // we cannot hook when the bot drops his weapon
  487. {
  488. team = get_user_team(id)
  489. plist2[id] = 0
  490. if (auto_count[team] > 0)
  491. auto_count[team]--
  492. }
  493. }
  494.  
  495. /* removes awp and auto when player dies */
  496. public handle_death()
  497. {
  498. if ((get_pcvar_num(pv_awplimit) != 1) && (get_pcvar_num(pv_autolimit) != 1))
  499. return PLUGIN_CONTINUE
  500.  
  501. new idx = read_data(2)
  502.  
  503. if (plist[idx] == 1)
  504. {
  505. new team = get_user_team(idx)
  506. if (awp_count[team] > 0)
  507. awp_count[team]--
  508. plist[idx] = 0
  509. }
  510. if (plist2[idx] == 1)
  511. {
  512. new team = get_user_team(idx)
  513. if (auto_count[team] > 0)
  514. auto_count[team]--
  515. plist2[idx] = 0
  516. }
  517. return PLUGIN_CONTINUE
  518. }
  519.  
  520. /* clear vars when player connects */
  521. public client_connect(id)
  522. {
  523. plist[id] = 0
  524. plist2[id] = 0
  525. return PLUGIN_CONTINUE
  526. }
  527.  
  528. /* clear vars when player disconnects */
  529. public client_disconnect(id)
  530. {
  531. if (plist[id] == 1)
  532. {
  533. new team = get_user_team(id)
  534. if (awp_count[team] > 0)
  535. awp_count[team]--
  536. }
  537. if (plist2[id] == 1)
  538. {
  539. new team = get_user_team(id)
  540. if (auto_count[team] > 0)
  541. auto_count[team]--
  542. }
  543. plist[id] = 0
  544. plist2[id] = 0
  545.  
  546. return PLUGIN_CONTINUE
  547. }
  548.  
  549. public team_score()
  550. {
  551. if ((get_pcvar_num(pv_awplimit) != 1) && (get_pcvar_num(pv_autolimit) != 1))
  552. return PLUGIN_CONTINUE
  553.  
  554. new team[32]
  555. read_data(1,team,32)
  556.  
  557. if (equal(team,"CT"))
  558. {
  559. ctscore = read_data(2)
  560. }
  561. else if (equal(team,"TERRORIST"))
  562. {
  563. tscore = read_data(2)
  564. }
  565. return PLUGIN_CONTINUE
  566. }
  567.  
  568. public check_winning_team(id)
  569. {
  570. if ((get_pcvar_num(pv_awplimit) != 1) && (get_pcvar_num(pv_autolimit) != 1)) return PLUGIN_CONTINUE
  571. if (!id || id > get_maxplayers()) return PLUGIN_CONTINUE
  572.  
  573. new team = get_user_team(id)
  574. if (plist[id] == 1)
  575. {
  576. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  577. if (((team == 2 && ctscore-tscore >= winspread_awp) || (team == 1 && tscore-ctscore >= winspread_awp))
  578. && winspread_awp)
  579. {
  580. client_print(id,print_center,"Te a nyertes csapatban vagy, nem tudod hasznalni az AWP-t!")
  581. engclient_cmd(id, "drop", "weapon_awp")
  582. return PLUGIN_CONTINUE
  583. }
  584. return PLUGIN_CONTINUE
  585. }
  586. if (plist2[id] == 1)
  587. {
  588. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  589. if (((team == 2 && ctscore-tscore >= winspread_auto) || (team == 1 && tscore-ctscore >= winspread_auto))
  590. && winspread_auto)
  591. {
  592. client_print(id,print_center,"Te a nyertes csapatban vagy, nem tudod hasznalni a Magozot!")
  593. new iwpn, iwpns[32], nwpn[32]
  594. get_user_weapons(id, iwpns, iwpn)
  595. for (new a = 0; a < iwpn; ++a)
  596. {
  597. get_weaponname(iwpns[a], nwpn, 31)
  598. if (equali(nwpn,"weapon_g3sg1") || equali(nwpn,"weapon_sg550"))
  599. engclient_cmd(id, "drop", nwpn)
  600. }
  601. return PLUGIN_CONTINUE
  602. }
  603. return PLUGIN_CONTINUE
  604. }
  605. return PLUGIN_CONTINUE
  606. }
  607.  
  608.  
  609. /*
  610. * 1 = T's: AWP Key 4, AUTOSNIPER Key 5
  611. * 2 = CT's: AWP Key 5, AUTOSNIPER Key 4
  612. */
  613. public via_me(id,key)
  614. {
  615. new team = get_user_team(id)
  616.  
  617. if ((team==1 && key==5) || (team==2 && key==4))
  618. menu_auto(id, key)
  619. if ((team==1 && key==4) || (team==2 && key==5))
  620. menu_awp(id, key)
  621.  
  622. return PLUGIN_CONTINUE
  623. }
  624.  
  625. public check_rebuy(id)
  626. {
  627. if (get_pcvar_num(pv_checkrebuy) != 1) return PLUGIN_CONTINUE
  628. client_print(id,print_center,"Ujravasarlas tiltva van ezen a szerveren!")
  629.  
  630. return PLUGIN_HANDLED
  631. }
  632.  
  633. public total_snipers()
  634. {
  635. new players[32], numPlayerCount, idxPlayer
  636.  
  637. // 1 = T; 2 = CT
  638. awp_count[1] = 0
  639. auto_count[1] = 0
  640.  
  641. get_players(players, numPlayerCount,"he","TERRORIST")
  642. for(idxPlayer = 0; idxPlayer < numPlayerCount; idxPlayer++)
  643. {
  644. new Weapons[32]
  645. new numWeapons, i
  646. get_user_weapons(players[idxPlayer], Weapons, numWeapons)
  647. plist[players[idxPlayer]] = 0
  648. plist2[players[idxPlayer]] = 0
  649. for (i=0; i<numWeapons; i++)
  650. {
  651. if (Weapons[i] == CSW_AWP)
  652. {
  653. plist[players[idxPlayer]] = 1
  654. awp_count[1]++
  655. }
  656. if ((Weapons[i] == CSW_G3SG1) || (Weapons[i] == CSW_SG550))
  657. {
  658. plist2[players[idxPlayer]] = 1
  659. auto_count[1]++
  660. }
  661. }
  662. }
  663.  
  664. awp_count[2] = 0
  665. auto_count[2] = 0
  666.  
  667. get_players(players, numPlayerCount,"he","CT")
  668. for(idxPlayer = 0; idxPlayer < numPlayerCount; idxPlayer++)
  669. {
  670. new Weapons[32]
  671. new numWeapons, i
  672. get_user_weapons(players[idxPlayer], Weapons, numWeapons)
  673. plist[players[idxPlayer]] = 0
  674. plist2[players[idxPlayer]] = 0
  675. for (i=0; i<numWeapons; i++)
  676. {
  677. if (Weapons[i] == CSW_AWP)
  678. {
  679. plist[players[idxPlayer]] = 1
  680. awp_count[2]++
  681. }
  682. if ((Weapons[i] == CSW_G3SG1) || (Weapons[i] == CSW_SG550))
  683. {
  684. plist2[players[idxPlayer]] = 1
  685. auto_count[2]++
  686. }
  687. }
  688. }
  689. }
  690.  
  691. public round_start()
  692. {
  693. total_snipers()
  694. return PLUGIN_CONTINUE
  695. }
  696.  
  697. public hook_touch(ptr, ptd)
  698. {
  699. static ptrClass[32]
  700. static ptdClass[32]
  701. static ptrModel[128]
  702. static team
  703. static min_players
  704. static team1_num, team2_num
  705. static players[32]
  706. static winspread_auto
  707.  
  708. if ((get_pcvar_num(pv_awplimit) != 1) && (get_pcvar_num(pv_autolimit) != 1))
  709. return PLUGIN_CONTINUE
  710.  
  711. if (ptd > get_maxplayers() || ptd < 1 || ptr < 1 )
  712. return PLUGIN_CONTINUE
  713.  
  714. if ( (!pev_valid(ptr)) || (!pev_valid(ptd)) )
  715. return PLUGIN_CONTINUE
  716.  
  717. if (!is_user_connected(ptd))
  718. return PLUGIN_CONTINUE
  719.  
  720. pev(ptr, pev_classname, ptrClass, 31)
  721. pev(ptr, pev_model, ptrModel, 127)
  722. pev(ptd, pev_classname, ptdClass, 31)
  723.  
  724. if (!equal(ptrClass, "weaponbox"))
  725. return PLUGIN_CONTINUE
  726.  
  727. if (equal(ptdClass, "player"))
  728. {
  729. team = get_user_team(ptd)
  730. min_players = get_pcvar_num(pv_minplayers)
  731. get_players(players,team1_num,"e","TERRORIST")
  732. get_players(players,team2_num,"e","CT")
  733.  
  734. if (equal(ptrModel, "models/w_awp.mdl"))
  735. {
  736. if ((team1_num < min_players) || (team2_num < min_players))
  737. {
  738. client_print(ptd,print_center,"Nincs eleg ember az egyik csapatban, nem tudod hasznalni az AWP-t!")
  739. return FMRES_SUPERCEDE
  740. }
  741.  
  742. if (awp_count[team] >= get_pcvar_num(pv_max_awps))
  743. {
  744. client_print(ptd,print_center,"A csapatodban tul sok AWP van!")
  745. return FMRES_SUPERCEDE
  746. }
  747.  
  748. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  749. if (((team == 2 && ctscore-tscore >= winspread_awp) || (team == 1 && tscore-ctscore >= winspread_awp))
  750. && winspread_awp)
  751. {
  752. client_print(ptd,print_center,"Te a nyertes csapatban vagy, nem tudod hasznalni az AWP-t!")
  753. return FMRES_SUPERCEDE
  754. }
  755.  
  756. return PLUGIN_CONTINUE
  757. }
  758. if ((equal(ptrModel, "models/w_g3sg1.mdl")) || (equal(ptrModel, "models/w_sg550.mdl")))
  759. {
  760. if ((team1_num < min_players) || (team2_num < min_players))
  761. {
  762. client_print(ptd,print_center,"Nincs eleg ember az egyik csapatban, nem tudod hasznalni a Magozot!")
  763. return FMRES_SUPERCEDE
  764. }
  765.  
  766. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  767. {
  768. client_print(ptd,print_center,"A csapatodban tul sok Magozo van!")
  769. return FMRES_SUPERCEDE
  770. }
  771.  
  772. winspread_auto = get_pcvar_num(pv_winspread_auto)
  773. if (((team == 2 && ctscore-tscore >= winspread_auto) || (team == 1 && tscore-ctscore >= winspread_auto))
  774. && winspread_auto)
  775. {
  776. client_print(ptd,print_center,"Te a nyertes csapatban vagy, nem tudod hasznalni a Magozot!")
  777. return FMRES_SUPERCEDE
  778. }
  779. return PLUGIN_CONTINUE
  780. }
  781. }
  782. return PLUGIN_CONTINUE
  783. }
  784.  
  785. public team_assign()
  786. {
  787. new arg[2], team
  788. new id = read_data(1)
  789. read_data(2,arg,1)
  790. if ( arg[0] == 'C' )
  791. team = 2
  792. else if ( arg[0] == 'T' )
  793. team = 1
  794. else
  795. team = 0
  796.  
  797. if (!is_user_connected(id) || !is_user_alive(id) || (!plist[id] && !plist2[id])
  798. || (pl_team[id] == team))
  799. {
  800. pl_team[id] = team
  801. return PLUGIN_CONTINUE
  802. }
  803. pl_team[id] = team
  804. total_snipers()
  805. new name[32]
  806. get_user_name(id,name,31)
  807. /*
  808. if (plist[id])
  809.   {
  810. client_print(id,print_center,"You had an awp and got transferred alive to the new team.")
  811. log_message("The player %s with an awp changed the team alive. There is now %d awps for team 1 and %d for team 2.",
  812. name, awp_count[1], awp_count[2])
  813. }
  814. */
  815. return PLUGIN_CONTINUE
  816. }
  817.  
  818.  
  819. public plugin_init()
  820. {
  821. register_plugin("AWP/AUTO Limit (Team/Win)","1.52","SuicideDog/MattOG/DaSoul")
  822. register_menucmd(-31,(1<<4),"via_me" ) // T: AWP, CT: Sig SG-550 Sniper - VGUI
  823. register_menucmd(-31,(1<<5),"via_me" ) // CT: AWP, T: H&K G3SG-1 Sniper Rifle - VGUI
  824. register_menucmd(register_menuid("BuyRifle",1),(1<<4),"via_me" ) // T: AWP, CT: Sig SG-550 Sniper - STANDARD
  825. register_menucmd(register_menuid("BuyRifle",1),(1<<5),"via_me" ) // CT: AWP, T: H&K G3SG-1 Sniper Rifle - STANDARD
  826. register_clcmd("drop","handle_drop_weapon")
  827.  
  828. register_clcmd("awp","cmdawp")
  829. register_clcmd("magnum","cmdawp")
  830. register_clcmd("g3sg1","cmdauto")
  831. register_clcmd("d3au1","cmdauto")
  832. register_clcmd("sg550","cmdauto")
  833. register_clcmd("krieg550","cmdauto")
  834. register_clcmd("rebuy","check_rebuy")
  835.  
  836. pv_awplimit = register_cvar("awplimit","0")
  837. pv_autolimit = register_cvar("autolimit","1")
  838. pv_checkrebuy = register_cvar("checkrebuy","1")
  839. pv_max_awps = register_cvar("max_awps","2")
  840. pv_max_autos = register_cvar("max_autos","1")
  841. pv_minplayers = register_cvar("min_players","4")
  842. pv_winspread_awp = register_cvar("winspread_awp","3")
  843. pv_winspread_auto = register_cvar("winspread_auto","2")
  844.  
  845. register_event("TeamScore", "team_score", "a")
  846. register_event("TeamInfo","team_assign","a")
  847. register_event("WeapPickup","handle_pickup_awp","b","1=18")
  848. register_event("WeapPickup","handle_pickup_sg550","b","1=13")
  849. register_event("WeapPickup","handle_pickup_g3sg1","b","1=24")
  850. register_event("DeathMsg","handle_death","a")
  851.  
  852. register_event("ResetHUD","check_winning_team","b")
  853.  
  854. register_logevent("round_start", 2, "1=Round_Start")
  855. register_forward(FM_Touch, "hook_touch")
  856. }
  857. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  858. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1046\\ f0\\ fs16 \n\\ par }
  859. */
  860.  


Teszt nem volt

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


Ki van itt

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