hlmod.hu

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



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: nincs regisztrált felhasználó 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: Hogyan kéne fegyvermenübe írni ?
HozzászólásElküldve: 2015.09.08. 19:51 
Offline
Senior Tag
Avatar

Csatlakozott: 2013.11.12. 16:39
Hozzászólások: 258
Megköszönt másnak: 87 alkalommal
Megköszönték neki: 2 alkalommal
Sziasztok. Van egy fegyvermenüm , de sajnos több sebből is vérzik . Valaki javítaná ?

1 , PROBLÉMA : Nem vesszi el a fegyvert mindenkitől . Valaki megoldaná , hogy a fegyvert elvegye és ne vegye el a bombát a te.-tól ?

2, PROBLÉMA : Nincs benne AWP KORLÁT , valaki beleírná, köszönöm

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2.  
  3. #include <amxmisc>
  4.  
  5. #include <colorchat>
  6.  
  7. #include <fun>
  8.  
  9. #include <cstrike>
  10.  
  11. #include <hamsandwich>
  12.  
  13.  
  14.  
  15. #define PLUGIN "Fegyver Menü"
  16.  
  17. #define VERSION "1.0"
  18.  
  19. #define AUTHOR "XY"
  20.  
  21.  
  22.  
  23. new gWPCT,gWPTE;
  24.  
  25. new g_showsec[33];
  26.  
  27. new bool:already[33];
  28.  
  29.  
  30.  
  31. public plugin_init() {
  32.  
  33. register_plugin(PLUGIN, VERSION, AUTHOR)
  34.  
  35. RegisterHam(Ham_Spawn, "player", "playerspawn", 1)
  36.  
  37. register_logevent("logevent_end", 2, "1=Round_End");
  38.  
  39. register_logevent("logevent_end", 2, "1&Restart_Round");
  40.  
  41. register_logevent("logevent_end", 2, "1=Game_Commencing");
  42.  
  43. }
  44.  
  45.  
  46.  
  47. public logevent_end()
  48.  
  49. {
  50.  
  51. gWPCT = 0;
  52.  
  53. gWPTE = 0;
  54.  
  55.  
  56.  
  57. new players[32], pnum
  58.  
  59. get_players(players, pnum)
  60.  
  61. for(new i=0; i<pnum; i++)
  62.  
  63. {
  64.  
  65. already[i] = false;
  66.  
  67. }
  68.  
  69. }
  70.  
  71.  
  72.  
  73. public playerspawn(id)
  74.  
  75. {
  76.  
  77. g_showsec[id] = 15;
  78.  
  79. already[id] = false;
  80.  
  81. fegyvermenu(id);
  82.  
  83. }
  84.  
  85.  
  86.  
  87. public fegyvermenu(id)
  88.  
  89. {
  90.  
  91. if(!is_user_alive(id)) return PLUGIN_HANDLED;
  92.  
  93.  
  94.  
  95. cs_set_user_money(id, 999999999); // Penz nullazasa
  96.  
  97. new string[200];
  98.  
  99.  
  100.  
  101. if(g_showsec[id] <= 15)
  102.  
  103. {
  104.  
  105. if(g_showsec[id] != 0)
  106.  
  107. {
  108.  
  109. if(already[id]) return PLUGIN_HANDLED;
  110.  
  111. set_task(1.0, "fegyvermenu",id);
  112.  
  113. g_showsec[id]--;
  114.  
  115. }
  116.  
  117. else
  118.  
  119. {
  120.  
  121. show_menu(id, 0, "^n", 1);
  122.  
  123. return PLUGIN_HANDLED;
  124.  
  125. }
  126.  
  127. }
  128.  
  129.  
  130.  
  131. if(user_has_weapon(id, CSW_C4))
  132.  
  133. {
  134.  
  135.  
  136.  
  137. strip_user_weapons(id);
  138.  
  139.  
  140.  
  141. format(string, charsmax(string), "\d\rSzervered neve \yOnly \yDust2\d^n\wFegyver Csomagok\y[\d%d \wMP\y]\w:", g_showsec[id]);
  142.  
  143. new menu = menu_create(string, "handler")
  144.  
  145. menu_additem(menu, "\rM4A1 Colt \yCsomag", "1", 0);
  146.  
  147. menu_additem(menu, "\rAK47 Klasnikov \yCsomag", "2", 0);
  148.  
  149. menu_additem(menu, "\rAWP Magnum Sniper \yCsomag", "3", 0);
  150.  
  151. menu_additem(menu, "\rMachineGun \yCsomag", "4", 0);
  152.  
  153. menu_additem(menu, "\rAUG \yCsomag", "5", 0);
  154.  
  155. menu_additem(menu, "\rFAMAS \yCsomag", "6", 0);
  156.  
  157. menu_additem(menu, "\rSG552 \yCsomag", "7", 0);
  158.  
  159. menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  160.  
  161.  
  162.  
  163. menu_display(id, menu);
  164.  
  165. }
  166.  
  167. else
  168.  
  169. {
  170.  
  171. format(string, charsmax(string), "\d\rSzervered neve \yOnly \yDust2\d^n\wFegyver Csomagok\y[\d%d \wMP\y]\w:", g_showsec[id]);
  172.  
  173. new menu = menu_create(string, "handler")
  174.  
  175. menu_additem(menu, "\rM4A1 Colt \yCsomag", "1", 0);
  176.  
  177. menu_additem(menu, "\rAK47 Klasnikov \yCsomag", "2", 0);
  178.  
  179. menu_additem(menu, "\rAWP Magnum Sniper \yCsomag", "3", 0);
  180.  
  181. menu_additem(menu, "\rMachineGun \yCsomag", "4", 0);
  182.  
  183. menu_additem(menu, "\rAUG \yCsomag", "5", 0);
  184.  
  185. menu_additem(menu, "\rFAMAS \yCsomag", "6", 0);
  186.  
  187. menu_additem(menu, "\rSG552 \yCsomag", "7", 0);
  188.  
  189. menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  190.  
  191. menu_display(id, menu);
  192.  
  193. }
  194.  
  195.  
  196.  
  197. return PLUGIN_HANDLED;
  198.  
  199. }
  200.  
  201.  
  202.  
  203. public handler(id, menu, item)
  204.  
  205. {
  206.  
  207. if( item == MENU_EXIT )
  208.  
  209. {
  210.  
  211. menu_destroy(menu);
  212.  
  213. return PLUGIN_HANDLED;
  214.  
  215. }
  216.  
  217. already[id] = true;
  218.  
  219. new data[6], szName[64];
  220.  
  221. new access, callback;
  222.  
  223. menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
  224.  
  225. new key = str_to_num(data);
  226.  
  227. switch(key)
  228.  
  229. {
  230.  
  231.  
  232.  
  233. case 1:
  234.  
  235. {
  236.  
  237.  
  238.  
  239. give_player_grenades(id);
  240.  
  241. give_item(id, "weapon_knife");
  242.  
  243. give_item(id, "weapon_deagle");
  244.  
  245. give_item(id, "ammo_50ae");
  246.  
  247. give_item(id, "ammo_50ae");
  248.  
  249. give_item(id, "ammo_50ae");
  250.  
  251. give_item(id, "weapon_m4a1");
  252.  
  253. give_item(id, "ammo_556nato");
  254.  
  255. give_item(id, "ammo_556nato");
  256.  
  257. give_item(id, "ammo_556nato");
  258.  
  259. }
  260.  
  261. case 2:
  262.  
  263. {
  264.  
  265.  
  266.  
  267. give_player_grenades(id);
  268.  
  269. give_item(id, "weapon_knife");
  270.  
  271. give_item(id, "weapon_deagle");
  272.  
  273. give_item(id, "ammo_50ae");
  274.  
  275. give_item(id, "ammo_50ae");
  276.  
  277. give_item(id, "ammo_50ae");
  278.  
  279. give_item(id, "weapon_ak47");
  280.  
  281. give_item(id, "ammo_762nato");
  282.  
  283. give_item(id, "ammo_762nato");
  284.  
  285. give_item(id, "ammo_762nato");
  286.  
  287.  
  288.  
  289. }
  290.  
  291. case 3:
  292.  
  293. {
  294.  
  295. new CsTeams:userTeam = cs_get_user_team(id);
  296.  
  297. if(userTeam == CS_TEAM_CT)
  298.  
  299. {
  300.  
  301. if(gWPCT < 2)
  302.  
  303. {
  304.  
  305.  
  306.  
  307. give_player_grenades(id);
  308.  
  309. give_item(id, "weapon_knife");
  310.  
  311. give_item(id, "weapon_awp");
  312.  
  313. give_item(id, "weapon_deagle");
  314.  
  315. give_item(id, "ammo_50ae");
  316.  
  317. give_item(id, "ammo_50ae");
  318.  
  319. give_item(id, "ammo_50ae");
  320.  
  321. give_item(id, "ammo_338magnum");
  322.  
  323. give_item(id, "ammo_338magnum");
  324.  
  325. give_item(id, "ammo_338magnum");
  326.  
  327.  
  328.  
  329. gWPCT++
  330.  
  331. }
  332.  
  333. else
  334.  
  335. {
  336.  
  337.  
  338.  
  339. fegyvermenu(id);
  340.  
  341. }
  342.  
  343. }
  344.  
  345. if(userTeam == CS_TEAM_T)
  346.  
  347. {
  348.  
  349. if(gWPTE < 2)
  350.  
  351. {
  352.  
  353.  
  354.  
  355. give_player_grenades(id);
  356.  
  357. give_item(id, "weapon_knife");
  358.  
  359. give_item(id, "weapon_awp");
  360.  
  361. give_item(id, "weapon_deagle");
  362.  
  363. give_item(id, "ammo_50ae");
  364.  
  365. give_item(id, "ammo_50ae");
  366.  
  367. give_item(id, "ammo_50ae");
  368.  
  369. give_item(id, "ammo_338magnum");
  370.  
  371. give_item(id, "ammo_338magnum");
  372.  
  373. give_item(id, "ammo_338magnum");
  374.  
  375.  
  376.  
  377. gWPTE++
  378.  
  379. }
  380.  
  381. else
  382.  
  383. {
  384.  
  385.  
  386.  
  387. fegyvermenu(id);
  388.  
  389. }
  390.  
  391. }
  392.  
  393.  
  394.  
  395. }
  396.  
  397. case 4:
  398.  
  399. {
  400.  
  401.  
  402.  
  403. give_player_grenades(id);
  404.  
  405. give_item(id, "weapon_knife");
  406.  
  407. give_item(id, "weapon_deagle");
  408.  
  409. give_item(id, "ammo_50ae");
  410.  
  411. give_item(id, "ammo_50ae");
  412.  
  413. give_item(id, "ammo_50ae");
  414.  
  415. give_item(id, "weapon_m249");
  416.  
  417. give_item(id, "ammo_556natobox");
  418.  
  419. give_item(id, "ammo_556natobox");
  420.  
  421. give_item(id, "ammo_556natobox");
  422.  
  423.  
  424.  
  425. }
  426.  
  427. case 5:
  428.  
  429. {
  430.  
  431.  
  432.  
  433. give_player_grenades(id);
  434.  
  435. give_item(id, "weapon_knife");
  436.  
  437. give_item(id, "weapon_deagle");
  438.  
  439. give_item(id, "ammo_50ae");
  440.  
  441. give_item(id, "ammo_50ae");
  442.  
  443. give_item(id, "ammo_50ae")
  444.  
  445. give_item(id, "weapon_aug");
  446.  
  447. give_item(id, "ammo_556nato");
  448.  
  449. give_item(id, "ammo_556nato");
  450.  
  451. give_item(id, "ammo_556nato");
  452.  
  453.  
  454.  
  455. }
  456.  
  457. case 6:
  458.  
  459. {
  460.  
  461.  
  462.  
  463. give_player_grenades(id);
  464.  
  465. give_item(id, "weapon_knife");
  466.  
  467. give_item(id, "weapon_deagle");
  468.  
  469. give_item(id, "ammo_50ae");
  470.  
  471. give_item(id, "ammo_50ae");
  472.  
  473. give_item(id, "ammo_50ae")
  474.  
  475. give_item(id, "weapon_famas");
  476.  
  477. give_item(id, "ammo_556nato");
  478.  
  479. give_item(id, "ammo_556nato");
  480.  
  481. give_item(id, "ammo_556nato");
  482.  
  483.  
  484.  
  485. }
  486.  
  487. case 7:
  488.  
  489. {
  490.  
  491.  
  492.  
  493. give_player_grenades(id);
  494.  
  495. give_item(id, "weapon_knife");
  496.  
  497. give_item(id, "weapon_deagle");
  498.  
  499. give_item(id, "ammo_50ae");
  500.  
  501. give_item(id, "ammo_50ae");
  502.  
  503. give_item(id, "ammo_50ae")
  504.  
  505. give_item(id, "weapon_sg552");
  506.  
  507. give_item(id, "ammo_556nato");
  508.  
  509. give_item(id, "ammo_556nato");
  510.  
  511. give_item(id, "ammo_556nato");
  512.  
  513.  
  514.  
  515. }
  516.  
  517. }
  518.  
  519. return PLUGIN_HANDLED;
  520.  
  521. }
  522.  
  523.  
  524.  
  525. stock give_player_grenades(index)
  526.  
  527. {
  528.  
  529. give_item(index, "weapon_hegrenade");
  530.  
  531. give_item(index, "weapon_flashbang");
  532.  
  533. give_item(index, "weapon_flashbang");
  534.  
  535. give_item(index, "item_thighpack");
  536.  
  537. give_item(index, "item_assaultsuit");
  538.  
  539. }
  540.  
  541.  

