Plugins Snipe.

Forum FPS / Action / Quake-Like : Plugins Snipe.

TomsGuide.com : 800 000 inscrits répondent à toutes vos questions high-tech et informatique. Pour obtenir de l'aide, inscrivez-vous gratuitement !
Mot :    Pseudo :           
 

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!

------------------------------ C'est notre propre lumière et non notre noirceur qui nous effraie le plus.
Nous déprécier ne servira jamais le monde, et ce n'est pas une attitude éclairée de se faire plus petit que l'on est en espérant rassurer les gens qui nous entoure.
Liens sponsorisés
Inscrivez-vous ou connectez-vous pour masquer ceci.

http://www.cs-amx.com/telecharger-awp-limit-378.htm
Je pense qu'en le modifiant un peu (tu peut trouver un tuto sur le site) tu peut le limiter à 1 par équipe !

Ps: Si ta pas envie de t'inscrire pour DL le truc demande moi par MP je n'utilise pas mon compte ^^

Répondre à Moi123@IDN

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

Edit:
Bon, ben, j'demande ton Compte alors....


Message édité par TybboT le 29-08-2006 à 11:40:00
------------------------------ C'est notre propre lumière et non notre noirceur qui nous effraie le plus.
Nous déprécier ne servira jamais le monde, et ce n'est pas une attitude éclairée de se faire plus petit que l'on est en espérant rassurer les gens qui nous entoure.
Répondre à TybboT

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

Répondre à connorr
Tom's Guide > Forum > FPS / Action / Quake-Like > Plugins Snipe.
Aller à :

Il y a 1319 utilisateurs connus et inconnus. Pour voir la liste des connectés connus, cliquez ici.

Attention

Vous allez répondre sur un sujet resté inactif pendant plus de 6 mois.
Assurez-vous d'apporter des éléments nouveaux à la discussion avant de poursuivre.

Répondre Annuler
Liens