hlmod.hu

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



Jelenlévő felhasználók

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

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-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  [5 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: AWP Magozó Engedélyezés
HozzászólásElküldve:2013.07.19. 12:44 
Offline
Beavatott

Csatlakozott:2012.06.16. 10:53
Hozzászólások:71
Megköszönt másnak: 6 alkalommal
Megköszönték neki: 1 alkalommal
Hello!
Azt a plugint keresem, amikor az AWPét és a Magozót egy adott játékos határnál engedélyezi. Pl: 3v3 nál már lehet venni de 2v2 nél még nem!
Előre is köszönöm!


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: AWP Magozó Engedélyezés
HozzászólásElküldve:2013.07.19. 12:46 
Offline
Őskövület
Avatar

Csatlakozott:2012.02.27. 09:42
Hozzászólások:2588
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 418 alkalommal
Szerintem ezt keresed(nemtuti)
https://forums.alliedmods.net/showthread.php?p=444328

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: AWP Magozó Engedélyezés
HozzászólásElküldve:2013.07.19. 12:47 
Offline
Őstag

Csatlakozott:2013.01.27. 17:48
Hozzászólások:1247
Megköszönt másnak: 6 alkalommal
Megköszönték neki: 61 alkalommal
makker17 írta:
Hello!
Azt a plugint keresem, amikor az AWPét és a Magozót egy adott játékos határnál engedélyezi. Pl: 3v3 nál már lehet venni de 2v2 nél még nem!
Előre is köszönöm!

nem is tudom 5mp-ig kerestem *-*
http://amxmodx.crys.hu/site/?p=pluginz& ... niperlimit

_________________
banned user


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: AWP Magozó Engedélyezés
HozzászólásElküldve:2013.07.19. 12:52 
Offline
Beavatott

Csatlakozott:2012.06.16. 10:53
Hozzászólások:71
Megköszönt másnak: 6 alkalommal
Megköszönték neki: 1 alkalommal
JogoBella nem azt keresem... ez azt tilja le,hogy MAX.2 Sniperes lehet a teambe. Én azt akarom,hogy ha nincs meg a megfelelő játékos létszám 3v3 akkor egyáltalán ne lehessen snipert venni..

ezt itt hol kell beállítani?


SMA Forráskód: [ Mindet kijelol ]
  1. /* AMX Mod X script.
  2. *
  3. * Drop AWP with Team Limit and Win limit v1.6 (CS & CS:CZ)
  4. * By SuicideDog & MattOG/DaSoul & KWo
  5. *
  6. * Modded orignal from JustinHoMi
  7. *
  8. *Up-To Version 0.5: SuicideDog & JustinHoMi
  9. *******************************************
  10. *
  11. *
  12. * VERSION: 1.0: MattOG
  13. **********************
  14. *
  15. * Combined all 3 plugins (g3sg1/sg550/awp limit) into one.
  16. * Added seperate commands to control Auto's and Awps. (different limits/rounds)
  17. * 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).
  18. *
  19. * I didn't make it stop bots:
  20. * 1. All bots come with built in weapon restrictions.
  21. * 2. Bots tend not to be AWP whores <!-- s;) --><img src=\"{SMILIES_PATH}/icon_e_wink.gif\" alt=\";)\" title=\"kacsintás\" /><!-- s;) -->
  22. *
  23. *
  24. * VERSION 1.1: MattOG
  25. *********************
  26. * 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.
  27. *
  28. *
  29. * VERSION: 1.2: MattOG
  30. **********************
  31. *
  32. * Minor bug fix where old style menu's couldn't buy at all. (Thanks to Olie for pointing it out).
  33. *
  34. *
  35. * VERSION: 1.3: SuicideDog/DaSoul
  36. **********************
  37. *
  38. * Added DaSoul's code to allow it to work with PTB correctly
  39. *
  40. * VERSION: 1.4: KWo
  41. **********************
  42. *
  43. * Little bug fixes causing Run Time Errors etc...
  44. * Blocking pickup limited weapon
  45. * Bots are affected by this plugin, too but it doesn't prevent them from buying (they drop limited weapons after buying)
  46. * Optimized usage of cvars by using pcvar functions.
  47. *
  48. **********************
  49. *
  50. * VERSION: 1.5: KWo
  51. *
  52. * Added support for team balancing (if someone has an awp or auto sniper and get switched alive to the opposite team)
  53. *
  54. **********************
  55. *
  56. * VERSION: 1.52: KWo
  57. *
  58. * Added min_players setting (cvar) to allow awps/autos if at least min_players amount in each team is reached
  59. *
  60. **********************
  61. *
  62. * VERSION: 1.53: KWo
  63. *
  64. * Fixed bug with not counting properly awps and autos when droping weapon by engine (i.e. while buying a new weapon)
  65. * Fixed bug with displaying unnecessary message about awps/autos limitation
  66. * Fixed bug with player blocking from pickup awp/autos when only one of them was really limited by cvars
  67. *
  68. **********************
  69. *
  70. * VERSION: 1.60: KWo
  71. *
  72. * Many functions re-written to fix the stack error problem
  73. *
  74. **********************
  75. * CVARS:
  76. ***********
  77. *
  78. * max_awps <xx> - Maximum Awps Allowed
  79. * max_autos <xx> - Maximum Autos Allowed
  80. * winspread_awp <xx> - When This Many Rounds Ahead, No Awps Allowed
  81. * winspread_auto <xx> - When This Many Rounds Ahead, No Autos Allowed
  82. * min_players <xx> - Below this amount of players in team, awp/auto are completly restricted (no matter of max_awps and max_autos)
  83. * autolimit <1/0> - 1 = Restrict Auto, 0 = Don't
  84. * awplimit <1/0> - 1 = Restrict Awp, 0 = Don't
  85. * checkrebuy <1/0> - 1 = Prevent Rebuy Command, 0 = Don't
  86. *
  87. * TIPS:
  88. * To ALWAYS restrict to X number of awps/autos set winspread_awp/auto to 0 and max_awps/autos to however many awps/autos
  89. * To ONLY restrict after X number of rounds ahead, set max_awps/autos to 20 and winspread_awp/autos to however many rounds
  90. *
  91. * KNOWN BUG/ISSUES:
  92. ************
  93. * Updating the CVARS in game will only take effect after the following round has finished.
  94. * Bots can buy limitted weapon, but they drop it immediatelly after buying. They cannot pickup dropped limited weapons
  95. * (like human players), so it's not a big issue.
  96. *
  97. * TO DO:
  98. ********
  99. * 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.
  100. *
  101. */
  102.  
  103. #include <amxmodx>
  104. #include <fakemeta>
  105.  
  106. #pragma dynamic 8192
  107.  
  108. new const PLUGINNAME[] = "AWP/AUTO Limit (Team/Win)"
  109. new const VERSION[] = "1.60"
  110. new const AUTHOR[] = "SD/MG/DS/KWo"
  111.  
  112. new plist[33] = { 0, ... } // 0 = no awp; 1 = carrying awp
  113. new plist2[33] = {0, ... } // 0 = no auto; 1 = carrying auto
  114. new awp_count[3] // 1 = T; 2 = CT
  115. new auto_count[3] // 1 = T; 2 = CT
  116. new ctscore = 0
  117. new tscore = 0
  118. new gl_maxplayers
  119.  
  120. /* PCvars */
  121. new pv_awplimit
  122. new pv_max_awps
  123. new pv_winspread_awp
  124. new pv_autolimit
  125. new pv_max_autos
  126. new pv_winspread_auto
  127. new pv_checkrebuy
  128. new pv_minplayers
  129.  
  130. /* handles restricting the menu */
  131. public menu_awp(id,key)
  132. {
  133. if (get_pcvar_num(pv_awplimit) != 1) return PLUGIN_CONTINUE
  134.  
  135. new team = get_user_team(id)
  136. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  137. new min_players = get_pcvar_num(pv_minplayers)
  138. new team1_num, team2_num, score_dif
  139. new players[32]
  140.  
  141. get_players(players,team1_num,"e","TERRORIST")
  142. get_players(players,team2_num,"e","CT")
  143.  
  144. if ((team1_num < min_players) || (team2_num < min_players))
  145. {
  146. engclient_cmd(id,"menuselect","10")
  147. client_print(id,print_center,"Not enough people in one team to allow AWP's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  148. return PLUGIN_HANDLED
  149. }
  150.  
  151. if (winspread_awp)
  152. {
  153. if (team == 2)
  154. score_dif = ctscore - tscore
  155. else if (team == 1)
  156. score_dif = tscore - ctscore
  157.  
  158. if (score_dif >= winspread_awp)
  159. {
  160. engclient_cmd(id,"menuselect","10")
  161. client_print(id,print_center,"You are on the winning team and cannot use AWP's (ScDif:%d, WsAWP:%d).", score_dif, winspread_awp)
  162. return PLUGIN_HANDLED
  163. }
  164. }
  165.  
  166. if (awp_count[team] >= get_pcvar_num(pv_max_awps))
  167. {
  168. engclient_cmd(id,"menuselect","10")
  169. client_print(id,print_center,"Too many people on your team have AWP's (%d/%d).", awp_count[team], get_pcvar_num(pv_max_awps))
  170. return PLUGIN_HANDLED
  171. }
  172.  
  173. return PLUGIN_CONTINUE
  174. }
  175.  
  176. /* handles restricting the menu */
  177. public menu_auto(id,key)
  178. {
  179. if (get_pcvar_num(pv_autolimit) != 1) return PLUGIN_CONTINUE
  180.  
  181. new team = get_user_team(id)
  182. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  183. new min_players = get_pcvar_num(pv_minplayers)
  184. new team1_num, team2_num, score_dif
  185. new players[32]
  186.  
  187. get_players(players,team1_num,"e","TERRORIST")
  188. get_players(players,team2_num,"e","CT")
  189.  
  190. if ((team1_num < min_players) || (team2_num < min_players))
  191. {
  192. engclient_cmd(id,"menuselect","10")
  193. client_print(id,print_center,"Not enough people in one team to allow AUTO's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  194. return PLUGIN_HANDLED
  195. }
  196.  
  197. if (winspread_auto)
  198. {
  199. if (team == 2)
  200. score_dif = ctscore - tscore
  201. else if (team == 1)
  202. score_dif = tscore - ctscore
  203.  
  204. if (score_dif >= winspread_auto)
  205. {
  206. engclient_cmd(id,"menuselect","10")
  207. client_print(id,print_center,"You are on the winning team and cannot use AUTO's (ScDif:%d, WsAuto:%d).", score_dif, winspread_auto)
  208. return PLUGIN_HANDLED
  209. }
  210. }
  211.  
  212. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  213. {
  214. engclient_cmd(id,"menuselect","10")
  215. client_print(id,print_center,"Too many people on your team have AUTO's (%d/%d).", auto_count[team], get_pcvar_num(pv_max_autos))
  216. return PLUGIN_HANDLED
  217. }
  218.  
  219. return PLUGIN_CONTINUE
  220. }
  221.  
  222. /* handles if they script the AWP buy*/
  223. public cmdawp(id)
  224. {
  225. if (get_pcvar_num(pv_awplimit) != 1) return PLUGIN_CONTINUE
  226.  
  227. new team = get_user_team(id)
  228.  
  229. if ((team < 1) || (team > 2)) return PLUGIN_CONTINUE
  230.  
  231. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  232. new name[32]
  233. get_user_name(id,name,31)
  234. new min_players = get_pcvar_num(pv_minplayers)
  235. new team1_num, team2_num, score_dif
  236. new players[32]
  237.  
  238. get_players(players,team1_num,"e","TERRORIST")
  239. get_players(players,team2_num,"e","CT")
  240.  
  241. if ((team1_num < min_players) || (team2_num < min_players))
  242. {
  243. client_print(id,print_center,"Not enough people in one team to allow AWP's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  244. return PLUGIN_HANDLED
  245. }
  246.  
  247. if (winspread_awp)
  248. {
  249. if (team == 2)
  250. score_dif = ctscore - tscore
  251. else if (team == 1)
  252. score_dif = tscore - ctscore
  253.  
  254. if (score_dif >= winspread_awp)
  255. {
  256. client_print(id,print_center,"You are on the winning team and cannot use AWP's (ScDif:%d, WsAWP:%d).", score_dif, winspread_awp)
  257. return PLUGIN_HANDLED
  258. }
  259. }
  260.  
  261. if (awp_count[team] >= get_pcvar_num(pv_max_awps))
  262. {
  263. client_print(id,print_center,"Too many people on your team have AWP's (%d/%d).", awp_count[team], get_pcvar_num(pv_max_awps))
  264. return PLUGIN_HANDLED
  265. }
  266.  
  267. return PLUGIN_CONTINUE
  268. }
  269.  
  270. /* handles if they script the AUTO buy*/
  271. public cmdauto(id)
  272. {
  273. if (get_pcvar_num(pv_autolimit) != 1) return PLUGIN_CONTINUE
  274.  
  275. new team = get_user_team(id)
  276. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  277. new min_players = get_pcvar_num(pv_minplayers)
  278. new team1_num, team2_num, score_dif
  279. new players[32]
  280.  
  281. get_players(players,team1_num,"e","TERRORIST")
  282. get_players(players,team2_num,"e","CT")
  283.  
  284. if ((team1_num < min_players) || (team2_num < min_players))
  285. {
  286. client_print(id,print_center,"Not enough people in one team to allow AUTO's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  287. return PLUGIN_HANDLED
  288. }
  289.  
  290. if (winspread_auto)
  291. {
  292. if (team == 2)
  293. score_dif = ctscore - tscore
  294. else if (team == 1)
  295. score_dif = tscore - ctscore
  296.  
  297. if (score_dif >= winspread_auto)
  298. {
  299. client_print(id,print_center,"You are on the winning team and cannot use AUTO's (ScDif:%d, WsAuto:%d).", score_dif, winspread_auto)
  300. return PLUGIN_HANDLED
  301. }
  302. }
  303.  
  304. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  305. {
  306. client_print(id,print_center,"Too many people on your team have AUTO's (%d/%d).", auto_count[team], get_pcvar_num(pv_max_autos))
  307. return PLUGIN_HANDLED
  308. }
  309. return PLUGIN_CONTINUE
  310. }
  311.  
  312.  
  313. /* handles when a player drops his weapon */
  314. public handle_drop_weapon(id)
  315. {
  316. if (!is_user_connected(id))
  317. return PLUGIN_CONTINUE
  318.  
  319. new tmp1,tmp2
  320. new curweapon = get_user_weapon(id,tmp1,tmp2)
  321. new team = get_user_team(id)
  322.  
  323. /* handles when a player drops their awp */
  324. if (curweapon == CSW_AWP)
  325. {
  326. if ((plist[id]==1) && (awp_count[team] > 0))
  327. awp_count[team]--
  328. plist[id] = 0
  329. return PLUGIN_CONTINUE
  330. }
  331. /* handles when a player drops his auto */
  332. else if ((curweapon == CSW_SG550) || (curweapon == CSW_G3SG1))
  333. {
  334. if ((plist2[id]==1) && (auto_count[team] > 0))
  335. auto_count[team]--
  336. plist2[id] = 0
  337. return PLUGIN_CONTINUE
  338. }
  339. return PLUGIN_CONTINUE
  340. }
  341.  
  342. public handle_pickup_weapon(id)
  343. {
  344. if (!is_user_connected(id) || !pev_valid(id))
  345. return PLUGIN_CONTINUE
  346.  
  347. new team = get_user_team(id)
  348. new wpflags = pev(id, pev_weapons)
  349.  
  350. new bool:awp_exists = false
  351. new bool:auto1_exists = false
  352. new bool:auto2_exists = false
  353.  
  354. if (wpflags & (1 << CSW_AWP))
  355. awp_exists = true
  356. if (wpflags & (1 << CSW_SG550))
  357. auto1_exists = true
  358. if (wpflags & (1 << CSW_G3SG1))
  359. auto2_exists = true
  360.  
  361. if ((!awp_exists) && (plist[id] == 1))
  362. {
  363. plist[id] = 0
  364. if (awp_count[team] > 0)
  365. awp_count[team]--
  366. }
  367. else if ((awp_exists) && (plist[id] != 1))
  368. {
  369. handle_pickup_awp(id)
  370. }
  371.  
  372. if ((!auto1_exists) && (!auto2_exists) && (plist2[id] == 1))
  373. {
  374. plist2[id] = 0
  375. if (auto_count[team] > 0)
  376. auto_count[team]--
  377. }
  378. else if ((auto1_exists) && (plist2[id] != 1))
  379. {
  380. handle_pickup_sg550(id)
  381. }
  382. else if ((auto2_exists) && (plist2[id] != 1))
  383. {
  384. handle_pickup_g3sg1(id)
  385. }
  386.  
  387. return PLUGIN_CONTINUE
  388. }
  389.  
  390. /* handles when a player picks up an awp */
  391. public handle_pickup_awp(id)
  392. {
  393. new team = get_user_team(id)
  394. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  395. new name[32]
  396. get_user_name(id,name,31)
  397. new min_players = get_pcvar_num(pv_minplayers)
  398. new team1_num, team2_num, score_dif
  399. new players[32]
  400.  
  401. get_players(players,team1_num,"e","TERRORIST")
  402. get_players(players,team2_num,"e","CT")
  403.  
  404. if (get_pcvar_num(pv_awplimit) == 1)
  405. {
  406. if ((team1_num < min_players) || (team2_num < min_players))
  407. {
  408. set_task(0.5, "drop_awp", id)
  409. client_print(id,print_center,"Not enough people in one team to allow AWP's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  410. return
  411. }
  412.  
  413. if (winspread_awp)
  414. {
  415. if (team == 2)
  416. score_dif = ctscore - tscore
  417. else if (team == 1)
  418. score_dif = tscore - ctscore
  419.  
  420. if (score_dif >= winspread_awp)
  421. {
  422. client_print(id,print_center,"You are on the winning team and cannot use AWP's (ScDif:%d, WsAWP:%d).", score_dif, winspread_awp)
  423. set_task(0.5, "drop_awp", id)
  424. return
  425. }
  426. }
  427.  
  428. if (awp_count[team] >= get_pcvar_num(pv_max_awps))
  429. {
  430. client_print(id,print_center,"Too many people on your team have AWP's (%d/%d).", awp_count[team], get_pcvar_num(pv_max_awps))
  431. set_task(0.5, "drop_awp", id)
  432. return
  433. }
  434. }
  435.  
  436. if (plist[id] != 1)
  437. {
  438. plist[id] = 1
  439. awp_count[team]++
  440. // client_print(id,print_chat,"You have bought or picked-up an awp. There is %d awps in Your team.", awp_count[team])
  441. // log_message("The player %s bought or picked-up an awp. There is %d awps in his team %d.", name, awp_count[team], team)
  442. }
  443. }
  444.  
  445. public drop_awp(id)
  446. {
  447. new team, wpflags
  448. if (is_user_alive(id))
  449. {
  450. wpflags = pev(id, pev_weapons)
  451. if (wpflags & (1 << CSW_AWP))
  452. {
  453. engclient_cmd(id, "drop", "weapon_awp")
  454.  
  455. if (plist[id] == 1)
  456. {
  457. team = get_user_team(id)
  458. if (awp_count[team] > 0)
  459. awp_count[team]--
  460. plist[id] = 0
  461. }
  462. }
  463. }
  464. }
  465.  
  466. /* handles when a player picks up a g3sg1 */
  467. public handle_pickup_g3sg1(id)
  468. {
  469. new team = get_user_team(id)
  470. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  471. new min_players = get_pcvar_num(pv_minplayers)
  472. new team1_num, team2_num, score_dif
  473. new players[32]
  474.  
  475. get_players(players,team1_num,"e","TERRORIST")
  476. get_players(players,team2_num,"e","CT")
  477.  
  478. if (get_pcvar_num(pv_autolimit) == 1)
  479. {
  480. if ((team1_num < min_players) || (team2_num < min_players))
  481. {
  482. client_print(id,print_center,"Not enough people in one team to allow AUTO's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  483. set_task(0.5, "drop_g3sg1", id)
  484. return
  485. }
  486.  
  487. if (winspread_auto)
  488. {
  489. if (team == 2)
  490. score_dif = ctscore - tscore
  491. else if (team == 1)
  492. score_dif = tscore - ctscore
  493.  
  494. if (score_dif >= winspread_auto)
  495. {
  496. client_print(id,print_center,"You are on the winning team and cannot use AUTO's (ScDif:%d, WsAuto:%d).", score_dif, winspread_auto)
  497. set_task(0.5, "drop_g3sg1", id)
  498. return
  499. }
  500. }
  501.  
  502. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  503. {
  504. client_print(id,print_center,"Too many people on your team have AUTO's (%d/%d).", auto_count[team], get_pcvar_num(pv_max_autos))
  505. set_task(0.5, "drop_g3sg1", id)
  506. return
  507. }
  508. }
  509.  
  510. if (plist2[id] != 1)
  511. {
  512. plist2[id] = 1
  513. auto_count[team]++
  514. }
  515. }
  516.  
  517. public drop_g3sg1(id)
  518. {
  519. new team, wpflags
  520. if (is_user_alive(id))
  521. {
  522. wpflags = pev(id, pev_weapons)
  523. if (wpflags & (1 << CSW_G3SG1))
  524. {
  525. engclient_cmd(id, "drop", "weapon_g3sg1")
  526.  
  527. if (plist2[id] == 1)
  528. {
  529. team = get_user_team(id)
  530. if (auto_count[team] > 0)
  531. auto_count[team]--
  532. plist2[id] = 0
  533. }
  534. }
  535. }
  536. }
  537.  
  538. /* handles when a player picks up a sg550 */
  539. public handle_pickup_sg550(id)
  540. {
  541. new team = get_user_team(id)
  542. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  543. new min_players = get_pcvar_num(pv_minplayers)
  544. new team1_num, team2_num, score_dif
  545. new players[32]
  546.  
  547. get_players(players,team1_num,"e","TERRORIST")
  548. get_players(players,team2_num,"e","CT")
  549.  
  550. if (get_pcvar_num(pv_autolimit) == 1)
  551. {
  552. if ((team1_num < min_players) || (team2_num < min_players))
  553. {
  554. client_print(id,print_center,"Not enough people in one team to allow AUTO's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  555. set_task(0.5, "drop_sg550", id)
  556. return
  557. }
  558.  
  559. if (winspread_auto)
  560. {
  561. if (team == 2)
  562. score_dif = ctscore - tscore
  563. else if (team == 1)
  564. score_dif = tscore - ctscore
  565.  
  566. if (score_dif >= winspread_auto)
  567. {
  568. client_print(id,print_center,"You are on the winning team and cannot use AUTO's (ScDif:%d, WsAuto:%d).", score_dif, winspread_auto)
  569. set_task(0.5, "drop_sg550", id)
  570. return
  571. }
  572. }
  573.  
  574.  
  575. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  576. {
  577. client_print(id,print_center,"Too many people on your team have AUTO's (%d/%d).", auto_count[team], get_pcvar_num(pv_max_autos))
  578. set_task(0.5, "drop_sg550", id)
  579. return
  580. }
  581. }
  582.  
  583. if (plist2[id] != 1)
  584. {
  585. plist2[id] = 1
  586. auto_count[team]++
  587. }
  588. }
  589.  
  590. public drop_sg550(id)
  591. {
  592. new team, wpflags
  593. if (is_user_alive(id))
  594. {
  595. wpflags = pev(id, pev_weapons)
  596. if (wpflags & (1 << CSW_SG550))
  597. {
  598. engclient_cmd(id, "drop", "weapon_sg550")
  599.  
  600. if (plist2[id] == 1)
  601. {
  602. team = get_user_team(id)
  603. if (auto_count[team] > 0)
  604. auto_count[team]--
  605. plist2[id] = 0
  606. }
  607. }
  608. }
  609. }
  610.  
  611. /* removes awp and auto when player dies */
  612. public handle_death()
  613. {
  614. if ((get_pcvar_num(pv_awplimit) != 1) && (get_pcvar_num(pv_autolimit) != 1))
  615. return PLUGIN_CONTINUE
  616.  
  617. new idx = read_data(2)
  618. if ((idx < 1) || (idx > gl_maxplayers))
  619. return PLUGIN_CONTINUE
  620.  
  621. if (plist[idx] == 1)
  622. {
  623. new team = get_user_team(idx)
  624. if (awp_count[team] > 0)
  625. awp_count[team]--
  626. plist[idx] = 0
  627. }
  628.  
  629. if (plist2[idx] == 1)
  630. {
  631. new team = get_user_team(idx)
  632. if (auto_count[team] > 0)
  633. auto_count[team]--
  634. plist2[idx] = 0
  635. }
  636.  
  637. return PLUGIN_CONTINUE
  638. }
  639.  
  640. /* clear vars when player connects */
  641. public client_connect(id)
  642. {
  643. if ((id > 0) && (id <= gl_maxplayers))
  644. {
  645. plist[id] = 0
  646. plist2[id] = 0
  647. }
  648. return PLUGIN_CONTINUE
  649. }
  650.  
  651. /* clear vars when player disconnects */
  652. public client_disconnect(id)
  653. {
  654. new team
  655. if ((id > 0) && (id <= gl_maxplayers))
  656. {
  657. if (plist[id] == 1)
  658. {
  659. team = get_user_team(id)
  660. if (awp_count[team] > 0)
  661. awp_count[team]--
  662. }
  663. if (plist2[id] == 1)
  664. {
  665. team = get_user_team(id)
  666. if (auto_count[team] > 0)
  667. auto_count[team]--
  668. }
  669. plist[id] = 0
  670. plist2[id] = 0
  671. }
  672. return PLUGIN_CONTINUE
  673. }
  674.  
  675. public team_score()
  676. {
  677. if ((get_pcvar_num(pv_awplimit) != 1) && (get_pcvar_num(pv_autolimit) != 1))
  678. return PLUGIN_CONTINUE
  679.  
  680. new team[32]
  681. read_data(1,team,32)
  682.  
  683. if (equal(team,"CT"))
  684. {
  685. ctscore = read_data(2)
  686. }
  687. else if (equal(team,"TERRORIST"))
  688. {
  689. tscore = read_data(2)
  690. }
  691. return PLUGIN_CONTINUE
  692. }
  693.  
  694. public check_winning_team(id)
  695. {
  696. if ((get_pcvar_num(pv_awplimit) != 1) && (get_pcvar_num(pv_autolimit) != 1)) return PLUGIN_CONTINUE
  697. if ((id < 1) || (id > gl_maxplayers)) return PLUGIN_CONTINUE
  698. if (!is_user_alive(id)) return PLUGIN_CONTINUE
  699.  
  700. new team = get_user_team(id)
  701. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  702. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  703. new wpflags, score_dif
  704.  
  705. if (plist[id] == 1)
  706. {
  707. if (winspread_awp)
  708. {
  709. if (team == 2)
  710. score_dif = ctscore - tscore
  711. else if (team == 1)
  712. score_dif = tscore - ctscore
  713.  
  714. if (score_dif >= winspread_awp)
  715. {
  716. client_print(id,print_center,"You are on the winning team and cannot use AWP's (ScDif:%d, WsAWP:%d).", score_dif, winspread_awp)
  717.  
  718. engclient_cmd(id, "drop", "weapon_awp")
  719. plist[id] = 0
  720. if (awp_count[team] > 0)
  721. awp_count[team]--
  722. }
  723. }
  724. }
  725. if (plist2[id] == 1)
  726. {
  727. if (winspread_auto)
  728. {
  729. if (team == 2)
  730. score_dif = ctscore - tscore
  731. else if (team == 1)
  732. score_dif = tscore - ctscore
  733.  
  734. if (score_dif >= winspread_auto)
  735. {
  736. client_print(id,print_center,"You are on the winning team and cannot use AUTO's (ScDif:%d, WsAuto:%d).", score_dif, winspread_auto)
  737. wpflags = pev(id, pev_weapons)
  738. if (wpflags & (1 << CSW_SG550))
  739. {
  740. engclient_cmd(id, "drop", "weapon_sg550")
  741. plist2[id] = 0
  742. if (auto_count[team] > 0)
  743. auto_count[team]--
  744. }
  745. if (wpflags & (1 << CSW_G3SG1))
  746. {
  747. engclient_cmd(id, "drop", "weapon_g3sg1")
  748. plist2[id] = 0
  749. if (auto_count[team] > 0)
  750. auto_count[team]--
  751. }
  752. }
  753. }
  754. }
  755. return PLUGIN_CONTINUE
  756. }
  757.  
  758. /*
  759. * 1 = T's: AWP Key 4, AUTOSNIPER Key 5
  760. * 2 = CT's: AWP Key 5, AUTOSNIPER Key 4
  761. */
  762. public via_me(id,key)
  763. {
  764. new team = get_user_team(id)
  765.  
  766. if ((team==1 && key==5) || (team==2 && key==4))
  767. menu_auto(id, key)
  768. if ((team==1 && key==4) || (team==2 && key==5))
  769. menu_awp(id, key)
  770.  
  771. return PLUGIN_CONTINUE
  772. }
  773.  
  774. public check_rebuy(id)
  775. {
  776. if (get_pcvar_num(pv_checkrebuy) != 1) return PLUGIN_CONTINUE
  777. client_print(id,print_center,"Sorry Rebuy command is blocked on this server")
  778.  
  779. return PLUGIN_HANDLED
  780. }
  781.  
  782. public total_snipers()
  783. {
  784. new players[32], numPlayerCount, idxPlayer, id, wpflags
  785.  
  786. // 1 = T; 2 = CT
  787. awp_count[1] = 0
  788. auto_count[1] = 0
  789.  
  790. get_players(players, numPlayerCount,"he","TERRORIST")
  791. for(idxPlayer = 0; idxPlayer < numPlayerCount; idxPlayer++)
  792. {
  793. id = players[idxPlayer]
  794.  
  795. if (!is_user_alive(id)) continue
  796. if (!pev_valid(id)) continue
  797.  
  798. wpflags = pev(id, pev_weapons)
  799.  
  800. plist[id] = 0
  801. plist2[id] = 0
  802.  
  803. if (wpflags & (1 << CSW_AWP))
  804. {
  805. plist[id] = 1
  806. awp_count[1]++
  807. }
  808. if ((wpflags & (1 << CSW_SG550)) || (wpflags & (1 << CSW_G3SG1)))
  809. {
  810. plist2[id] = 1
  811. auto_count[1]++
  812. }
  813. }
  814.  
  815. awp_count[2] = 0
  816. auto_count[2] = 0
  817.  
  818. get_players(players, numPlayerCount,"he","CT")
  819. for(idxPlayer = 0; idxPlayer < numPlayerCount; idxPlayer++)
  820. {
  821. id = players[idxPlayer]
  822.  
  823. if (!is_user_alive(id)) continue
  824. if (!pev_valid(id)) continue
  825.  
  826. plist[id] = 0
  827. plist2[id] = 0
  828.  
  829. if (wpflags & (1 << CSW_AWP))
  830. {
  831. plist[id] = 1
  832. awp_count[2]++
  833. }
  834. if ((wpflags & (1 << CSW_SG550)) || (wpflags & (1 << CSW_G3SG1)))
  835. {
  836. plist2[id] = 1
  837. auto_count[2]++
  838. }
  839. }
  840. }
  841.  
  842. public round_start()
  843. {
  844. total_snipers()
  845. }
  846.  
  847. public hook_touch(ptr, ptd)
  848. {
  849. static ptrClass[32]
  850. static ptdClass[32]
  851. static ptrModel[128]
  852. static team
  853. static min_players
  854. static team1_num, team2_num, score_dif
  855. static players[32]
  856. static winspread_awp
  857. static winspread_auto
  858. static wpflags
  859.  
  860. if ((get_pcvar_num(pv_awplimit) != 1) && (get_pcvar_num(pv_autolimit) != 1))
  861. return PLUGIN_CONTINUE
  862.  
  863. if (ptd > gl_maxplayers || ptd < 1 || ptr < 1 )
  864. return PLUGIN_CONTINUE
  865.  
  866. if ( (!pev_valid(ptr)) || (!pev_valid(ptd)) )
  867. return PLUGIN_CONTINUE
  868.  
  869. if (!is_user_connected(ptd))
  870. return PLUGIN_CONTINUE
  871.  
  872. pev(ptr, pev_classname, ptrClass, 31)
  873. pev(ptr, pev_model, ptrModel, 127)
  874. pev(ptd, pev_classname, ptdClass, 31)
  875.  
  876. if ((!equal(ptrClass, "weaponbox")) && (!equal(ptrClass, "armoury_entity"))
  877. && (!equal(ptrClass, "csdmw_",6)))
  878. return PLUGIN_CONTINUE
  879.  
  880. if (equal(ptdClass, "player"))
  881. {
  882. team = get_user_team(ptd)
  883. min_players = get_pcvar_num(pv_minplayers)
  884. get_players(players,team1_num,"e","TERRORIST")
  885. get_players(players,team2_num,"e","CT")
  886. wpflags = pev(ptd, pev_weapons)
  887.  
  888. if ((equal(ptrModel, "models/w_awp.mdl")) && (get_pcvar_num(pv_awplimit) == 1))
  889. {
  890. if (!(wpflags & (1 << CSW_AWP)))
  891. {
  892. if ((team1_num < min_players) || (team2_num < min_players))
  893. {
  894. client_print(ptd,print_center,"Not enough people in one team to allow AWP's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  895. return FMRES_SUPERCEDE
  896. }
  897.  
  898. if (awp_count[team] >= get_pcvar_num(pv_max_awps))
  899. {
  900. client_print(ptd,print_center,"Too many people on your team have AWP's (%d/%d).", awp_count[team], get_pcvar_num(pv_max_awps))
  901. return FMRES_SUPERCEDE
  902. }
  903.  
  904. winspread_awp = get_pcvar_num(pv_winspread_awp)
  905. if (winspread_awp)
  906. {
  907. score_dif = 0
  908. if (team == 2)
  909. score_dif = ctscore - tscore
  910. else if (team == 1)
  911. score_dif = tscore - ctscore
  912.  
  913. if (score_dif >= winspread_awp)
  914. {
  915. client_print(ptd,print_center,"You are on the winning team and cannot use AWP's (ScDif:%d, WsAWP:%d).", score_dif, winspread_awp)
  916. return FMRES_SUPERCEDE
  917. }
  918. }
  919. }
  920. return PLUGIN_CONTINUE
  921. }
  922.  
  923. if (((equal(ptrModel, "models/w_g3sg1.mdl")) || (equal(ptrModel, "models/w_sg550.mdl")))
  924. && (get_pcvar_num(pv_autolimit) == 1))
  925. {
  926. if (!(wpflags & (1 << CSW_SG550)) && !(wpflags & (1 << CSW_SG550)))
  927. {
  928. if ((team1_num < min_players) || (team2_num < min_players))
  929. {
  930. client_print(ptd,print_center,"Not enough people in one team to allow AUTO's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  931. return FMRES_SUPERCEDE
  932. }
  933.  
  934. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  935. {
  936. client_print(ptd,print_center,"Too many people on your team have AUTO's (%d/%d).", auto_count[team], get_pcvar_num(pv_max_autos))
  937. return FMRES_SUPERCEDE
  938. }
  939.  
  940. winspread_auto = get_pcvar_num(pv_winspread_auto)
  941. if (winspread_auto)
  942. {
  943. score_dif = 0
  944. if (team == 2)
  945. score_dif = ctscore - tscore
  946. else if (team == 1)
  947. score_dif = tscore - ctscore
  948.  
  949. if (score_dif >= winspread_auto)
  950. {
  951. client_print(ptd,print_center,"You are on the winning team and cannot use AUTO's (ScDif:%d, WsAuto:%d).", score_dif, winspread_auto)
  952. return FMRES_SUPERCEDE
  953. }
  954. }
  955. }
  956. return PLUGIN_CONTINUE
  957. }
  958. }
  959. return PLUGIN_CONTINUE
  960. }
  961.  
  962. public team_assign()
  963. {
  964. new id = read_data(1)
  965. if ((id < 1) || (id > gl_maxplayers))
  966. return PLUGIN_CONTINUE
  967. if (!is_user_connected(id) || !is_user_alive(id) || (!plist[id] && !plist2[id]))
  968. return PLUGIN_CONTINUE
  969.  
  970. total_snipers()
  971.  
  972. return PLUGIN_CONTINUE
  973. }
  974.  
  975. public plugin_init()
  976. {
  977. register_plugin(PLUGINNAME,VERSION,AUTHOR)
  978. register_menucmd(-31,(1<<4),"via_me" ) // T: AWP, CT: Sig SG-550 Sniper - VGUI
  979. register_menucmd(-31,(1<<5),"via_me" ) // CT: AWP, T: H&K G3SG-1 Sniper Rifle - VGUI
  980. register_menucmd(register_menuid("BuyRifle",1),(1<<4),"via_me" ) // T: AWP, CT: Sig SG-550 Sniper - STANDARD
  981. register_menucmd(register_menuid("BuyRifle",1),(1<<5),"via_me" ) // CT: AWP, T: H&K G3SG-1 Sniper Rifle - STANDARD
  982. register_clcmd("drop","handle_drop_weapon")
  983.  
  984. register_clcmd("awp","cmdawp")
  985. register_clcmd("magnum","cmdawp")
  986. register_clcmd("g3sg1","cmdauto")
  987. register_clcmd("d3au1","cmdauto")
  988. register_clcmd("sg550","cmdauto")
  989. register_clcmd("krieg550","cmdauto")
  990. register_clcmd("rebuy","check_rebuy")
  991.  
  992. pv_awplimit = register_cvar("awplimit","1")
  993. pv_autolimit = register_cvar("autolimit","1")
  994. pv_checkrebuy = register_cvar("checkrebuy","1")
  995. pv_max_awps = register_cvar("max_awps","2")
  996. pv_max_autos = register_cvar("max_autos","1")
  997. pv_minplayers = register_cvar("min_players","5")
  998. pv_winspread_awp = register_cvar("winspread_awp","3")
  999. pv_winspread_auto = register_cvar("winspread_auto","2")
  1000.  
  1001. register_event("TeamScore", "team_score", "a")
  1002. register_event("TeamInfo","team_assign","a")
  1003. register_event("WeapPickup","handle_pickup_weapon","b")
  1004. register_event("DeathMsg","handle_death","a")
  1005.  
  1006. register_event("ResetHUD","check_winning_team","be")
  1007.  
  1008. register_logevent("round_start", 2, "1=Round_Start")
  1009. register_forward(FM_Touch, "hook_touch")
  1010. gl_maxplayers = get_maxplayers()
  1011. }


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: AWP Magozó Engedélyezés
HozzászólásElküldve:2013.07.19. 13:06 
Offline
Őskövület
Avatar

Csatlakozott:2012.02.27. 09:42
Hozzászólások:2588
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 418 alkalommal
997. sor :
SMA Forráskód: [ Mindet kijelol ]
  1. pv_minplayers = register_cvar("min_players","5")

makker17 írta:
JogoBella nem azt keresem... ez azt tilja le,hogy MAX.2 Sniperes lehet a teambe. Én azt akarom,hogy ha nincs meg a megfelelő játékos létszám 3v3 akkor egyáltalán ne lehessen snipert venni..

ezt itt hol kell beállítani?


SMA Forráskód: [ Mindet kijelol ]
  1. /* AMX Mod X script.
  2. *
  3. * Drop AWP with Team Limit and Win limit v1.6 (CS & CS:CZ)
  4. * By SuicideDog & MattOG/DaSoul & KWo
  5. *
  6. * Modded orignal from JustinHoMi
  7. *
  8. *Up-To Version 0.5: SuicideDog & JustinHoMi
  9. *******************************************
  10. *
  11. *
  12. * VERSION: 1.0: MattOG
  13. **********************
  14. *
  15. * Combined all 3 plugins (g3sg1/sg550/awp limit) into one.
  16. * Added seperate commands to control Auto's and Awps. (different limits/rounds)
  17. * 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).
  18. *
  19. * I didn't make it stop bots:
  20. * 1. All bots come with built in weapon restrictions.
  21. * 2. Bots tend not to be AWP whores <!-- s;) --><img src=\"{SMILIES_PATH}/icon_e_wink.gif\" alt=\";)\" title=\"kacsintás\" /><!-- s;) -->
  22. *
  23. *
  24. * VERSION 1.1: MattOG
  25. *********************
  26. * 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.
  27. *
  28. *
  29. * VERSION: 1.2: MattOG
  30. **********************
  31. *
  32. * Minor bug fix where old style menu's couldn't buy at all. (Thanks to Olie for pointing it out).
  33. *
  34. *
  35. * VERSION: 1.3: SuicideDog/DaSoul
  36. **********************
  37. *
  38. * Added DaSoul's code to allow it to work with PTB correctly
  39. *
  40. * VERSION: 1.4: KWo
  41. **********************
  42. *
  43. * Little bug fixes causing Run Time Errors etc...
  44. * Blocking pickup limited weapon
  45. * Bots are affected by this plugin, too but it doesn't prevent them from buying (they drop limited weapons after buying)
  46. * Optimized usage of cvars by using pcvar functions.
  47. *
  48. **********************
  49. *
  50. * VERSION: 1.5: KWo
  51. *
  52. * Added support for team balancing (if someone has an awp or auto sniper and get switched alive to the opposite team)
  53. *
  54. **********************
  55. *
  56. * VERSION: 1.52: KWo
  57. *
  58. * Added min_players setting (cvar) to allow awps/autos if at least min_players amount in each team is reached
  59. *
  60. **********************
  61. *
  62. * VERSION: 1.53: KWo
  63. *
  64. * Fixed bug with not counting properly awps and autos when droping weapon by engine (i.e. while buying a new weapon)
  65. * Fixed bug with displaying unnecessary message about awps/autos limitation
  66. * Fixed bug with player blocking from pickup awp/autos when only one of them was really limited by cvars
  67. *
  68. **********************
  69. *
  70. * VERSION: 1.60: KWo
  71. *
  72. * Many functions re-written to fix the stack error problem
  73. *
  74. **********************
  75. * CVARS:
  76. ***********
  77. *
  78. * max_awps <xx> - Maximum Awps Allowed
  79. * max_autos <xx> - Maximum Autos Allowed
  80. * winspread_awp <xx> - When This Many Rounds Ahead, No Awps Allowed
  81. * winspread_auto <xx> - When This Many Rounds Ahead, No Autos Allowed
  82. * min_players <xx> - Below this amount of players in team, awp/auto are completly restricted (no matter of max_awps and max_autos)
  83. * autolimit <1/0> - 1 = Restrict Auto, 0 = Don't
  84. * awplimit <1/0> - 1 = Restrict Awp, 0 = Don't
  85. * checkrebuy <1/0> - 1 = Prevent Rebuy Command, 0 = Don't
  86. *
  87. * TIPS:
  88. * To ALWAYS restrict to X number of awps/autos set winspread_awp/auto to 0 and max_awps/autos to however many awps/autos
  89. * To ONLY restrict after X number of rounds ahead, set max_awps/autos to 20 and winspread_awp/autos to however many rounds
  90. *
  91. * KNOWN BUG/ISSUES:
  92. ************
  93. * Updating the CVARS in game will only take effect after the following round has finished.
  94. * Bots can buy limitted weapon, but they drop it immediatelly after buying. They cannot pickup dropped limited weapons
  95. * (like human players), so it's not a big issue.
  96. *
  97. * TO DO:
  98. ********
  99. * 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.
  100. *
  101. */
  102.  
  103. #include <amxmodx>
  104. #include <fakemeta>
  105.  
  106. #pragma dynamic 8192
  107.  
  108. new const PLUGINNAME[] = "AWP/AUTO Limit (Team/Win)"
  109. new const VERSION[] = "1.60"
  110. new const AUTHOR[] = "SD/MG/DS/KWo"
  111.  
  112. new plist[33] = { 0, ... } // 0 = no awp; 1 = carrying awp
  113. new plist2[33] = {0, ... } // 0 = no auto; 1 = carrying auto
  114. new awp_count[3] // 1 = T; 2 = CT
  115. new auto_count[3] // 1 = T; 2 = CT
  116. new ctscore = 0
  117. new tscore = 0
  118. new gl_maxplayers
  119.  
  120. /* PCvars */
  121. new pv_awplimit
  122. new pv_max_awps
  123. new pv_winspread_awp
  124. new pv_autolimit
  125. new pv_max_autos
  126. new pv_winspread_auto
  127. new pv_checkrebuy
  128. new pv_minplayers
  129.  
  130. /* handles restricting the menu */
  131. public menu_awp(id,key)
  132. {
  133. if (get_pcvar_num(pv_awplimit) != 1) return PLUGIN_CONTINUE
  134.  
  135. new team = get_user_team(id)
  136. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  137. new min_players = get_pcvar_num(pv_minplayers)
  138. new team1_num, team2_num, score_dif
  139. new players[32]
  140.  
  141. get_players(players,team1_num,"e","TERRORIST")
  142. get_players(players,team2_num,"e","CT")
  143.  
  144. if ((team1_num < min_players) || (team2_num < min_players))
  145. {
  146. engclient_cmd(id,"menuselect","10")
  147. client_print(id,print_center,"Not enough people in one team to allow AWP's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  148. return PLUGIN_HANDLED
  149. }
  150.  
  151. if (winspread_awp)
  152. {
  153. if (team == 2)
  154. score_dif = ctscore - tscore
  155. else if (team == 1)
  156. score_dif = tscore - ctscore
  157.  
  158. if (score_dif >= winspread_awp)
  159. {
  160. engclient_cmd(id,"menuselect","10")
  161. client_print(id,print_center,"You are on the winning team and cannot use AWP's (ScDif:%d, WsAWP:%d).", score_dif, winspread_awp)
  162. return PLUGIN_HANDLED
  163. }
  164. }
  165.  
  166. if (awp_count[team] >= get_pcvar_num(pv_max_awps))
  167. {
  168. engclient_cmd(id,"menuselect","10")
  169. client_print(id,print_center,"Too many people on your team have AWP's (%d/%d).", awp_count[team], get_pcvar_num(pv_max_awps))
  170. return PLUGIN_HANDLED
  171. }
  172.  
  173. return PLUGIN_CONTINUE
  174. }
  175.  
  176. /* handles restricting the menu */
  177. public menu_auto(id,key)
  178. {
  179. if (get_pcvar_num(pv_autolimit) != 1) return PLUGIN_CONTINUE
  180.  
  181. new team = get_user_team(id)
  182. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  183. new min_players = get_pcvar_num(pv_minplayers)
  184. new team1_num, team2_num, score_dif
  185. new players[32]
  186.  
  187. get_players(players,team1_num,"e","TERRORIST")
  188. get_players(players,team2_num,"e","CT")
  189.  
  190. if ((team1_num < min_players) || (team2_num < min_players))
  191. {
  192. engclient_cmd(id,"menuselect","10")
  193. client_print(id,print_center,"Not enough people in one team to allow AUTO's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  194. return PLUGIN_HANDLED
  195. }
  196.  
  197. if (winspread_auto)
  198. {
  199. if (team == 2)
  200. score_dif = ctscore - tscore
  201. else if (team == 1)
  202. score_dif = tscore - ctscore
  203.  
  204. if (score_dif >= winspread_auto)
  205. {
  206. engclient_cmd(id,"menuselect","10")
  207. client_print(id,print_center,"You are on the winning team and cannot use AUTO's (ScDif:%d, WsAuto:%d).", score_dif, winspread_auto)
  208. return PLUGIN_HANDLED
  209. }
  210. }
  211.  
  212. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  213. {
  214. engclient_cmd(id,"menuselect","10")
  215. client_print(id,print_center,"Too many people on your team have AUTO's (%d/%d).", auto_count[team], get_pcvar_num(pv_max_autos))
  216. return PLUGIN_HANDLED
  217. }
  218.  
  219. return PLUGIN_CONTINUE
  220. }
  221.  
  222. /* handles if they script the AWP buy*/
  223. public cmdawp(id)
  224. {
  225. if (get_pcvar_num(pv_awplimit) != 1) return PLUGIN_CONTINUE
  226.  
  227. new team = get_user_team(id)
  228.  
  229. if ((team < 1) || (team > 2)) return PLUGIN_CONTINUE
  230.  
  231. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  232. new name[32]
  233. get_user_name(id,name,31)
  234. new min_players = get_pcvar_num(pv_minplayers)
  235. new team1_num, team2_num, score_dif
  236. new players[32]
  237.  
  238. get_players(players,team1_num,"e","TERRORIST")
  239. get_players(players,team2_num,"e","CT")
  240.  
  241. if ((team1_num < min_players) || (team2_num < min_players))
  242. {
  243. client_print(id,print_center,"Not enough people in one team to allow AWP's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  244. return PLUGIN_HANDLED
  245. }
  246.  
  247. if (winspread_awp)
  248. {
  249. if (team == 2)
  250. score_dif = ctscore - tscore
  251. else if (team == 1)
  252. score_dif = tscore - ctscore
  253.  
  254. if (score_dif >= winspread_awp)
  255. {
  256. client_print(id,print_center,"You are on the winning team and cannot use AWP's (ScDif:%d, WsAWP:%d).", score_dif, winspread_awp)
  257. return PLUGIN_HANDLED
  258. }
  259. }
  260.  
  261. if (awp_count[team] >= get_pcvar_num(pv_max_awps))
  262. {
  263. client_print(id,print_center,"Too many people on your team have AWP's (%d/%d).", awp_count[team], get_pcvar_num(pv_max_awps))
  264. return PLUGIN_HANDLED
  265. }
  266.  
  267. return PLUGIN_CONTINUE
  268. }
  269.  
  270. /* handles if they script the AUTO buy*/
  271. public cmdauto(id)
  272. {
  273. if (get_pcvar_num(pv_autolimit) != 1) return PLUGIN_CONTINUE
  274.  
  275. new team = get_user_team(id)
  276. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  277. new min_players = get_pcvar_num(pv_minplayers)
  278. new team1_num, team2_num, score_dif
  279. new players[32]
  280.  
  281. get_players(players,team1_num,"e","TERRORIST")
  282. get_players(players,team2_num,"e","CT")
  283.  
  284. if ((team1_num < min_players) || (team2_num < min_players))
  285. {
  286. client_print(id,print_center,"Not enough people in one team to allow AUTO's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  287. return PLUGIN_HANDLED
  288. }
  289.  
  290. if (winspread_auto)
  291. {
  292. if (team == 2)
  293. score_dif = ctscore - tscore
  294. else if (team == 1)
  295. score_dif = tscore - ctscore
  296.  
  297. if (score_dif >= winspread_auto)
  298. {
  299. client_print(id,print_center,"You are on the winning team and cannot use AUTO's (ScDif:%d, WsAuto:%d).", score_dif, winspread_auto)
  300. return PLUGIN_HANDLED
  301. }
  302. }
  303.  
  304. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  305. {
  306. client_print(id,print_center,"Too many people on your team have AUTO's (%d/%d).", auto_count[team], get_pcvar_num(pv_max_autos))
  307. return PLUGIN_HANDLED
  308. }
  309. return PLUGIN_CONTINUE
  310. }
  311.  
  312.  
  313. /* handles when a player drops his weapon */
  314. public handle_drop_weapon(id)
  315. {
  316. if (!is_user_connected(id))
  317. return PLUGIN_CONTINUE
  318.  
  319. new tmp1,tmp2
  320. new curweapon = get_user_weapon(id,tmp1,tmp2)
  321. new team = get_user_team(id)
  322.  
  323. /* handles when a player drops their awp */
  324. if (curweapon == CSW_AWP)
  325. {
  326. if ((plist[id]==1) && (awp_count[team] > 0))
  327. awp_count[team]--
  328. plist[id] = 0
  329. return PLUGIN_CONTINUE
  330. }
  331. /* handles when a player drops his auto */
  332. else if ((curweapon == CSW_SG550) || (curweapon == CSW_G3SG1))
  333. {
  334. if ((plist2[id]==1) && (auto_count[team] > 0))
  335. auto_count[team]--
  336. plist2[id] = 0
  337. return PLUGIN_CONTINUE
  338. }
  339. return PLUGIN_CONTINUE
  340. }
  341.  
  342. public handle_pickup_weapon(id)
  343. {
  344. if (!is_user_connected(id) || !pev_valid(id))
  345. return PLUGIN_CONTINUE
  346.  
  347. new team = get_user_team(id)
  348. new wpflags = pev(id, pev_weapons)
  349.  
  350. new bool:awp_exists = false
  351. new bool:auto1_exists = false
  352. new bool:auto2_exists = false
  353.  
  354. if (wpflags & (1 << CSW_AWP))
  355. awp_exists = true
  356. if (wpflags & (1 << CSW_SG550))
  357. auto1_exists = true
  358. if (wpflags & (1 << CSW_G3SG1))
  359. auto2_exists = true
  360.  
  361. if ((!awp_exists) && (plist[id] == 1))
  362. {
  363. plist[id] = 0
  364. if (awp_count[team] > 0)
  365. awp_count[team]--
  366. }
  367. else if ((awp_exists) && (plist[id] != 1))
  368. {
  369. handle_pickup_awp(id)
  370. }
  371.  
  372. if ((!auto1_exists) && (!auto2_exists) && (plist2[id] == 1))
  373. {
  374. plist2[id] = 0
  375. if (auto_count[team] > 0)
  376. auto_count[team]--
  377. }
  378. else if ((auto1_exists) && (plist2[id] != 1))
  379. {
  380. handle_pickup_sg550(id)
  381. }
  382. else if ((auto2_exists) && (plist2[id] != 1))
  383. {
  384. handle_pickup_g3sg1(id)
  385. }
  386.  
  387. return PLUGIN_CONTINUE
  388. }
  389.  
  390. /* handles when a player picks up an awp */
  391. public handle_pickup_awp(id)
  392. {
  393. new team = get_user_team(id)
  394. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  395. new name[32]
  396. get_user_name(id,name,31)
  397. new min_players = get_pcvar_num(pv_minplayers)
  398. new team1_num, team2_num, score_dif
  399. new players[32]
  400.  
  401. get_players(players,team1_num,"e","TERRORIST")
  402. get_players(players,team2_num,"e","CT")
  403.  
  404. if (get_pcvar_num(pv_awplimit) == 1)
  405. {
  406. if ((team1_num < min_players) || (team2_num < min_players))
  407. {
  408. set_task(0.5, "drop_awp", id)
  409. client_print(id,print_center,"Not enough people in one team to allow AWP's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  410. return
  411. }
  412.  
  413. if (winspread_awp)
  414. {
  415. if (team == 2)
  416. score_dif = ctscore - tscore
  417. else if (team == 1)
  418. score_dif = tscore - ctscore
  419.  
  420. if (score_dif >= winspread_awp)
  421. {
  422. client_print(id,print_center,"You are on the winning team and cannot use AWP's (ScDif:%d, WsAWP:%d).", score_dif, winspread_awp)
  423. set_task(0.5, "drop_awp", id)
  424. return
  425. }
  426. }
  427.  
  428. if (awp_count[team] >= get_pcvar_num(pv_max_awps))
  429. {
  430. client_print(id,print_center,"Too many people on your team have AWP's (%d/%d).", awp_count[team], get_pcvar_num(pv_max_awps))
  431. set_task(0.5, "drop_awp", id)
  432. return
  433. }
  434. }
  435.  
  436. if (plist[id] != 1)
  437. {
  438. plist[id] = 1
  439. awp_count[team]++
  440. // client_print(id,print_chat,"You have bought or picked-up an awp. There is %d awps in Your team.", awp_count[team])
  441. // log_message("The player %s bought or picked-up an awp. There is %d awps in his team %d.", name, awp_count[team], team)
  442. }
  443. }
  444.  
  445. public drop_awp(id)
  446. {
  447. new team, wpflags
  448. if (is_user_alive(id))
  449. {
  450. wpflags = pev(id, pev_weapons)
  451. if (wpflags & (1 << CSW_AWP))
  452. {
  453. engclient_cmd(id, "drop", "weapon_awp")
  454.  
  455. if (plist[id] == 1)
  456. {
  457. team = get_user_team(id)
  458. if (awp_count[team] > 0)
  459. awp_count[team]--
  460. plist[id] = 0
  461. }
  462. }
  463. }
  464. }
  465.  
  466. /* handles when a player picks up a g3sg1 */
  467. public handle_pickup_g3sg1(id)
  468. {
  469. new team = get_user_team(id)
  470. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  471. new min_players = get_pcvar_num(pv_minplayers)
  472. new team1_num, team2_num, score_dif
  473. new players[32]
  474.  
  475. get_players(players,team1_num,"e","TERRORIST")
  476. get_players(players,team2_num,"e","CT")
  477.  
  478. if (get_pcvar_num(pv_autolimit) == 1)
  479. {
  480. if ((team1_num < min_players) || (team2_num < min_players))
  481. {
  482. client_print(id,print_center,"Not enough people in one team to allow AUTO's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  483. set_task(0.5, "drop_g3sg1", id)
  484. return
  485. }
  486.  
  487. if (winspread_auto)
  488. {
  489. if (team == 2)
  490. score_dif = ctscore - tscore
  491. else if (team == 1)
  492. score_dif = tscore - ctscore
  493.  
  494. if (score_dif >= winspread_auto)
  495. {
  496. client_print(id,print_center,"You are on the winning team and cannot use AUTO's (ScDif:%d, WsAuto:%d).", score_dif, winspread_auto)
  497. set_task(0.5, "drop_g3sg1", id)
  498. return
  499. }
  500. }
  501.  
  502. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  503. {
  504. client_print(id,print_center,"Too many people on your team have AUTO's (%d/%d).", auto_count[team], get_pcvar_num(pv_max_autos))
  505. set_task(0.5, "drop_g3sg1", id)
  506. return
  507. }
  508. }
  509.  
  510. if (plist2[id] != 1)
  511. {
  512. plist2[id] = 1
  513. auto_count[team]++
  514. }
  515. }
  516.  
  517. public drop_g3sg1(id)
  518. {
  519. new team, wpflags
  520. if (is_user_alive(id))
  521. {
  522. wpflags = pev(id, pev_weapons)
  523. if (wpflags & (1 << CSW_G3SG1))
  524. {
  525. engclient_cmd(id, "drop", "weapon_g3sg1")
  526.  
  527. if (plist2[id] == 1)
  528. {
  529. team = get_user_team(id)
  530. if (auto_count[team] > 0)
  531. auto_count[team]--
  532. plist2[id] = 0
  533. }
  534. }
  535. }
  536. }
  537.  
  538. /* handles when a player picks up a sg550 */
  539. public handle_pickup_sg550(id)
  540. {
  541. new team = get_user_team(id)
  542. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  543. new min_players = get_pcvar_num(pv_minplayers)
  544. new team1_num, team2_num, score_dif
  545. new players[32]
  546.  
  547. get_players(players,team1_num,"e","TERRORIST")
  548. get_players(players,team2_num,"e","CT")
  549.  
  550. if (get_pcvar_num(pv_autolimit) == 1)
  551. {
  552. if ((team1_num < min_players) || (team2_num < min_players))
  553. {
  554. client_print(id,print_center,"Not enough people in one team to allow AUTO's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  555. set_task(0.5, "drop_sg550", id)
  556. return
  557. }
  558.  
  559. if (winspread_auto)
  560. {
  561. if (team == 2)
  562. score_dif = ctscore - tscore
  563. else if (team == 1)
  564. score_dif = tscore - ctscore
  565.  
  566. if (score_dif >= winspread_auto)
  567. {
  568. client_print(id,print_center,"You are on the winning team and cannot use AUTO's (ScDif:%d, WsAuto:%d).", score_dif, winspread_auto)
  569. set_task(0.5, "drop_sg550", id)
  570. return
  571. }
  572. }
  573.  
  574.  
  575. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  576. {
  577. client_print(id,print_center,"Too many people on your team have AUTO's (%d/%d).", auto_count[team], get_pcvar_num(pv_max_autos))
  578. set_task(0.5, "drop_sg550", id)
  579. return
  580. }
  581. }
  582.  
  583. if (plist2[id] != 1)
  584. {
  585. plist2[id] = 1
  586. auto_count[team]++
  587. }
  588. }
  589.  
  590. public drop_sg550(id)
  591. {
  592. new team, wpflags
  593. if (is_user_alive(id))
  594. {
  595. wpflags = pev(id, pev_weapons)
  596. if (wpflags & (1 << CSW_SG550))
  597. {
  598. engclient_cmd(id, "drop", "weapon_sg550")
  599.  
  600. if (plist2[id] == 1)
  601. {
  602. team = get_user_team(id)
  603. if (auto_count[team] > 0)
  604. auto_count[team]--
  605. plist2[id] = 0
  606. }
  607. }
  608. }
  609. }
  610.  
  611. /* removes awp and auto when player dies */
  612. public handle_death()
  613. {
  614. if ((get_pcvar_num(pv_awplimit) != 1) && (get_pcvar_num(pv_autolimit) != 1))
  615. return PLUGIN_CONTINUE
  616.  
  617. new idx = read_data(2)
  618. if ((idx < 1) || (idx > gl_maxplayers))
  619. return PLUGIN_CONTINUE
  620.  
  621. if (plist[idx] == 1)
  622. {
  623. new team = get_user_team(idx)
  624. if (awp_count[team] > 0)
  625. awp_count[team]--
  626. plist[idx] = 0
  627. }
  628.  
  629. if (plist2[idx] == 1)
  630. {
  631. new team = get_user_team(idx)
  632. if (auto_count[team] > 0)
  633. auto_count[team]--
  634. plist2[idx] = 0
  635. }
  636.  
  637. return PLUGIN_CONTINUE
  638. }
  639.  
  640. /* clear vars when player connects */
  641. public client_connect(id)
  642. {
  643. if ((id > 0) && (id <= gl_maxplayers))
  644. {
  645. plist[id] = 0
  646. plist2[id] = 0
  647. }
  648. return PLUGIN_CONTINUE
  649. }
  650.  
  651. /* clear vars when player disconnects */
  652. public client_disconnect(id)
  653. {
  654. new team
  655. if ((id > 0) && (id <= gl_maxplayers))
  656. {
  657. if (plist[id] == 1)
  658. {
  659. team = get_user_team(id)
  660. if (awp_count[team] > 0)
  661. awp_count[team]--
  662. }
  663. if (plist2[id] == 1)
  664. {
  665. team = get_user_team(id)
  666. if (auto_count[team] > 0)
  667. auto_count[team]--
  668. }
  669. plist[id] = 0
  670. plist2[id] = 0
  671. }
  672. return PLUGIN_CONTINUE
  673. }
  674.  
  675. public team_score()
  676. {
  677. if ((get_pcvar_num(pv_awplimit) != 1) && (get_pcvar_num(pv_autolimit) != 1))
  678. return PLUGIN_CONTINUE
  679.  
  680. new team[32]
  681. read_data(1,team,32)
  682.  
  683. if (equal(team,"CT"))
  684. {
  685. ctscore = read_data(2)
  686. }
  687. else if (equal(team,"TERRORIST"))
  688. {
  689. tscore = read_data(2)
  690. }
  691. return PLUGIN_CONTINUE
  692. }
  693.  
  694. public check_winning_team(id)
  695. {
  696. if ((get_pcvar_num(pv_awplimit) != 1) && (get_pcvar_num(pv_autolimit) != 1)) return PLUGIN_CONTINUE
  697. if ((id < 1) || (id > gl_maxplayers)) return PLUGIN_CONTINUE
  698. if (!is_user_alive(id)) return PLUGIN_CONTINUE
  699.  
  700. new team = get_user_team(id)
  701. new winspread_awp = get_pcvar_num(pv_winspread_awp)
  702. new winspread_auto = get_pcvar_num(pv_winspread_auto)
  703. new wpflags, score_dif
  704.  
  705. if (plist[id] == 1)
  706. {
  707. if (winspread_awp)
  708. {
  709. if (team == 2)
  710. score_dif = ctscore - tscore
  711. else if (team == 1)
  712. score_dif = tscore - ctscore
  713.  
  714. if (score_dif >= winspread_awp)
  715. {
  716. client_print(id,print_center,"You are on the winning team and cannot use AWP's (ScDif:%d, WsAWP:%d).", score_dif, winspread_awp)
  717.  
  718. engclient_cmd(id, "drop", "weapon_awp")
  719. plist[id] = 0
  720. if (awp_count[team] > 0)
  721. awp_count[team]--
  722. }
  723. }
  724. }
  725. if (plist2[id] == 1)
  726. {
  727. if (winspread_auto)
  728. {
  729. if (team == 2)
  730. score_dif = ctscore - tscore
  731. else if (team == 1)
  732. score_dif = tscore - ctscore
  733.  
  734. if (score_dif >= winspread_auto)
  735. {
  736. client_print(id,print_center,"You are on the winning team and cannot use AUTO's (ScDif:%d, WsAuto:%d).", score_dif, winspread_auto)
  737. wpflags = pev(id, pev_weapons)
  738. if (wpflags & (1 << CSW_SG550))
  739. {
  740. engclient_cmd(id, "drop", "weapon_sg550")
  741. plist2[id] = 0
  742. if (auto_count[team] > 0)
  743. auto_count[team]--
  744. }
  745. if (wpflags & (1 << CSW_G3SG1))
  746. {
  747. engclient_cmd(id, "drop", "weapon_g3sg1")
  748. plist2[id] = 0
  749. if (auto_count[team] > 0)
  750. auto_count[team]--
  751. }
  752. }
  753. }
  754. }
  755. return PLUGIN_CONTINUE
  756. }
  757.  
  758. /*
  759. * 1 = T's: AWP Key 4, AUTOSNIPER Key 5
  760. * 2 = CT's: AWP Key 5, AUTOSNIPER Key 4
  761. */
  762. public via_me(id,key)
  763. {
  764. new team = get_user_team(id)
  765.  
  766. if ((team==1 && key==5) || (team==2 && key==4))
  767. menu_auto(id, key)
  768. if ((team==1 && key==4) || (team==2 && key==5))
  769. menu_awp(id, key)
  770.  
  771. return PLUGIN_CONTINUE
  772. }
  773.  
  774. public check_rebuy(id)
  775. {
  776. if (get_pcvar_num(pv_checkrebuy) != 1) return PLUGIN_CONTINUE
  777. client_print(id,print_center,"Sorry Rebuy command is blocked on this server")
  778.  
  779. return PLUGIN_HANDLED
  780. }
  781.  
  782. public total_snipers()
  783. {
  784. new players[32], numPlayerCount, idxPlayer, id, wpflags
  785.  
  786. // 1 = T; 2 = CT
  787. awp_count[1] = 0
  788. auto_count[1] = 0
  789.  
  790. get_players(players, numPlayerCount,"he","TERRORIST")
  791. for(idxPlayer = 0; idxPlayer < numPlayerCount; idxPlayer++)
  792. {
  793. id = players[idxPlayer]
  794.  
  795. if (!is_user_alive(id)) continue
  796. if (!pev_valid(id)) continue
  797.  
  798. wpflags = pev(id, pev_weapons)
  799.  
  800. plist[id] = 0
  801. plist2[id] = 0
  802.  
  803. if (wpflags & (1 << CSW_AWP))
  804. {
  805. plist[id] = 1
  806. awp_count[1]++
  807. }
  808. if ((wpflags & (1 << CSW_SG550)) || (wpflags & (1 << CSW_G3SG1)))
  809. {
  810. plist2[id] = 1
  811. auto_count[1]++
  812. }
  813. }
  814.  
  815. awp_count[2] = 0
  816. auto_count[2] = 0
  817.  
  818. get_players(players, numPlayerCount,"he","CT")
  819. for(idxPlayer = 0; idxPlayer < numPlayerCount; idxPlayer++)
  820. {
  821. id = players[idxPlayer]
  822.  
  823. if (!is_user_alive(id)) continue
  824. if (!pev_valid(id)) continue
  825.  
  826. plist[id] = 0
  827. plist2[id] = 0
  828.  
  829. if (wpflags & (1 << CSW_AWP))
  830. {
  831. plist[id] = 1
  832. awp_count[2]++
  833. }
  834. if ((wpflags & (1 << CSW_SG550)) || (wpflags & (1 << CSW_G3SG1)))
  835. {
  836. plist2[id] = 1
  837. auto_count[2]++
  838. }
  839. }
  840. }
  841.  
  842. public round_start()
  843. {
  844. total_snipers()
  845. }
  846.  
  847. public hook_touch(ptr, ptd)
  848. {
  849. static ptrClass[32]
  850. static ptdClass[32]
  851. static ptrModel[128]
  852. static team
  853. static min_players
  854. static team1_num, team2_num, score_dif
  855. static players[32]
  856. static winspread_awp
  857. static winspread_auto
  858. static wpflags
  859.  
  860. if ((get_pcvar_num(pv_awplimit) != 1) && (get_pcvar_num(pv_autolimit) != 1))
  861. return PLUGIN_CONTINUE
  862.  
  863. if (ptd > gl_maxplayers || ptd < 1 || ptr < 1 )
  864. return PLUGIN_CONTINUE
  865.  
  866. if ( (!pev_valid(ptr)) || (!pev_valid(ptd)) )
  867. return PLUGIN_CONTINUE
  868.  
  869. if (!is_user_connected(ptd))
  870. return PLUGIN_CONTINUE
  871.  
  872. pev(ptr, pev_classname, ptrClass, 31)
  873. pev(ptr, pev_model, ptrModel, 127)
  874. pev(ptd, pev_classname, ptdClass, 31)
  875.  
  876. if ((!equal(ptrClass, "weaponbox")) && (!equal(ptrClass, "armoury_entity"))
  877. && (!equal(ptrClass, "csdmw_",6)))
  878. return PLUGIN_CONTINUE
  879.  
  880. if (equal(ptdClass, "player"))
  881. {
  882. team = get_user_team(ptd)
  883. min_players = get_pcvar_num(pv_minplayers)
  884. get_players(players,team1_num,"e","TERRORIST")
  885. get_players(players,team2_num,"e","CT")
  886. wpflags = pev(ptd, pev_weapons)
  887.  
  888. if ((equal(ptrModel, "models/w_awp.mdl")) && (get_pcvar_num(pv_awplimit) == 1))
  889. {
  890. if (!(wpflags & (1 << CSW_AWP)))
  891. {
  892. if ((team1_num < min_players) || (team2_num < min_players))
  893. {
  894. client_print(ptd,print_center,"Not enough people in one team to allow AWP's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  895. return FMRES_SUPERCEDE
  896. }
  897.  
  898. if (awp_count[team] >= get_pcvar_num(pv_max_awps))
  899. {
  900. client_print(ptd,print_center,"Too many people on your team have AWP's (%d/%d).", awp_count[team], get_pcvar_num(pv_max_awps))
  901. return FMRES_SUPERCEDE
  902. }
  903.  
  904. winspread_awp = get_pcvar_num(pv_winspread_awp)
  905. if (winspread_awp)
  906. {
  907. score_dif = 0
  908. if (team == 2)
  909. score_dif = ctscore - tscore
  910. else if (team == 1)
  911. score_dif = tscore - ctscore
  912.  
  913. if (score_dif >= winspread_awp)
  914. {
  915. client_print(ptd,print_center,"You are on the winning team and cannot use AWP's (ScDif:%d, WsAWP:%d).", score_dif, winspread_awp)
  916. return FMRES_SUPERCEDE
  917. }
  918. }
  919. }
  920. return PLUGIN_CONTINUE
  921. }
  922.  
  923. if (((equal(ptrModel, "models/w_g3sg1.mdl")) || (equal(ptrModel, "models/w_sg550.mdl")))
  924. && (get_pcvar_num(pv_autolimit) == 1))
  925. {
  926. if (!(wpflags & (1 << CSW_SG550)) && !(wpflags & (1 << CSW_SG550)))
  927. {
  928. if ((team1_num < min_players) || (team2_num < min_players))
  929. {
  930. client_print(ptd,print_center,"Not enough people in one team to allow AUTO's (Ts:%d, CTs:%d, MIN:%d).", team1_num, team2_num, min_players)
  931. return FMRES_SUPERCEDE
  932. }
  933.  
  934. if (auto_count[team] >= get_pcvar_num(pv_max_autos))
  935. {
  936. client_print(ptd,print_center,"Too many people on your team have AUTO's (%d/%d).", auto_count[team], get_pcvar_num(pv_max_autos))
  937. return FMRES_SUPERCEDE
  938. }
  939.  
  940. winspread_auto = get_pcvar_num(pv_winspread_auto)
  941. if (winspread_auto)
  942. {
  943. score_dif = 0
  944. if (team == 2)
  945. score_dif = ctscore - tscore
  946. else if (team == 1)
  947. score_dif = tscore - ctscore
  948.  
  949. if (score_dif >= winspread_auto)
  950. {
  951. client_print(ptd,print_center,"You are on the winning team and cannot use AUTO's (ScDif:%d, WsAuto:%d).", score_dif, winspread_auto)
  952. return FMRES_SUPERCEDE
  953. }
  954. }
  955. }
  956. return PLUGIN_CONTINUE
  957. }
  958. }
  959. return PLUGIN_CONTINUE
  960. }
  961.  
  962. public team_assign()
  963. {
  964. new id = read_data(1)
  965. if ((id < 1) || (id > gl_maxplayers))
  966. return PLUGIN_CONTINUE
  967. if (!is_user_connected(id) || !is_user_alive(id) || (!plist[id] && !plist2[id]))
  968. return PLUGIN_CONTINUE
  969.  
  970. total_snipers()
  971.  
  972. return PLUGIN_CONTINUE
  973. }
  974.  
  975. public plugin_init()
  976. {
  977. register_plugin(PLUGINNAME,VERSION,AUTHOR)
  978. register_menucmd(-31,(1<<4),"via_me" ) // T: AWP, CT: Sig SG-550 Sniper - VGUI
  979. register_menucmd(-31,(1<<5),"via_me" ) // CT: AWP, T: H&K G3SG-1 Sniper Rifle - VGUI
  980. register_menucmd(register_menuid("BuyRifle",1),(1<<4),"via_me" ) // T: AWP, CT: Sig SG-550 Sniper - STANDARD
  981. register_menucmd(register_menuid("BuyRifle",1),(1<<5),"via_me" ) // CT: AWP, T: H&K G3SG-1 Sniper Rifle - STANDARD
  982. register_clcmd("drop","handle_drop_weapon")
  983.  
  984. register_clcmd("awp","cmdawp")
  985. register_clcmd("magnum","cmdawp")
  986. register_clcmd("g3sg1","cmdauto")
  987. register_clcmd("d3au1","cmdauto")
  988. register_clcmd("sg550","cmdauto")
  989. register_clcmd("krieg550","cmdauto")
  990. register_clcmd("rebuy","check_rebuy")
  991.  
  992. pv_awplimit = register_cvar("awplimit","1")
  993. pv_autolimit = register_cvar("autolimit","1")
  994. pv_checkrebuy = register_cvar("checkrebuy","1")
  995. pv_max_awps = register_cvar("max_awps","2")
  996. pv_max_autos = register_cvar("max_autos","1")
  997. pv_minplayers = register_cvar("min_players","5")
  998. pv_winspread_awp = register_cvar("winspread_awp","3")
  999. pv_winspread_auto = register_cvar("winspread_auto","2")
  1000.  
  1001. register_event("TeamScore", "team_score", "a")
  1002. register_event("TeamInfo","team_assign","a")
  1003. register_event("WeapPickup","handle_pickup_weapon","b")
  1004. register_event("DeathMsg","handle_death","a")
  1005.  
  1006. register_event("ResetHUD","check_winning_team","be")
  1007.  
  1008. register_logevent("round_start", 2, "1=Round_Start")
  1009. register_forward(FM_Touch, "hook_touch")
  1010. gl_maxplayers = get_maxplayers()
  1011. }

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése: Rendezés 
Új téma nyitása Hozzászólás a témához  [5 hozzászólás ] 


Ki van itt

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