_________________
Nem szégyen megköszönni :)

'The dictator is coming' :D


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Hogyan kéne fegyvermenübe írni ?
HozzászólásElküldve: 2015.09.09. 17:01 
Offline
Senior Tag
Avatar

Csatlakozott: 2013.03.10. 11:42
Hozzászólások: 240
Megköszönt másnak: 52 alkalommal
Megköszönték neki: 9 alkalommal
Üdv!
Most már mindenkitől elfogja venni a fegyvereket.

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2.  
  3. #include <amxmisc>
  4.  
  5. #include <colorchat>
  6.  
  7. #include <fun>
  8.  
  9. #include <cstrike>
  10.  
  11. #include <hamsandwich>
  12.  
  13.  
  14.  
  15. #define PLUGIN "Fegyver Menü"
  16.  
  17. #define VERSION "1.0"
  18.  
  19. #define AUTHOR "XY"
  20.  
  21.  
  22.  
  23. new gWPCT,gWPTE;
  24.  
  25. new g_showsec[33];
  26.  
  27. new bool:already[33];
  28.  
  29.  
  30.  
  31. public plugin_init() {
  32.  
  33. register_plugin(PLUGIN, VERSION, AUTHOR)
  34.  
  35. RegisterHam(Ham_Spawn, "player", "playerspawn", 1)
  36.  
  37. register_logevent("logevent_end", 2, "1=Round_End");
  38.  
  39. register_logevent("logevent_end", 2, "1&Restart_Round");
  40.  
  41. register_logevent("logevent_end", 2, "1=Game_Commencing");
  42.  
  43. }
  44.  
  45.  
  46.  
  47. public logevent_end()
  48.  
  49. {
  50.  
  51. gWPCT = 0;
  52.  
  53. gWPTE = 0;
  54.  
  55.  
  56.  
  57. new players[32], pnum
  58.  
  59. get_players(players, pnum)
  60.  
  61. for(new i=0; i<pnum; i++)
  62.  
  63. {
  64.  
  65. already[i] = false;
  66.  
  67. }
  68.  
  69. }
  70.  
  71.  
  72.  
  73. public playerspawn(id)
  74.  
  75. {
  76.  
  77. g_showsec[id] = 15;
  78.  
  79. already[id] = false;
  80.  
  81. fegyvermenu(id);
  82.  
  83. }
  84.  
  85.  
  86.  
  87. public fegyvermenu(id)
  88.  
  89. {
  90. strip_user_weapons(id);
  91.  
  92. if(!is_user_alive(id)) return PLUGIN_HANDLED;
  93.  
  94.  
  95.  
  96. cs_set_user_money(id, 999999999); // Penz nullazasa
  97.  
  98. new string[200];
  99.  
  100.  
  101.  
  102. if(g_showsec[id] <= 15)
  103.  
  104. {
  105.  
  106. if(g_showsec[id] != 0)
  107.  
  108. {
  109.  
  110. if(already[id]) return PLUGIN_HANDLED;
  111.  
  112. set_task(1.0, "fegyvermenu",id);
  113.  
  114. g_showsec[id]--;
  115.  
  116. }
  117.  
  118. else
  119.  
  120. {
  121.  
  122. show_menu(id, 0, "^n", 1);
  123.  
  124. return PLUGIN_HANDLED;
  125.  
  126. }
  127.  
  128. }
  129.  
  130.  
  131.  
  132. if(user_has_weapon(id, CSW_C4))
  133.  
  134. {
  135.  
  136.  
  137.  
  138. format(string, charsmax(string), "\d\rSzervered neve \yOnly \yDust2\d^n\wFegyver Csomagok\y[\d%d \wMP\y]\w:", g_showsec[id]);
  139.  
  140. new menu = menu_create(string, "handler")
  141.  
  142. menu_additem(menu, "\rM4A1 Colt \yCsomag", "1", 0);
  143.  
  144. menu_additem(menu, "\rAK47 Klasnikov \yCsomag", "2", 0);
  145.  
  146. menu_additem(menu, "\rAWP Magnum Sniper \yCsomag", "3", 0);
  147.  
  148. menu_additem(menu, "\rMachineGun \yCsomag", "4", 0);
  149.  
  150. menu_additem(menu, "\rAUG \yCsomag", "5", 0);
  151.  
  152. menu_additem(menu, "\rFAMAS \yCsomag", "6", 0);
  153.  
  154. menu_additem(menu, "\rSG552 \yCsomag", "7", 0);
  155.  
  156. menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  157.  
  158.  
  159.  
  160. menu_display(id, menu);
  161.  
  162. }
  163.  
  164. else
  165.  
  166. {
  167.  
  168. format(string, charsmax(string), "\d\rSzervered neve \yOnly \yDust2\d^n\wFegyver Csomagok\y[\d%d \wMP\y]\w:", g_showsec[id]);
  169.  
  170. new menu = menu_create(string, "handler")
  171.  
  172. menu_additem(menu, "\rM4A1 Colt \yCsomag", "1", 0);
  173.  
  174. menu_additem(menu, "\rAK47 Klasnikov \yCsomag", "2", 0);
  175.  
  176. menu_additem(menu, "\rAWP Magnum Sniper \yCsomag", "3", 0);
  177.  
  178. menu_additem(menu, "\rMachineGun \yCsomag", "4", 0);
  179.  
  180. menu_additem(menu, "\rAUG \yCsomag", "5", 0);
  181.  
  182. menu_additem(menu, "\rFAMAS \yCsomag", "6", 0);
  183.  
  184. menu_additem(menu, "\rSG552 \yCsomag", "7", 0);
  185.  
  186. menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  187.  
  188. menu_display(id, menu);
  189.  
  190. }
  191.  
  192.  
  193.  
  194. return PLUGIN_HANDLED;
  195.  
  196. }
  197.  
  198.  
  199.  
  200. public handler(id, menu, item)
  201.  
  202. {
  203.  
  204. if( item == MENU_EXIT )
  205.  
  206. {
  207.  
  208. menu_destroy(menu);
  209.  
  210. return PLUGIN_HANDLED;
  211.  
  212. }
  213.  
  214. already[id] = true;
  215.  
  216. new data[6], szName[64];
  217.  
  218. new access, callback;
  219.  
  220. menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
  221.  
  222. new key = str_to_num(data);
  223.  
  224. switch(key)
  225.  
  226. {
  227.  
  228.  
  229.  
  230. case 1:
  231.  
  232. {
  233.  
  234.  
  235.  
  236. give_player_grenades(id);
  237.  
  238. give_item(id, "weapon_knife");
  239.  
  240. give_item(id, "weapon_deagle");
  241.  
  242. give_item(id, "ammo_50ae");
  243.  
  244. give_item(id, "ammo_50ae");
  245.  
  246. give_item(id, "ammo_50ae");
  247.  
  248. give_item(id, "weapon_m4a1");
  249.  
  250. give_item(id, "ammo_556nato");
  251.  
  252. give_item(id, "ammo_556nato");
  253.  
  254. give_item(id, "ammo_556nato");
  255.  
  256. }
  257.  
  258. case 2:
  259.  
  260. {
  261.  
  262.  
  263.  
  264. give_player_grenades(id);
  265.  
  266. give_item(id, "weapon_knife");
  267.  
  268. give_item(id, "weapon_deagle");
  269.  
  270. give_item(id, "ammo_50ae");
  271.  
  272. give_item(id, "ammo_50ae");
  273.  
  274. give_item(id, "ammo_50ae");
  275.  
  276. give_item(id, "weapon_ak47");
  277.  
  278. give_item(id, "ammo_762nato");
  279.  
  280. give_item(id, "ammo_762nato");
  281.  
  282. give_item(id, "ammo_762nato");
  283.  
  284.  
  285.  
  286. }
  287.  
  288. case 3:
  289.  
  290. {
  291.  
  292. new CsTeams:userTeam = cs_get_user_team(id);
  293.  
  294. if(userTeam == CS_TEAM_CT)
  295.  
  296. {
  297.  
  298. if(gWPCT < 2)
  299.  
  300. {
  301.  
  302.  
  303.  
  304. give_player_grenades(id);
  305.  
  306. give_item(id, "weapon_knife");
  307.  
  308. give_item(id, "weapon_awp");
  309.  
  310. give_item(id, "weapon_deagle");
  311.  
  312. give_item(id, "ammo_50ae");
  313.  
  314. give_item(id, "ammo_50ae");
  315.  
  316. give_item(id, "ammo_50ae");
  317.  
  318. give_item(id, "ammo_338magnum");
  319.  
  320. give_item(id, "ammo_338magnum");
  321.  
  322. give_item(id, "ammo_338magnum");
  323.  
  324.  
  325.  
  326. gWPCT++
  327.  
  328. }
  329.  
  330. else
  331.  
  332. {
  333.  
  334.  
  335.  
  336. fegyvermenu(id);
  337.  
  338. }
  339.  
  340. }
  341.  
  342. if(userTeam == CS_TEAM_T)
  343.  
  344. {
  345.  
  346. if(gWPTE < 2)
  347.  
  348. {
  349.  
  350.  
  351.  
  352. give_player_grenades(id);
  353.  
  354. give_item(id, "weapon_knife");
  355.  
  356. give_item(id, "weapon_awp");
  357.  
  358. give_item(id, "weapon_deagle");
  359.  
  360. give_item(id, "ammo_50ae");
  361.  
  362. give_item(id, "ammo_50ae");
  363.  
  364. give_item(id, "ammo_50ae");
  365.  
  366. give_item(id, "ammo_338magnum");
  367.  
  368. give_item(id, "ammo_338magnum");
  369.  
  370. give_item(id, "ammo_338magnum");
  371.  
  372.  
  373.  
  374. gWPTE++
  375.  
  376. }
  377.  
  378. else
  379.  
  380. {
  381.  
  382.  
  383.  
  384. fegyvermenu(id);
  385.  
  386. }
  387.  
  388. }
  389.  
  390.  
  391.  
  392. }
  393.  
  394. case 4:
  395.  
  396. {
  397.  
  398.  
  399.  
  400. give_player_grenades(id);
  401.  
  402. give_item(id, "weapon_knife");
  403.  
  404. give_item(id, "weapon_deagle");
  405.  
  406. give_item(id, "ammo_50ae");
  407.  
  408. give_item(id, "ammo_50ae");
  409.  
  410. give_item(id, "ammo_50ae");
  411.  
  412. give_item(id, "weapon_m249");
  413.  
  414. give_item(id, "ammo_556natobox");
  415.  
  416. give_item(id, "ammo_556natobox");
  417.  
  418. give_item(id, "ammo_556natobox");
  419.  
  420.  
  421.  
  422. }
  423.  
  424. case 5:
  425.  
  426. {
  427.  
  428.  
  429.  
  430. give_player_grenades(id);
  431.  
  432. give_item(id, "weapon_knife");
  433.  
  434. give_item(id, "weapon_deagle");
  435.  
  436. give_item(id, "ammo_50ae");
  437.  
  438. give_item(id, "ammo_50ae");
  439.  
  440. give_item(id, "ammo_50ae")
  441.  
  442. give_item(id, "weapon_aug");
  443.  
  444. give_item(id, "ammo_556nato");
  445.  
  446. give_item(id, "ammo_556nato");
  447.  
  448. give_item(id, "ammo_556nato");
  449.  
  450.  
  451.  
  452. }
  453.  
  454. case 6:
  455.  
  456. {
  457.  
  458.  
  459.  
  460. give_player_grenades(id);
  461.  
  462. give_item(id, "weapon_knife");
  463.  
  464. give_item(id, "weapon_deagle");
  465.  
  466. give_item(id, "ammo_50ae");
  467.  
  468. give_item(id, "ammo_50ae");
  469.  
  470. give_item(id, "ammo_50ae")
  471.  
  472. give_item(id, "weapon_famas");
  473.  
  474. give_item(id, "ammo_556nato");
  475.  
  476. give_item(id, "ammo_556nato");
  477.  
  478. give_item(id, "ammo_556nato");
  479.  
  480.  
  481.  
  482. }
  483.  
  484. case 7:
  485.  
  486. {
  487.  
  488.  
  489.  
  490. give_player_grenades(id);
  491.  
  492. give_item(id, "weapon_knife");
  493.  
  494. give_item(id, "weapon_deagle");
  495.  
  496. give_item(id, "ammo_50ae");
  497.  
  498. give_item(id, "ammo_50ae");
  499.  
  500. give_item(id, "ammo_50ae")
  501.  
  502. give_item(id, "weapon_sg552");
  503.  
  504. give_item(id, "ammo_556nato");
  505.  
  506. give_item(id, "ammo_556nato");
  507.  
  508. give_item(id, "ammo_556nato");
  509.  
  510.  
  511.  
  512. }
  513.  
  514. }
  515.  
  516. return PLUGIN_HANDLED;
  517.  
  518. }
  519.  
  520.  
  521.  
  522. stock give_player_grenades(index)
  523.  
  524. {
  525.  
  526. give_item(index, "weapon_hegrenade");
  527.  
  528. give_item(index, "weapon_flashbang");
  529.  
  530. give_item(index, "weapon_flashbang");
  531.  
  532. give_item(index, "item_thighpack");
  533.  
  534. give_item(index, "item_assaultsuit");
  535.  
  536. }


