hlmod.hu
https://hlmod.hu/

fegyver
https://hlmod.hu/viewtopic.php?f=9&t=26439
Oldal: 1 / 1

Szerző:  Pista. [ 2016.10.16. 12:16 ]
Hozzászólás témája:  fegyver

Üdv!

Hogyan lehet megoldani hogy miden fegyvernek vagy adod fegyvernek csak 1 golyó és 1 tár legyen?

Szerző:  StreetBoyHun [ 2016.10.17. 19:13 ]
Hozzászólás témája:  Re: fegyver

Például:
  1. #include <amxmodx>
  2. #include <hamsandwich>
  3. #include <fun>
  4.  
  5. #define PLUGIN "Ujj Plugin"
  6. #define VERSION "1.0"
  7. #define AUTHOR "DiploY"
  8.  
  9.  
  10. public plugin_init() {
  11.     register_plugin( PLUGIN, VERSION, AUTHOR )
  12.    
  13.     RegisterHam( Ham_Spawn, "player", "give", 1 )
  14. }
  15.  
  16. public give( id )
  17. {
  18.     give_item( id, "weapon_deagle" );
  19.     give_item( id,"ammo_50ae" );
  20. }


Ez most 7+7 Töltény Deagle-hoz

Szerző:  Pista. [ 2016.10.17. 19:14 ]
Hozzászólás témája:  Re: fegyver

értem, de nekem 1 töltény kell :D

Szerző:  voga955 [ 2016.10.17. 19:51 ]
Hozzászólás témája:  Re: fegyver

Mint fegyvermenübe:

  1. public plugin_init() {
  2.     register_plugin(PLUGIN, VERSION, AUTHOR)
  3.  
  4.     RegisterHam(Ham_Spawn, "player", "menu", 1);
  5.  
  6. }
  7. public menu(id)
  8. {
  9.     if (is_user_alive(id))
  10.     {
  11.         new menu = menu_create("\rMENÜ NEVE", "menu_handler")
  12.  
  13.         menu_additem(menu, "\yAK47", "1", 0);
  14.         menu_additem(menu, "\yM4A1", "2", 0);
  15.  
  16.         menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  17.         menu_display(id, menu, 0);
  18.     }
  19. }
  20. public menu_handler(id, menu, item)
  21. {
  22.     if( item == MENU_EXIT )
  23.     {
  24.         menu_destroy(menu);
  25.         return PLUGIN_HANDLED;
  26.     }
  27.  
  28.     new data[6], szName[64];
  29.     new access, callback;
  30.     menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
  31.  
  32.     new key = str_to_num(data);
  33.  
  34.     switch(key)
  35.     {
  36.         case 1:
  37.         {
  38.             strip_user_weapons(id)
  39.             new ak = give_item(id, "weapon_ak47")
  40.             cs_set_weapon_ammo(ak, 1)
  41.             cs_set_user_bpammo(id, CSW_AK47, 1)
  42.             give_item(id, "weapon_knife")
  43.             asd1(id)
  44.         }
  45.         case 2:
  46.         {
  47.             strip_user_weapons(id)
  48.             new m4 = give_item(id, "weapon_m4a1")
  49.             cs_set_weapon_ammo(m4, 1)
  50.             cs_set_user_bpammo(id, CSW_M4A1, 1)
  51.             give_item(id, "weapon_knife")
  52.             set_user_health(id, 1)
  53.             set_user_armor(id, 0)
  54.             asd2(id)
  55.         }
  56.  
  57.     }
  58.     menu_destroy(menu);
  59.     return PLUGIN_HANDLED;
  60. }
  61.  
  62. public asd1(id)
  63. {
  64.     new ammo = cs_get_weapon_ammo(get_pdata_cbase(id, 373))
  65.     if (is_user_alive(id))
  66.     {
  67.         if (ammo > 1)
  68.         {
  69.             cs_set_weapon_ammo(CSW_AK47, 1)
  70.             cs_set_user_bpammo(id, CSW_AK47, 1)
  71.             asd1(id)
  72.         }
  73.     }
  74. }
  75.  
  76. public asd2(id)
  77. {
  78.     new ammo = cs_get_weapon_ammo(get_pdata_cbase(id, 373))
  79.     if (is_user_alive(id))
  80.     {
  81.         if (ammo > 1)
  82.         {
  83.             cs_set_weapon_ammo(CSW_M4A1, 1)
  84.             cs_set_user_bpammo(id, CSW_M4A1, 1)
  85.             asd1(id)
  86.         }
  87.     }
  88. }

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