Votre question

Plugins Snipe.

Tags :
  • FPS
  • Jeux
Dernière réponse : dans Jeux et consoles
29 Août 2006 11:32:29

Yop.

Euh... Je recherche un plugins pour permettre d'autoriser le Snipe à seulement un par équipe.
Si vous le connaissez, veuillez m'en faire part.

Merci!

Autres pages sur : plugins snipe

29 Août 2006 11:38:42

Lol, merci bien.. Je vais m'inscrire.. au cas où.. :D 

Edit:
Bon, ben, j'demande ton Compte alors....
29 Août 2006 12:53:52

  1. #include <amxmod>
  2.  
  3. //This line needs to be uncommented if you are running CS1.6
  4. #define CSTRIKE16
  5.  
  6. #if defined CSTRIKE16
  7. #define MAXMENUPOS 19
  8. #else
  9. #define MAXMENUPOS 16
  10. #endif
  11.  
  12. //---------------------- CS 1.6 Buy Alias Menu ---------------------
  13.  
  14. /*All the CS1.6 buy aliases that purchase things that take a up a
  15. primary slot are listed here. It helps track what primary weapon
  16. clients are trying to buy for later on.*/
  17.  
  18. #if defined CSTRIKE16
  19. new g_Aliases[MAXMENUPOS][] = {
  20. "shield",//Item
  21. "m3",//Shotguns
  22. "xm1014",
  23. "mp5",//SMG
  24. "tmp",
  25. "p90",
  26. "mac10",
  27. "ump45",
  28. "ak47",//Rifles
  29. "galil",
  30. "famas",
  31. "sg552",
  32. "m4a1",
  33. "aug",
  34. "scout",
  35. "awp",
  36. "g3sg1",
  37. "sg550",
  38. "m249" //Machine Gun
  39. }
  40.  
  41. new g_Aliases2[MAXMENUPOS][] = {
  42. "shield",//Item
  43. "12gauge",//Shotguns
  44. "autoshotgun",
  45. "smg",//SMG
  46. "mp",
  47. "c90",
  48. "mac10",
  49. "ump45",
  50. "cv47",//Rifles
  51. "defender",
  52. "clarion",
  53. "krieg552",
  54. "m4a1",
  55. "bullpup",
  56. "scout",
  57. "magnum",
  58. "d3au1",
  59. "krieg550",
  60. "m249" //Machine Gun
  61. }
  62.  
  63. #endif
  64.  
  65. //---------------- End CS1.6 Specific Globals ---------------------
  66.  
  67. new g_msg[] = "Your team has enough AWPs!"
  68. new g_blockedCommand[] = "Autobuy and Rebuy is disabled!"
  69. new g_awpNum[3]
  70. new bool:g_hasAwp[33]
  71.  
  72. public plugin_init() {
  73. register_plugin("AWP Limit","1.4","out}|ast134")
  74. register_cvar("amx_maxawp","1")
  75. #if defined CSTRIKE16
  76. register_menucmd(register_menuid("BuyRifle", 1 ),1<<5,"checkAwpCT")
  77. register_menucmd(-31,1<<5,"checkAwpCT")
  78. register_menucmd(register_menuid("BuyRifle", 1 ),1<<4,"checkAwpT")
  79. register_menucmd(-31,1<<4,"checkAwpT")
  80. register_menucmd(register_menuid("BuyItem", 1 ),511,"menuItem")
  81. register_menucmd(-34,511,"menuItem")
  82. register_clcmd("cl_setautobuy","blockcommand")
  83. register_clcmd("cl_autobuy","blockcommand")
  84. register_clcmd("cl_setrebuy","blockcommand")
  85. register_clcmd("cl_rebuy","blockcommand")
  86. #else
  87. register_menucmd(register_menuid("BuyRifle", 1 ),1<<5,"checkAwp")
  88. register_menucmd(-31,1<<5,"checkAwp")
  89. #endif
  90. register_clcmd("drop","cmdDrop")
  91. register_event("WeapPickup","ePickUp","b","1=18")
  92. register_event("WeapPickup","eBuyOther","b")
  93. register_event("DeathMsg","eDeath","a")
  94. register_event("TextMsg", "eRestart", "a","2&Game_C", "2&Game_w" )
  95. register_event("RoundTime","eNewRound","bc")
  96. register_concmd("amx_awplimit","amx_awplimit",ADMIN_CVAR,"<Max Awps Per Team> - Sets # of awps allowed per team (min=0,max=16)")
  97.  
  98. /*This little bit of code turns the awp limiter off for "awp_"
  99. style maps so that the plugin does not get in the way of the
  100. gameplay on those maps.*/
  101. new cur_map[5]
  102. get_mapname(cur_map,4)
  103. if ( equali(cur_map,"awp_",4) )
  104. pause("a","awp_limiter.amx")
  105. }
  106.  
  107. //------------------- CS 1.6 Specific Functions --------------------
  108.  
  109. /*This checks to see if the awp was bought on the terrorist side in CS 1.6
  110. with the use of the menuselect scripting method of buy scripts.*/
  111.  
  112. public checkAwpT(id,menu,key) {
  113. new team = get_user_team(id)
  114. new maxAwpnum = get_cvar_num("amx_maxawp")
  115. if (team == 2)
  116. return PLUGIN_CONTINUE
  117. /* If awps are at max for player's team then close the menu and tell
  118. them they cannot have one.*/
  119. if(g_awpNum[team] >= maxAwpnum) {
  120. engclient_cmd(id,"menuselect","10")
  121. client_print(id,print_center,g_msg)
  122. return PLUGIN_HANDLED
  123. /*Allow the awp purchase if the team has less than the max allowed.
  124. And count the awp purchase against the teams total.*/
  125. } else if( g_awpNum[team] < maxAwpnum) {
  126. g_awpNum[team]++
  127. g_hasAwp[id] = true
  128. }
  129. return PLUGIN_CONTINUE
  130. }
  131.  
  132. /*This checks to see if the awp was bought on the counter-terrorist side in
  133. CS 1.6 with the use of the menuselect scripting method of buy scripts.*/
  134.  
  135. public checkAwpCT(id,menu,key) {
  136. new team = get_user_team(id)
  137. new maxAwpnum = get_cvar_num("amx_maxawp")
  138. if (team == 1)
  139. return PLUGIN_CONTINUE
  140. /* If awps are at max for player's team then close the menu and tell
  141. them they cannot have one.*/
  142. if(g_awpNum[team] >= maxAwpnum) {
  143. engclient_cmd(id,"menuselect","10")
  144. client_print(id,print_center,g_msg)
  145. return PLUGIN_HANDLED
  146. /*Allow the awp purchase if the team has less than the max allowed.
  147. And count the awp purchase against the teams total.*/
  148. } else if( g_awpNum[team] < maxAwpnum) {
  149. g_awpNum[team]++
  150. g_hasAwp[id] = true
  151. }
  152. return PLUGIN_CONTINUE
  153. }
  154.  
  155. //Helps handle shield purchase.
  156. public menuItem(id,key) return checkShield(id,6,key)
  157.  
  158. /*Checks to see if a player actually isn't carrying the awp anymore
  159. after trying to use a new 1.6 hotkey command so that the awp number
  160. is not decreased if the player used the command but did not have
  161. enough money for the other gun and thus still has the awp.*/
  162.  
  163. #if defined CSTRIKE16
  164. bool:hasAwpStill(id) {
  165. new weaps[32], num
  166. get_user_weapons(id,weaps,num)
  167. for(new i = 0; i < num; i++) {
  168. if( weaps[i] == 18) {
  169. return true
  170. }
  171. }
  172. return false
  173. }
  174. #endif
  175.  
  176. /*The function that checks weapon purchases with the new hotkey console command
  177. aliases in CS 1.6.*/
  178.  
  179. #if defined CSTRIKE16
  180. public client_command( id ) {
  181. new arg[10]
  182. read_argv(0,arg,9)
  183. for(new i=0; i<MAXMENUPOS; i++) {
  184. if (equal(arg,g_Aliases[i]) || equal(arg,g_Aliases2[i])) {
  185. /*Compares client command with list if aliases from above. If alias
  186. equals awp then only let them buy it if their team hasn't reached
  187. its max.*/
  188. if (equal(arg,"awp") || equal(arg,"magnum")) {
  189. new team = get_user_team(id)
  190. new maxAwpnum = get_cvar_num("amx_maxawp")
  191. if(g_awpNum[team] < maxAwpnum) {
  192. g_awpNum[team]++
  193. g_hasAwp[id] = true
  194. return PLUGIN_CONTINUE
  195. } else {
  196. client_print( id, print_center , g_msg )
  197. return PLUGIN_HANDLED
  198. }
  199. } else {
  200. /*If the alias is any other than AWP check whether they have
  201. one anymore.*/
  202. if (g_hasAwp[id] == true && !hasAwpStill(id)) {
  203. /*If the player bought a different gun make sure his has_awp
  204. is reset to false and 1 is subtracted from team total only if he
  205. had an awp prior to the new purchase.*/
  206. new team = get_user_team(id)
  207. g_awpNum[team]--
  208. g_hasAwp[id] = false
  209. return PLUGIN_CONTINUE
  210. }
  211. }
  212. }
  213. }
  214. return PLUGIN_CONTINUE
  215. }
  216. #endif
  217.  
  218. /*This blocks the new autobuy and rebuy functions in CS 1.6 so that
  219. players cannot use it to go around the awp restriction.*/
  220.  
  221. #if defined CSTRIKE16
  222. public blockcommand(id) {
  223. client_print(id,print_center, g_blockedCommand )
  224. return PLUGIN_HANDLED
  225. }
  226. #endif
  227.  
  228. /*Checks to see if a player buys shield. If they do then they must
  229. have dropped their awp.*/
  230.  
  231. public checkShield(id,menu,key) {
  232. if(menu == 6 && key == 8) {
  233. if(g_hasAwp[id] == true) {
  234. new team = get_user_team(id)
  235. g_awpNum[team]--
  236. g_hasAwp[id] = false
  237. return PLUGIN_CONTINUE
  238. }
  239. }
  240. return PLUGIN_CONTINUE
  241. }
  242.  
  243. //----------------- End CS 1.6 Specific Functions ------------------
  244.  
  245. /*This checks to see if the awp was bought with the use of the
  246. menuselect scripting method of buy scripts in CS 1.5.*/
  247.  
  248. public checkAwp(id,menu,key) {
  249. new team = get_user_team(id)
  250. new maxAwpnum = get_cvar_num("amx_maxawp")
  251. /* If awps are at max for player's team then close the menu and tell
  252. them they cannot have one.*/
  253. if(g_awpNum[team] >= maxAwpnum) {
  254. engclient_cmd(id,"menuselect","10")
  255. client_print(id,print_center,g_msg)
  256. return PLUGIN_HANDLED
  257. /*Allow the awp purchase if the team has less than the max allowed.
  258. And count the awp purchase against the teams total.*/
  259. } else if( g_awpNum[team] < maxAwpnum) {
  260. g_awpNum[team]++
  261. g_hasAwp[id] = true
  262. }
  263. return PLUGIN_CONTINUE
  264. }
  265.  
  266. /*Checks to make sure the user bought a different non secondary weapon.
  267. Also awp is included here because if the user has an awp and buys another
  268. one we still want to count it as having an awp.
  269. The values represent secondary or other weapons in this order...
  270. p228,hegren,c4,smoke,berettas,fiveseven,usp,glock,awp,flash,deagle,knife*/
  271.  
  272. bool:wIsPrimary(w) {
  273. if(w == 1 || w == 4 || w == 6 || w == 9 || w == 10 ||
  274. w == 11 || w == 16 || w == 17 || w == 18 || w == 25 ||
  275. w == 26 || w == 29) {
  276. return false
  277. }
  278. return true
  279. }
  280.  
  281. /*Checks to see if player bought a different primary weapon.
  282. If they did and they had an awp we have to register the drop.*/
  283.  
  284. public eBuyOther(id) {
  285. new weapon = read_data(1)
  286. if ( wIsPrimary(weapon) ) {
  287. if (g_hasAwp[id] == true) {
  288. new team = get_user_team(id)
  289. g_awpNum[team]--
  290. g_hasAwp[id] = false
  291. return PLUGIN_CONTINUE
  292. }
  293. }
  294. return PLUGIN_HANDLED
  295. }
  296.  
  297. public ePickUp(id) {
  298. new team = get_user_team( id )
  299. new maxAwpnum = get_cvar_num("amx_maxawp")
  300. if (g_hasAwp[id] == false) {
  301. //Only let player pick up an awp if their team hasn't reached its limit.
  302. if (g_awpNum[team] < maxAwpnum) {
  303. g_hasAwp[id] = true
  304. g_awpNum[team]++
  305. return PLUGIN_CONTINUE
  306. //If his team has the max allowed awps force him to throw it.
  307. } else {
  308. new param[1]
  309. param[0] = id
  310. set_task(0.5,"dropWeapon",0,param,1)
  311. client_print( id, print_center , g_msg )
  312. }
  313. }
  314. return PLUGIN_HANDLED
  315. }
  316.  
  317. //Carries out the forced throw command.
  318.  
  319. public dropWeapon( param[] ) {
  320. engclient_cmd( param[0] , "weapon_awp" )
  321. engclient_cmd( param[0] , "drop" )
  322. }
  323.  
  324. //Carries out the awp recount that takes place at round start.
  325.  
  326. public eNewRound() {
  327. if ( read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0) ) {
  328. set_task(0.3,"recountAwp")
  329. }
  330. }
  331.  
  332. /*Recounts the number of awps carried on each team at round start
  333. to maintain count accuracy that may be messed up by autoteambalance
  334. and other factors*/
  335.  
  336. public recountAwp() {
  337. new T = 0
  338. new CT = 0
  339. for(new i = 1;i < 33;i++) {
  340. if(g_hasAwp[i] == true) {
  341. new team = get_user_team(i)
  342. if(team == 1) {
  343. T++
  344. } else if(team == 2) {
  345. CT++
  346. }
  347. }
  348. }
  349. g_awpNum[1] = T
  350. g_awpNum[2] = CT
  351. return PLUGIN_CONTINUE
  352. }
  353.  
  354. /*If a player intentionally throws the awp reset his value to false
  355. and subtract 1 from his teams total.*/
  356.  
  357. public cmdDrop(id) {
  358. new a,b
  359. new team = get_user_team( id )
  360. if( g_hasAwp[id] ) {
  361. if ( get_user_weapon(id,a,b) == 18 ) {
  362. g_hasAwp[id] = false
  363. g_awpNum[team]--
  364. }
  365. }
  366. return PLUGIN_CONTINUE
  367. }
  368.  
  369. /*If a player dies while holding an awp reset his value and subtract 1
  370. from his teams total.*/
  371.  
  372. public eDeath() {
  373. client_disconnect(read_data(2))
  374. }
  375.  
  376. /*If a player disconnects while holding an awp reset his value and subtract 1
  377. from his teams total.*/
  378.  
  379. public client_disconnect(id) {
  380. new team = get_user_team(id)
  381. if ( g_hasAwp[id] ) {
  382. g_hasAwp[id] = false
  383. g_awpNum[team]--
  384. }
  385. }
  386.  
  387. /*Resets all the players to false and counts to zero if map
  388. is restarted or a new map starts.*/
  389.  
  390. public eRestart() {
  391. g_awpNum[0] = g_awpNum[1] = g_awpNum[2] = 0
  392. for(new a = 1; a < 33; ++a)
  393. g_hasAwp[a] = false
  394. }
  395.  
  396. /*Function to check a users admin access to see if they have
  397. the proper access to change the max awps allowed per team.*/
  398.  
  399. public user_check_auth(id) { //Check for proper access level.
  400. if (get_user_flags(id)&ADMIN_RCON)
  401. return 1
  402. return 0
  403. }
  404.  
  405. /*Function that allows admins to change the number of awps allowed per team
  406. on the current map, and sets it as default for the server.*/
  407.  
  408. public amx_awplimit(id) {
  409. if (!user_check_auth(id)) {
  410. client_print(id,print_console,"Access denied!")
  411. return PLUGIN_HANDLED
  412. }
  413. new String[12]
  414. read_argv(1,String,12)
  415. if (!String[0]) {
  416. client_print(id,print_console,"Current awps per team: %i",get_cvar_num("amx_maxawp"))
  417. return PLUGIN_HANDLED
  418. }
  419. new Data = str_to_num(String)
  420. if (Data > -1 && Data < 17) {
  421. set_cvar_num("amx_maxawp",Data);
  422. client_print(0,print_chat,"Maximum awps per team: %i",Data)
  423. return PLUGIN_HANDLED
  424. }
  425. else {
  426. client_print(id,print_chat,"Awps can be limited from 1 to 16 per team!")
  427. return PLUGIN_HANDLED
  428. }
  429. return PLUGIN_HANDLED
  430. }
Tom's guide dans le monde
  • Allemagne
  • Italie
  • Irlande
  • Royaume Uni
  • Etats Unis
Suivre Tom's Guide
Inscrivez-vous à la Newsletter
  • ajouter à twitter
  • ajouter à facebook
  • ajouter un flux RSS