AWP korlát:
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,"..::!!AWP csak 4V4 tol!!::...", 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,"..::!!AWP csak 4V4 tol!!::...", 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,"..::!!AWP csak 4V4 tol!!::...", 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,"..::!!AWP csak 4V4 tol!!::...", 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,"..::!!AWP csak 4V4 tol!!::...", 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,"..::!!AWP csak 4V4 tol!!::...", 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,"..::!!AWP csak 4V4 tol!!::....", 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,"..::!!AWP csak 4V4 tol!!::....", 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,"..::!!AWP csak 4V4 tol!!::...", 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,"..::!!AWP csak 4V4 tol!!::...", 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,"..::!!AWP csak 4V4 tol!!::...", 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","4")
  996. pv_max_autos = register_cvar("max_autos","4")
  997. pv_minplayers = register_cvar("min_players","3")
  998. pv_winspread_awp = register_cvar("winspread_awp","0")
  999. pv_winspread_auto = register_cvar("winspread_auto","0")
  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. }
  1012.  

_________________
NEW IP:
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Hogyan kéne fegyvermenübe írni ?
HozzászólásElküldve: 2015.09.09. 18:36 
Offline
Senior Tag
Avatar

Csatlakozott: 2013.11.12. 16:39
Hozzászólások: 258
Megköszönt másnak: 87 alkalommal
Megköszönték neki: 2 alkalommal
a fegyvermenü nem jó . A fegyvert kiválasztom és elveszi

