hlmod.hu

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



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: nincs regisztrált felhasználó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  [13 hozzászólás ]  OldalElőző12
Szerző Üzenet
 Hozzászólás témája: Re: Üdvözlő üzenet hiba
HozzászólásElküldve:2013.06.12. 21:48 
Offline
Őstag
Avatar

Csatlakozott:2011.11.15. 16:29
Hozzászólások:1142
Megköszönt másnak: 8 alkalommal
Megköszönték neki: 24 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. /*================================================================================
  2.  
  3. ---------------------
  4. -*- [ZP] Buyzones -*-
  5. ---------------------
  6.  
  7. This plugin is part of Zombie Plague Mod and is distributed under the
  8. terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
  9.  
  10. ================================================================================*/
  11.  
  12. #include <amxmodx>
  13. #include <cstrike>
  14. #include <fakemeta>
  15. #include <hamsandwich>
  16. #include <zp50_core>
  17. #define LIBRARY_SURVIVOR "zp50_class_survivor"
  18. #include <zp50_class_survivor>
  19. #define LIBRARY_AMMOPACKS "zp50_ammopacks"
  20. #include <zp50_ammopacks>
  21. #include <zp50_colorchat>
  22.  
  23. #define MAXPLAYERS 32
  24. #define TASK_WELCOMEMSG 100
  25.  
  26. new const CS_BUYZONE_ENT[] = "func_buyzone"
  27.  
  28. // CS sounds
  29. new const g_sound_buyammo[] = "items/9mmclip1.wav"
  30.  
  31. // CS Player CBase Offsets (win32)
  32. const PDATA_SAFE = 2
  33. const OFFSET_MAPZONE = 235
  34. const PLAYER_IN_BUYZONE = (1<<0)
  35.  
  36. // Weapon IDs for ammo types
  37. new const AMMOWEAPON[] = { 0, CSW_AWP, CSW_SCOUT, CSW_M249, CSW_AUG, CSW_XM1014, CSW_MAC10, CSW_FIVESEVEN, CSW_DEAGLE,
  38. CSW_P228, CSW_ELITE, CSW_FLASHBANG, CSW_HEGRENADE, CSW_SMOKEGRENADE, CSW_C4 }
  39.  
  40. // Max BP ammo for weapons
  41. new const MAXBPAMMO[] = { -1, 52, -1, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120,
  42. 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100 }
  43.  
  44. // Amount of ammo to give when buying additional clips for weapons
  45. new const BUYAMMO[] = { -1, 13, -1, 30, -1, 8, -1, 12, 30, -1, 30, 50, 12, 30, 30, 30, 12, 30,
  46. 10, 30, 30, 8, 30, 30, 30, -1, 7, 30, 30, -1, 50 }
  47.  
  48. // Ammo Type Names for weapons
  49. new const AMMOTYPE[][] = { "", "357sig", "", "762nato", "", "buckshot", "", "45acp", "556nato", "", "9mm", "57mm", "45acp",
  50. "556nato", "556nato", "556nato", "45acp", "9mm", "338magnum", "9mm", "556natobox", "buckshot",
  51. "556nato", "9mm", "762nato", "", "50ae", "556nato", "762nato", "", "57mm" }
  52.  
  53. new g_fwSpawn
  54.  
  55. new g_BuyzoneEnt
  56. new Float:g_BuyTimeStart[MAXPLAYERS+1]
  57.  
  58. new cvar_buyzone_time, cvar_buyzone_humans, cvar_buyzone_zombies
  59. new cvar_buy_ammo_human, cvar_buy_ammo_cost_ammopacks, cvar_buy_ammo_cost_money
  60.  
  61. public plugin_init()
  62. {
  63. register_plugin("[ZP] Buyzones", ZP_VERSION_STRING, "ZP Dev Team")
  64.  
  65. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  66.  
  67. unregister_forward(FM_Spawn, g_fwSpawn)
  68. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
  69.  
  70. register_message(get_user_msgid("StatusIcon"), "message_status_icon")
  71.  
  72. // Client commands
  73. register_clcmd("buyammo1", "clcmd_buyammo")
  74. register_clcmd("buyammo2", "clcmd_buyammo")
  75.  
  76. cvar_buyzone_time = register_cvar("zp_buyzone_time", "15")
  77. cvar_buyzone_humans = register_cvar("zp_buyzone_humans", "1")
  78. cvar_buyzone_zombies = register_cvar("zp_buyzone_zombies", "0")
  79.  
  80. cvar_buy_ammo_human = register_cvar("zp_buy_ammo_human", "1")
  81. cvar_buy_ammo_cost_ammopacks = register_cvar("zp_buy_ammo_cost_ammopacks", "1")
  82. cvar_buy_ammo_cost_money = register_cvar("zp_buy_ammo_cost_money", "100")
  83.  
  84. // Bots buy ammo automatically
  85. register_event("AmmoX", "event_ammo_x", "be")
  86. }
  87.  
  88. public plugin_precache()
  89. {
  90. // Custom buyzone for all players
  91. g_BuyzoneEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, CS_BUYZONE_ENT))
  92. if (pev_valid(g_BuyzoneEnt))
  93. {
  94. dllfunc(DLLFunc_Spawn, g_BuyzoneEnt)
  95. set_pev(g_BuyzoneEnt, pev_solid, SOLID_NOT)
  96. }
  97. if (!pev_valid(g_BuyzoneEnt))
  98. {
  99. set_fail_state("Unable to spawn custom buyzone.")
  100. return;
  101. }
  102.  
  103. // Prevent some entities from spawning
  104. g_fwSpawn = register_forward(FM_Spawn, "fw_Spawn")
  105.  
  106. // Precache sounds
  107. precache_sound(g_sound_buyammo)
  108. }
  109.  
  110. public plugin_natives()
  111. {
  112. set_module_filter("module_filter")
  113. set_native_filter("native_filter")
  114. }
  115. public module_filter(const module[])
  116. {
  117. if (equal(module, LIBRARY_SURVIVOR) || equal(module, LIBRARY_AMMOPACKS))
  118. return PLUGIN_HANDLED;
  119.  
  120. return PLUGIN_CONTINUE;
  121. }
  122. public native_filter(const name[], index, trap)
  123. {
  124. if (!trap)
  125. return PLUGIN_HANDLED;
  126.  
  127. return PLUGIN_CONTINUE;
  128. }
  129.  
  130. public plugin_cfg()
  131. {
  132. // Prevents CS buytime messing up ZP buytime cvar
  133. server_cmd("mp_buytime 99")
  134. }
  135.  
  136. // Event Round Start
  137. public event_round_start()
  138. {
  139. // Show buyammo message?
  140. if (get_pcvar_num(cvar_buy_ammo_human))
  141. {
  142. remove_task(TASK_WELCOMEMSG)
  143. set_task(2.2, "task_welcome_msg", TASK_WELCOMEMSG)
  144. }
  145. }
  146.  
  147. // Welcome Message Task
  148. public task_welcome_msg()
  149. {
  150. zp_colored_print(0, "%L", LANG_PLAYER, "NOTICE_INFO2")
  151. }
  152.  
  153. // Bots buy ammo automatically
  154. public event_ammo_x(id)
  155. {
  156. if (!is_user_bot(id) || !is_user_alive(id) || zp_core_is_zombie(id))
  157. return;
  158.  
  159. // Get ammo type
  160. new type = read_data(1)
  161.  
  162. // Unknown ammo type
  163. if (type >= sizeof AMMOWEAPON)
  164. return;
  165.  
  166. // Get weapon's id
  167. new weapon = AMMOWEAPON[type]
  168.  
  169. // Primary and secondary only
  170. if (MAXBPAMMO[weapon] <= 2)
  171. return;
  172.  
  173. // Get ammo amount
  174. new amount = read_data(2)
  175.  
  176. if (amount <= BUYAMMO[weapon])
  177. {
  178. // Task needed
  179. remove_task(id)
  180. set_task(0.1, "clcmd_buyammo", id)
  181. }
  182. }
  183.  
  184. // Entity Spawn Forward
  185. public fw_Spawn(entity)
  186. {
  187. // Invalid entity
  188. if (!pev_valid(entity))
  189. return FMRES_IGNORED;
  190.  
  191. // Get classname
  192. new classname[32]
  193. pev(entity, pev_classname, classname, charsmax(classname))
  194.  
  195. // Check whether it needs to be removed
  196. if (equal(classname, CS_BUYZONE_ENT))
  197. {
  198. engfunc(EngFunc_RemoveEntity, entity)
  199. return FMRES_SUPERCEDE;
  200. }
  201.  
  202. return FMRES_IGNORED;
  203. }
  204.  
  205. public zp_fw_core_cure_post(id, attacker)
  206. {
  207. if (get_pcvar_num(cvar_buyzone_humans) && (!LibraryExists(LIBRARY_SURVIVOR, LibType_Library) || !zp_class_survivor_get(id)))
  208. {
  209. // Buyzone time starts when player is set to human
  210. g_BuyTimeStart[id] = get_gametime()
  211. }
  212. else
  213. {
  214. // Buyzone time ends when player is set to human/survivor
  215. g_BuyTimeStart[id] = get_gametime() - get_pcvar_float(cvar_buyzone_time)
  216. }
  217. }
  218.  
  219. public zp_fw_core_infect_post(id, attacker)
  220. {
  221. if (get_pcvar_num(cvar_buyzone_zombies))
  222. {
  223. // Buyzone time starts when player is set to zombie
  224. g_BuyTimeStart[id] = get_gametime()
  225. }
  226. else
  227. {
  228. // Buyzone time ends when player is set to zombie
  229. g_BuyTimeStart[id] = get_gametime() - get_pcvar_float(cvar_buyzone_time)
  230. }
  231. }
  232.  
  233. // Forward Player PreThink
  234. public fw_PlayerPreThink(id)
  235. {
  236. // Not alive
  237. if (!is_user_alive(id))
  238. return;
  239.  
  240. // Enable custom buyzone for player during buytime, unless time expired
  241. if (get_gametime() < g_BuyTimeStart[id] + get_pcvar_float(cvar_buyzone_time))
  242. dllfunc(DLLFunc_Touch, g_BuyzoneEnt, id)
  243. // Remove offset immediately after buyzone time ends (bugfix)
  244. else if (cs_get_user_buyzone(id))
  245. fm_cs_set_user_buyzone_offset(id, false)
  246. }
  247.  
  248. public message_status_icon(msg_id, msg_dest, msg_entity)
  249. {
  250. if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
  251. return;
  252.  
  253. static sprite[10]
  254. get_msg_arg_string(2, sprite, charsmax(sprite))
  255.  
  256. if (!equal(sprite, "buyzone"))
  257. return;
  258.  
  259. if (get_gametime() < g_BuyTimeStart[msg_entity] + get_pcvar_float(cvar_buyzone_time))
  260. return;
  261.  
  262. // Hide buyzone icon after buyzone time is over (bugfix)
  263. set_msg_arg_int(1, get_msg_argtype(1), 0)
  264. }
  265.  
  266. // Buy BP Ammo
  267. public clcmd_buyammo(id)
  268. {
  269. // Setting disabled, player dead or zombie
  270. if (!get_pcvar_num(cvar_buy_ammo_human) || !is_user_alive(id) || zp_core_is_zombie(id))
  271. return;
  272.  
  273. // Player standing in buyzone, allow buying weapon's ammo normally instead
  274. if ((get_gametime() < g_BuyTimeStart[id] + get_pcvar_float(cvar_buyzone_time)) && cs_get_user_buyzone(id))
  275. return;
  276.  
  277. // Not enough money/ammo packs
  278. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  279. {
  280. if (zp_ammopacks_get(id) < get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  281. {
  282. zp_colored_print(id, "%L (%L)", id, "NOT_ENOUGH_AMMO", id, "REQUIRED_AMOUNT", get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  283. return;
  284. }
  285. }
  286. else
  287. {
  288. if (cs_get_user_money(id) < get_pcvar_num(cvar_buy_ammo_cost_money))
  289. {
  290. zp_colored_print(id, "%L (%L)", id, "NOT_ENOUGH_MONEY", id, "REQUIRED_AMOUNT", get_pcvar_num(cvar_buy_ammo_cost_money))
  291. return;
  292. }
  293. }
  294.  
  295. // Get user weapons
  296. new weapons[32], num_weapons, index, weaponid, bpammo_before, refilled
  297. get_user_weapons(id, weapons, num_weapons)
  298.  
  299. // Loop through them and give the right ammo type
  300. for (index = 0; index < num_weapons; index++)
  301. {
  302. // Prevents re-indexing the array
  303. weaponid = weapons[index]
  304.  
  305. // Primary and secondary only
  306. if (MAXBPAMMO[weaponid] > 2)
  307. {
  308. bpammo_before = cs_get_user_bpammo(id, weaponid)
  309.  
  310. // Give additional ammo
  311. ExecuteHamB(Ham_GiveAmmo, id, BUYAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
  312.  
  313. // Check whether we actually refilled the weapon's ammo
  314. if (cs_get_user_bpammo(id, weaponid) - bpammo_before > 0)
  315. refilled = true
  316. }
  317. }
  318.  
  319. // Weapons already have full ammo
  320. if (!refilled)
  321. return;
  322.  
  323. // Deduce cost
  324. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  325. zp_ammopacks_set(id, zp_ammopacks_get(id) - get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  326. else
  327. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_buy_ammo_cost_money))
  328.  
  329. // Play clip purchase sound, and notify player
  330. emit_sound(id, CHAN_ITEM, g_sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
  331. zp_colored_print(id, "%L", id, "AMMO_BOUGHT")
  332. }
  333.  
  334. stock fm_cs_set_user_buyzone_offset(id, set = true)
  335. {
  336. // Prevent server crash if entity's private data not initalized
  337. if (pev_valid(id) != PDATA_SAFE)
  338. return false;
  339.  
  340. if (set)
  341. set_pdata_int(id, OFFSET_MAPZONE, get_pdata_int(id, OFFSET_MAPZONE) | PLAYER_IN_BUYZONE)
  342. else
  343. set_pdata_int(id, OFFSET_MAPZONE, get_pdata_int(id, OFFSET_MAPZONE) & ~PLAYER_IN_BUYZONE)
  344. return true;
  345. }


Nem kell már egyből leharapni az ember fejét :$!
Na szóval

ezeket töröltem ki:

SMA Forráskód: [ Mindet kijelol ]
  1. public event_round_start()
  2. {
  3. // Show buyammo message?
  4. if (get_pcvar_num(cvar_buy_ammo_human))
  5. {
  6. remove_task(TASK_WELCOMEMSG)
  7. set_task(2.2, "task_welcome_msg", TASK_WELCOMEMSG)
  8. }
  9. }
  10.  
  11. // Welcome Message Task
  12. public task_welcome_msg()
  13. {
  14. zp_colored_print(0, "%L", LANG_PLAYER, "NOTICE_INFO2")
  15. }
  16.  


és

SMA Forráskód: [ Mindet kijelol ]
  1. #define TASK_WELCOMEMSG 100


TEHÁT CSAK A NOTICE_INFO2-ES SZÖVEGET SZERETNÉM KITÖRÖLNI! ,HOGY SEMMITSE ÍRJON MINDEN KÖR ELEJÉN! :)

_________________
[url=http://www.gametracker.com/server_info/188.227.227.114:27286/][img]http://cache.www.gametracker.com/server_info/188.227.227.114:27286/b_350_20_323957_202743_F19A15_111111.png[/img][/url]


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Üdvözlő üzenet hiba
HozzászólásElküldve:2013.06.12. 22:00 
Offline
Őstag

Csatlakozott:2011.06.12. 20:51
Hozzászólások:1089
Megköszönt másnak: 3 alkalommal
Megköszönték neki: 44 alkalommal
így próbáld
SMA Forráskód: [ Mindet kijelol ]
  1. /*================================================================================
  2.  
  3. ---------------------
  4. -*- [ZP] Buyzones -*-
  5. ---------------------
  6.  
  7. This plugin is part of Zombie Plague Mod and is distributed under the
  8. terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
  9.  
  10. ================================================================================*/
  11.  
  12. #include <amxmodx>
  13. #include <cstrike>
  14. #include <fakemeta>
  15. #include <hamsandwich>
  16. #include <zp50_core>
  17. #define LIBRARY_SURVIVOR "zp50_class_survivor"
  18. #include <zp50_class_survivor>
  19. #define LIBRARY_AMMOPACKS "zp50_ammopacks"
  20. #include <zp50_ammopacks>
  21. #include <zp50_colorchat>
  22.  
  23. #define MAXPLAYERS 32
  24. #define TASK_WELCOMEMSG 100
  25.  
  26. new const CS_BUYZONE_ENT[] = "func_buyzone"
  27.  
  28. // CS sounds
  29. new const g_sound_buyammo[] = "items/9mmclip1.wav"
  30.  
  31. // CS Player CBase Offsets (win32)
  32. const PDATA_SAFE = 2
  33. const OFFSET_MAPZONE = 235
  34. const PLAYER_IN_BUYZONE = (1<<0)
  35.  
  36. // Weapon IDs for ammo types
  37. new const AMMOWEAPON[] = { 0, CSW_AWP, CSW_SCOUT, CSW_M249, CSW_AUG, CSW_XM1014, CSW_MAC10, CSW_FIVESEVEN, CSW_DEAGLE,
  38. CSW_P228, CSW_ELITE, CSW_FLASHBANG, CSW_HEGRENADE, CSW_SMOKEGRENADE, CSW_C4 }
  39.  
  40. // Max BP ammo for weapons
  41. new const MAXBPAMMO[] = { -1, 52, -1, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120,
  42. 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100 }
  43.  
  44. // Amount of ammo to give when buying additional clips for weapons
  45. new const BUYAMMO[] = { -1, 13, -1, 30, -1, 8, -1, 12, 30, -1, 30, 50, 12, 30, 30, 30, 12, 30,
  46. 10, 30, 30, 8, 30, 30, 30, -1, 7, 30, 30, -1, 50 }
  47.  
  48. // Ammo Type Names for weapons
  49. new const AMMOTYPE[][] = { "", "357sig", "", "762nato", "", "buckshot", "", "45acp", "556nato", "", "9mm", "57mm", "45acp",
  50. "556nato", "556nato", "556nato", "45acp", "9mm", "338magnum", "9mm", "556natobox", "buckshot",
  51. "556nato", "9mm", "762nato", "", "50ae", "556nato", "762nato", "", "57mm" }
  52.  
  53. new g_fwSpawn
  54.  
  55. new g_BuyzoneEnt
  56. new Float:g_BuyTimeStart[MAXPLAYERS+1]
  57.  
  58. new cvar_buyzone_time, cvar_buyzone_humans, cvar_buyzone_zombies
  59. new cvar_buy_ammo_human, cvar_buy_ammo_cost_ammopacks, cvar_buy_ammo_cost_money
  60.  
  61. public plugin_init()
  62. {
  63. register_plugin("[ZP] Buyzones", ZP_VERSION_STRING, "ZP Dev Team")
  64.  
  65. unregister_forward(FM_Spawn, g_fwSpawn)
  66. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
  67.  
  68. register_message(get_user_msgid("StatusIcon"), "message_status_icon")
  69.  
  70. // Client commands
  71. register_clcmd("buyammo1", "clcmd_buyammo")
  72. register_clcmd("buyammo2", "clcmd_buyammo")
  73.  
  74. cvar_buyzone_time = register_cvar("zp_buyzone_time", "15")
  75. cvar_buyzone_humans = register_cvar("zp_buyzone_humans", "1")
  76. cvar_buyzone_zombies = register_cvar("zp_buyzone_zombies", "0")
  77.  
  78. cvar_buy_ammo_human = register_cvar("zp_buy_ammo_human", "1")
  79. cvar_buy_ammo_cost_ammopacks = register_cvar("zp_buy_ammo_cost_ammopacks", "1")
  80. cvar_buy_ammo_cost_money = register_cvar("zp_buy_ammo_cost_money", "100")
  81.  
  82. // Bots buy ammo automatically
  83. register_event("AmmoX", "event_ammo_x", "be")
  84. }
  85.  
  86. public plugin_precache()
  87. {
  88. // Custom buyzone for all players
  89. g_BuyzoneEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, CS_BUYZONE_ENT))
  90. if (pev_valid(g_BuyzoneEnt))
  91. {
  92. dllfunc(DLLFunc_Spawn, g_BuyzoneEnt)
  93. set_pev(g_BuyzoneEnt, pev_solid, SOLID_NOT)
  94. }
  95. if (!pev_valid(g_BuyzoneEnt))
  96. {
  97. set_fail_state("Unable to spawn custom buyzone.")
  98. return;
  99. }
  100.  
  101. // Prevent some entities from spawning
  102. g_fwSpawn = register_forward(FM_Spawn, "fw_Spawn")
  103.  
  104. // Precache sounds
  105. precache_sound(g_sound_buyammo)
  106. }
  107.  
  108. public plugin_natives()
  109. {
  110. set_module_filter("module_filter")
  111. set_native_filter("native_filter")
  112. }
  113. public module_filter(const module[])
  114. {
  115. if (equal(module, LIBRARY_SURVIVOR) || equal(module, LIBRARY_AMMOPACKS))
  116. return PLUGIN_HANDLED;
  117.  
  118. return PLUGIN_CONTINUE;
  119. }
  120. public native_filter(const name[], index, trap)
  121. {
  122. if (!trap)
  123. return PLUGIN_HANDLED;
  124.  
  125. return PLUGIN_CONTINUE;
  126. }
  127.  
  128. public plugin_cfg()
  129. {
  130. // Prevents CS buytime messing up ZP buytime cvar
  131. server_cmd("mp_buytime 99")
  132. }
  133.  
  134. // Event Round Start
  135.  
  136. // Welcome Message Task
  137.  
  138. // Bots buy ammo automatically
  139. public event_ammo_x(id)
  140. {
  141. if (!is_user_bot(id) || !is_user_alive(id) || zp_core_is_zombie(id))
  142. return;
  143.  
  144. // Get ammo type
  145. new type = read_data(1)
  146.  
  147. // Unknown ammo type
  148. if (type >= sizeof AMMOWEAPON)
  149. return;
  150.  
  151. // Get weapon's id
  152. new weapon = AMMOWEAPON[type]
  153.  
  154. // Primary and secondary only
  155. if (MAXBPAMMO[weapon] <= 2)
  156. return;
  157.  
  158. // Get ammo amount
  159. new amount = read_data(2)
  160.  
  161. if (amount <= BUYAMMO[weapon])
  162. {
  163. // Task needed
  164. remove_task(id)
  165. set_task(0.1, "clcmd_buyammo", id)
  166. }
  167. }
  168.  
  169. // Entity Spawn Forward
  170. public fw_Spawn(entity)
  171. {
  172. // Invalid entity
  173. if (!pev_valid(entity))
  174. return FMRES_IGNORED;
  175.  
  176. // Get classname
  177. new classname[32]
  178. pev(entity, pev_classname, classname, charsmax(classname))
  179.  
  180. // Check whether it needs to be removed
  181. if (equal(classname, CS_BUYZONE_ENT))
  182. {
  183. engfunc(EngFunc_RemoveEntity, entity)
  184. return FMRES_SUPERCEDE;
  185. }
  186.  
  187. return FMRES_IGNORED;
  188. }
  189.  
  190. public zp_fw_core_cure_post(id, attacker)
  191. {
  192. if (get_pcvar_num(cvar_buyzone_humans) && (!LibraryExists(LIBRARY_SURVIVOR, LibType_Library) || !zp_class_survivor_get(id)))
  193. {
  194. // Buyzone time starts when player is set to human
  195. g_BuyTimeStart[id] = get_gametime()
  196. }
  197. else
  198. {
  199. // Buyzone time ends when player is set to human/survivor
  200. g_BuyTimeStart[id] = get_gametime() - get_pcvar_float(cvar_buyzone_time)
  201. }
  202. }
  203.  
  204. public zp_fw_core_infect_post(id, attacker)
  205. {
  206. if (get_pcvar_num(cvar_buyzone_zombies))
  207. {
  208. // Buyzone time starts when player is set to zombie
  209. g_BuyTimeStart[id] = get_gametime()
  210. }
  211. else
  212. {
  213. // Buyzone time ends when player is set to zombie
  214. g_BuyTimeStart[id] = get_gametime() - get_pcvar_float(cvar_buyzone_time)
  215. }
  216. }
  217.  
  218. // Forward Player PreThink
  219. public fw_PlayerPreThink(id)
  220. {
  221. // Not alive
  222. if (!is_user_alive(id))
  223. return;
  224.  
  225. // Enable custom buyzone for player during buytime, unless time expired
  226. if (get_gametime() < g_BuyTimeStart[id] + get_pcvar_float(cvar_buyzone_time))
  227. dllfunc(DLLFunc_Touch, g_BuyzoneEnt, id)
  228. // Remove offset immediately after buyzone time ends (bugfix)
  229. else if (cs_get_user_buyzone(id))
  230. fm_cs_set_user_buyzone_offset(id, false)
  231. }
  232.  
  233. public message_status_icon(msg_id, msg_dest, msg_entity)
  234. {
  235. if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
  236. return;
  237.  
  238. static sprite[10]
  239. get_msg_arg_string(2, sprite, charsmax(sprite))
  240.  
  241. if (!equal(sprite, "buyzone"))
  242. return;
  243.  
  244. if (get_gametime() < g_BuyTimeStart[msg_entity] + get_pcvar_float(cvar_buyzone_time))
  245. return;
  246.  
  247. // Hide buyzone icon after buyzone time is over (bugfix)
  248. set_msg_arg_int(1, get_msg_argtype(1), 0)
  249. }
  250.  
  251. // Buy BP Ammo
  252. public clcmd_buyammo(id)
  253. {
  254. // Setting disabled, player dead or zombie
  255. if (!get_pcvar_num(cvar_buy_ammo_human) || !is_user_alive(id) || zp_core_is_zombie(id))
  256. return;
  257.  
  258. // Player standing in buyzone, allow buying weapon's ammo normally instead
  259. if ((get_gametime() < g_BuyTimeStart[id] + get_pcvar_float(cvar_buyzone_time)) && cs_get_user_buyzone(id))
  260. return;
  261.  
  262. // Not enough money/ammo packs
  263. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  264. {
  265. if (zp_ammopacks_get(id) < get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  266. {
  267. zp_colored_print(id, "%L (%L)", id, "NOT_ENOUGH_AMMO", id, "REQUIRED_AMOUNT", get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  268. return;
  269. }
  270. }
  271. else
  272. {
  273. if (cs_get_user_money(id) < get_pcvar_num(cvar_buy_ammo_cost_money))
  274. {
  275. zp_colored_print(id, "%L (%L)", id, "NOT_ENOUGH_MONEY", id, "REQUIRED_AMOUNT", get_pcvar_num(cvar_buy_ammo_cost_money))
  276. return;
  277. }
  278. }
  279.  
  280. // Get user weapons
  281. new weapons[32], num_weapons, index, weaponid, bpammo_before, refilled
  282. get_user_weapons(id, weapons, num_weapons)
  283.  
  284. // Loop through them and give the right ammo type
  285. for (index = 0; index < num_weapons; index++)
  286. {
  287. // Prevents re-indexing the array
  288. weaponid = weapons[index]
  289.  
  290. // Primary and secondary only
  291. if (MAXBPAMMO[weaponid] > 2)
  292. {
  293. bpammo_before = cs_get_user_bpammo(id, weaponid)
  294.  
  295. // Give additional ammo
  296. ExecuteHamB(Ham_GiveAmmo, id, BUYAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
  297.  
  298. // Check whether we actually refilled the weapon's ammo
  299. if (cs_get_user_bpammo(id, weaponid) - bpammo_before > 0)
  300. refilled = true
  301. }
  302. }
  303.  
  304. // Weapons already have full ammo
  305. if (!refilled)
  306. return;
  307.  
  308. // Deduce cost
  309. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  310. zp_ammopacks_set(id, zp_ammopacks_get(id) - get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  311. else
  312. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_buy_ammo_cost_money))
  313.  
  314. // Play clip purchase sound, and notify player
  315. emit_sound(id, CHAN_ITEM, g_sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
  316. zp_colored_print(id, "%L", id, "AMMO_BOUGHT")
  317. }
  318.  
  319. stock fm_cs_set_user_buyzone_offset(id, set = true)
  320. {
  321. // Prevent server crash if entity's private data not initalized
  322. if (pev_valid(id) != PDATA_SAFE)
  323. return false;
  324.  
  325. if (set)
  326. set_pdata_int(id, OFFSET_MAPZONE, get_pdata_int(id, OFFSET_MAPZONE) | PLAYER_IN_BUYZONE)
  327. else
  328. set_pdata_int(id, OFFSET_MAPZONE, get_pdata_int(id, OFFSET_MAPZONE) & ~PLAYER_IN_BUYZONE)
  329. return true;
  330. }
  331.  

_________________
[img]semmi[/img]


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Üdvözlő üzenet hiba
HozzászólásElküldve:2013.06.12. 22:09 
Offline
Őstag
Avatar

Csatlakozott:2011.11.15. 16:29
Hozzászólások:1142
Megköszönt másnak: 8 alkalommal
Megköszönték neki: 24 alkalommal
Köszi!

_________________
[url=http://www.gametracker.com/server_info/188.227.227.114:27286/][img]http://cache.www.gametracker.com/server_info/188.227.227.114:27286/b_350_20_323957_202743_F19A15_111111.png[/img][/url]


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  [13 hozzászólás ]  OldalElőző12


Ki van itt

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