hlmod.hu
https://hlmod.hu/

Fegyver tiltó.
https://hlmod.hu/viewtopic.php?f=29&t=6866
Oldal: 1 / 1

Szerző:  crazy` [ 2012.12.19. 18:44 ]
Hozzászólás témája:  Fegyver tiltó.

Üdv! Egy olyan pluginra lenne szükségem ami annyit tesz,hogyha felveszel 1 magozót (T,CT) akkor azt dobja el!
És ez így legyen az awp-vel is, ha nincs meg mind a két csapatban az 5-5 ember.
Előre is köszi az elkészítőnek.

Szerző:  fuck604 [ 2012.12.19. 21:21 ]
Hozzászólás témája:  Re: Fegyver tiltó.

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2.  
  3. #define WEAPONS ((1<<CSW_SG550) | (1<<CSW_AWP) | (1<<CSW_G3SG1))
  4.  
  5. #define MAXAWP 5
  6.  
  7.  
  8. public plugin_init()
  9. {
  10. register_plugin("New Plugin", "Petrik", "1.0")
  11. register_event("CurWeapon", "CurWeapon", "be", "1=1")
  12. }
  13.  
  14. public CurWeapon(id)
  15. {
  16. if(!user_has_weapon(id, CSW_AWP) || !user_has_weapon(id, CSW_SG550) || !user_has_weapon(id, CSW_G3SG1))
  17. return PLUGIN_CONTINUE
  18.  
  19. if(user_has_weapon(id, CSW_SG550) || user_has_weapon(id, CSW_G3SG1)){
  20. drop_prim(id)
  21. return PLUGIN_CONTINUE
  22. }
  23.  
  24. new awpCT = 0
  25. new awpTE = 0
  26. new team = get_user_team(id)
  27.  
  28. for(new i = 1 ; i < get_maxplayers() ; i++)
  29. if(is_user_connected(i))
  30. if(get_user_team(i) == 1)
  31. awpTE++
  32. else
  33. awpCT++
  34. if(team == 2){
  35. if(awpCT >= MAXAWP)
  36. drop_prim(id)
  37. }
  38. else{
  39. if(awpTE >= MAXAWP)
  40. drop_prim(id)
  41. }
  42.  
  43. return PLUGIN_CONTINUE
  44. }
  45.  
  46. public drop_prim(id) {
  47. new weapons[32], num
  48. get_user_weapons(id, weapons, num)
  49. for (new i = 0; i < num; i++) {
  50. if (WEAPONS & (1<<weapons[i])) {
  51. static weaponname[32]
  52. get_weaponname(weapons[i], weaponname, sizeof weaponname - 1)
  53. engclient_cmd(id, "drop", weaponname)
  54. }
  55. }
  56. }

Szerző:  crazy` [ 2012.12.20. 18:51 ]
Hozzászólás témája:  Re: Fegyver tiltó.

nem nagyon akaródzik menni :D

Szerző:  Chaos Killer [ 2012.12.20. 18:57 ]
Hozzászólás témája:  Re: Fegyver tiltó.

Talán emiatt?
SMA Forráskód: [ Mindet kijelol ]
  1. if(get_user_team(i) == 1)
  2. awpTE++
  3. else


lehet hogy specben van :D

Szerző:  fuck604 [ 2012.12.20. 20:33 ]
Hozzászólás témája:  Re: Fegyver tiltó.

remélem ez müködik
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2.  
  3. #define WEAPONS ((1<<CSW_SG550) | (1<<CSW_AWP) | (1<<CSW_G3SG1))
  4.  
  5. #define MAXAWP 5
  6.  
  7.  
  8. public plugin_init()
  9. {
  10. register_plugin("New Plugin", "Petrik", "1.0")
  11. register_event("CurWeapon", "CurWeapon", "be", "1=1")
  12. }
  13.  
  14.  
  15. public client_command(id)
  16. {
  17.  
  18. new Command[ 10 ];
  19. read_argv( 0, Command, 9 );
  20.  
  21. if(equali( Command, "buy" ) || equali( Command, "awp" ) || equali( Command, "G3SG1" ) || equali( Command, "SG550" ))
  22. {
  23. set_task(0.1, "CurWeapon", id)
  24. }
  25. }
  26.  
  27. public CurWeapon(id)
  28. {
  29. if(user_has_weapon(id, CSW_SG550) || user_has_weapon(id, CSW_G3SG1)){
  30. drop_prim(id)
  31. return PLUGIN_CONTINUE
  32. }
  33. else if(!user_has_weapon(id, CSW_AWP))
  34. return PLUGIN_CONTINUE
  35.  
  36. new awp = 0
  37. new team = get_user_team(id)
  38.  
  39. for(new i = 1 ; i < get_maxplayers() ; i++)
  40. if(is_user_connected(i))
  41. if(get_user_team(i) == team && user_has_weapon(i, CSW_AWP ))
  42. awp++
  43. if(awp >= MAXAWP)
  44. drop_prim(id)
  45.  
  46. return PLUGIN_CONTINUE
  47. }
  48.  
  49. public drop_prim(id) {
  50. new weapons[32], num
  51. get_user_weapons(id, weapons, num)
  52. for (new i = 0; i < num; i++) {
  53. if (WEAPONS & (1<<weapons[i])) {
  54. static weaponname[32]
  55. get_weaponname(weapons[i], weaponname, sizeof weaponname - 1)
  56. engclient_cmd(id, "drop", weaponname)
  57. }
  58. }
  59. }

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/