_________________
Nem szégyen megköszönni :)

'The dictator is coming' :D


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Hogyan kéne fegyvermenübe írni ?
HozzászólásElküldve: 2015.09.10. 06:23 
Offline
Senior Tag

Csatlakozott: 2015.08.03. 18:09
Hozzászólások: 216
Megköszönt másnak: 6 alkalommal
Megköszönték neki: 11 alkalommal
1.
Szerintem nem a fegyvermenübe kellene beleírni a
SMA Forráskód: [ Mindet kijelol ]
  1. strip_usep_weapons(id)
-t, hanem egy
SMA Forráskód: [ Mindet kijelol ]
  1. public ujraeledes(id)
-be
NEM?
Amihez szükségünk van egy init részhez.
Ha géphez üllök ma kijavítom :-)

_________________
.:[D@nGeR]:. [1] Only Dust2:
Kép

.:[D@nGeR]:. [2] Sniper:
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Hogyan kéne fegyvermenübe írni ?
HozzászólásElküldve: 2015.09.10. 20:31 
Offline
Senior Tag
Avatar

Csatlakozott: 2013.11.12. 16:39
Hozzászólások: 258
Megköszönt másnak: 87 alkalommal
Megköszönték neki: 2 alkalommal
nagyon megköszönném.

_________________
Nem szégyen megköszönni :)

'The dictator is coming' :D


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 77 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