hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.06.15. 21:20



Jelenlévő felhasználók

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

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot]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  [2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Mi a hiba?
HozzászólásElküldve:2013.03.26. 20:12 
Offline
Félisten

Csatlakozott:2012.06.19. 15:12
Hozzászólások:926
Megköszönt másnak: 109 alkalommal
Megköszönték neki: 31 alkalommal
Átalakitásnál ezt irja
5151f2ce0ebe1.sma(46) : error 035: argument type mismatch (argument 1)
5151f2ce0ebe1.sma(114) : warning 203: symbol is never used: "g_item_name"

1 Error.
Could not locate output file 5151f2ce0ebe1.amx (compile failed).

SMA Forráskód: [ Mindet kijelol ]
  1. /*================================================================================
  2.  
  3. -------------------------------------------
  4. -*- [ZP] Extra Item: Unlimited Clip 1.0 -*-
  5. -------------------------------------------
  6.  
  7. ~~~~~~~~~~~~~~~
  8. - Description -
  9. ~~~~~~~~~~~~~~~
  10.  
  11. This item/upgrade gives players unlimited clip ammo for a single round.
  12.  
  13. ================================================================================*/
  14.  
  15. #include <amxmodx>
  16. #include <fakemeta>
  17. #include <zombieplague>
  18.  
  19. /*================================================================================
  20.  [Plugin Customization]
  21. =================================================================================*/
  22.  
  23. new const g_item_name = { "Orok tolteny (Egy kor)" }
  24. const g_item_cost = 50
  25.  
  26. /*============================================================================*/
  27.  
  28. // CS Offsets
  29. #if cellbits == 32
  30. const OFFSET_CLIPAMMO = 51
  31. #else
  32. const OFFSET_CLIPAMMO = 65
  33. #endif
  34. const OFFSET_LINUX_WEAPONS = 4
  35.  
  36. // Max Clip for weapons
  37. new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
  38. 10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }
  39.  
  40. new g_itemid_infammo, g_has_unlimited_clip[33]
  41.  
  42. public plugin_init()
  43. {
  44. register_plugin("[ZP] Extra: Unlimited Clip", "1.0", "MeRcyLeZZ")
  45.  
  46. g_itemid_infammo = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN)
  47.  
  48. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  49. register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
  50. }
  51.  
  52. // Player buys our upgrade, set the unlimited ammo flag
  53. public zp_extra_item_selected(player, itemid)
  54. {
  55. if (itemid == g_itemid_infammo)
  56. g_has_unlimited_clip[player] = true
  57. }
  58.  
  59. // Reset flags for all players on newround
  60. public event_round_start()
  61. {
  62. for (new id; id <= 32; id++) g_has_unlimited_clip[id] = false;
  63. }
  64.  
  65. // Unlimited clip code
  66. public message_cur_weapon(msg_id, msg_dest, msg_entity)
  67. {
  68. // Player doesn't have the unlimited clip upgrade
  69. if (!g_has_unlimited_clip[msg_entity])
  70. return;
  71.  
  72. // Player not alive or not an active weapon
  73. if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
  74. return;
  75.  
  76. static weapon, clip
  77. weapon = get_msg_arg_int(2) // get weapon ID
  78. clip = get_msg_arg_int(3) // get weapon clip
  79.  
  80. // Unlimited Clip Ammo
  81. if (MAXCLIP[weapon] > 2) // skip grenades
  82. {
  83. set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
  84.  
  85. if (clip < 2) // refill when clip is nearly empty
  86. {
  87. // Get the weapon entity
  88. static wname[32], weapon_ent
  89. get_weaponname(weapon, wname, sizeof wname - 1)
  90. weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
  91.  
  92. // Set max clip on weapon
  93. fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
  94. }
  95. }
  96. }
  97.  
  98. // Find entity by its owner (from fakemeta_util)
  99. stock fm_find_ent_by_owner(entity, const classname[], owner)
  100. {
  101. while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
  102.  
  103. return entity;
  104. }
  105.  
  106. // Set Weapon Clip Ammo
  107. stock fm_set_weapon_ammo(entity, amount)
  108. {
  109. set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
  110. }
  111. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  112. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang3082\\ f0\\ fs16 \n\\ par }
  113. */
  114.  

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Mi a hiba?
HozzászólásElküldve:2013.03.26. 21:27 
Offline
Jómunkásember

Csatlakozott:2012.01.29. 12:48
Hozzászólások:408
Megköszönt másnak: 15 alkalommal
Megköszönték neki: 126 alkalommal
Try this.

Kód:
/*================================================================================
   
   -------------------------------------------
   -*- [ZP] Extra Item: Unlimited Clip 1.0 -*-
   -------------------------------------------
   
   ~~~~~~~~~~~~~~~
   - Description -
   ~~~~~~~~~~~~~~~
   
   This item/upgrade gives players unlimited clip ammo for a single round.
   
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

/*================================================================================
 [Plugin Customization]
=================================================================================*/

new const g_item_name[] = { "Orok Tolteny (Egy kor)" }
const g_item_cost = 50

/*============================================================================*/

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4

// Max Clip for weapons
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
         10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

new g_itemid_infammo, g_has_unlimited_clip[33]

public plugin_init()
{
   register_plugin("[ZP] Extra: Unlimited Clip", "1.0", "MeRcyLeZZ")
   
   g_itemid_infammo = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN)   
   
   register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
   register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
}

// Player buys our upgrade, set the unlimited ammo flag
public zp_extra_item_selected(player, itemid)
{
   if (itemid == g_itemid_infammo)
      g_has_unlimited_clip[player] = true
}

// Reset flags for all players on newround
public event_round_start()
{
   for (new id; id <= 32; id++) g_has_unlimited_clip[id] = false;
}

// Unlimited clip code
public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
   // Player doesn't have the unlimited clip upgrade
   if (!g_has_unlimited_clip[msg_entity])
      return;
   
   // Player not alive or not an active weapon
   if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
      return;
   
   static weapon, clip
   weapon = get_msg_arg_int(2) // get weapon ID
   clip = get_msg_arg_int(3) // get weapon clip
   
   // Unlimited Clip Ammo
   if (MAXCLIP[weapon] > 2) // skip grenades
   {
      set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
      
      if (clip < 2) // refill when clip is nearly empty
      {
         // Get the weapon entity
         static wname[32], weapon_ent
         get_weaponname(weapon, wname, sizeof wname - 1)
         weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
         
         // Set max clip on weapon
         fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
      }
   }
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
   while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
   
   return entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entity, amount)
{
   set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}



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  [2 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 26 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