hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.15. 04:36



Jelenlévő felhasználók

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

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-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 ]  Oldal 1 2 Következő
Szerző Üzenet
 Hozzászólás témája: Üdvözlő üzenet hiba
HozzászólásElküldve: 2013.06.12. 20:17 
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. // Bots buy ammo automatically
  149. public event_ammo_x(id)
  150. {
  151. if (!is_user_bot(id) || !is_user_alive(id) || zp_core_is_zombie(id))
  152. return;
  153.  
  154. // Get ammo type
  155. new type = read_data(1)
  156.  
  157. // Unknown ammo type
  158. if (type >= sizeof AMMOWEAPON)
  159. return;
  160.  
  161. // Get weapon's id
  162. new weapon = AMMOWEAPON[type]
  163.  
  164. // Primary and secondary only
  165. if (MAXBPAMMO[weapon] <= 2)
  166. return;
  167.  
  168. // Get ammo amount
  169. new amount = read_data(2)
  170.  
  171. if (amount <= BUYAMMO[weapon])
  172. {
  173. // Task needed
  174. remove_task(id)
  175. set_task(0.1, "clcmd_buyammo", id)
  176. }
  177. }
  178.  
  179. // Entity Spawn Forward
  180. public fw_Spawn(entity)
  181. {
  182. // Invalid entity
  183. if (!pev_valid(entity))
  184. return FMRES_IGNORED;
  185.  
  186. // Get classname
  187. new classname[32]
  188. pev(entity, pev_classname, classname, charsmax(classname))
  189.  
  190. // Check whether it needs to be removed
  191. if (equal(classname, CS_BUYZONE_ENT))
  192. {
  193. engfunc(EngFunc_RemoveEntity, entity)
  194. return FMRES_SUPERCEDE;
  195. }
  196.  
  197. return FMRES_IGNORED;
  198. }
  199.  
  200. public zp_fw_core_cure_post(id, attacker)
  201. {
  202. if (get_pcvar_num(cvar_buyzone_humans) && (!LibraryExists(LIBRARY_SURVIVOR, LibType_Library) || !zp_class_survivor_get(id)))
  203. {
  204. // Buyzone time starts when player is set to human
  205. g_BuyTimeStart[id] = get_gametime()
  206. }
  207. else
  208. {
  209. // Buyzone time ends when player is set to human/survivor
  210. g_BuyTimeStart[id] = get_gametime() - get_pcvar_float(cvar_buyzone_time)
  211. }
  212. }
  213.  
  214. public zp_fw_core_infect_post(id, attacker)
  215. {
  216. if (get_pcvar_num(cvar_buyzone_zombies))
  217. {
  218. // Buyzone time starts when player is set to zombie
  219. g_BuyTimeStart[id] = get_gametime()
  220. }
  221. else
  222. {
  223. // Buyzone time ends when player is set to zombie
  224. g_BuyTimeStart[id] = get_gametime() - get_pcvar_float(cvar_buyzone_time)
  225. }
  226. }
  227.  
  228. // Forward Player PreThink
  229. public fw_PlayerPreThink(id)
  230. {
  231. // Not alive
  232. if (!is_user_alive(id))
  233. return;
  234.  
  235. // Enable custom buyzone for player during buytime, unless time expired
  236. if (get_gametime() < g_BuyTimeStart[id] + get_pcvar_float(cvar_buyzone_time))
  237. dllfunc(DLLFunc_Touch, g_BuyzoneEnt, id)
  238. // Remove offset immediately after buyzone time ends (bugfix)
  239. else if (cs_get_user_buyzone(id))
  240. fm_cs_set_user_buyzone_offset(id, false)
  241. }
  242.  
  243. public message_status_icon(msg_id, msg_dest, msg_entity)
  244. {
  245. if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
  246. return;
  247.  
  248. static sprite[10]
  249. get_msg_arg_string(2, sprite, charsmax(sprite))
  250.  
  251. if (!equal(sprite, "buyzone"))
  252. return;
  253.  
  254. if (get_gametime() < g_BuyTimeStart[msg_entity] + get_pcvar_float(cvar_buyzone_time))
  255. return;
  256.  
  257. // Hide buyzone icon after buyzone time is over (bugfix)
  258. set_msg_arg_int(1, get_msg_argtype(1), 0)
  259. }
  260.  
  261. // Buy BP Ammo
  262. public clcmd_buyammo(id)
  263. {
  264. // Setting disabled, player dead or zombie
  265. if (!get_pcvar_num(cvar_buy_ammo_human) || !is_user_alive(id) || zp_core_is_zombie(id))
  266. return;
  267.  
  268. // Player standing in buyzone, allow buying weapon's ammo normally instead
  269. if ((get_gametime() < g_BuyTimeStart[id] + get_pcvar_float(cvar_buyzone_time)) && cs_get_user_buyzone(id))
  270. return;
  271.  
  272. // Not enough money/ammo packs
  273. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  274. {
  275. if (zp_ammopacks_get(id) < get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  276. {
  277. zp_colored_print(id, "%L (%L)", id, "NOT_ENOUGH_AMMO", id, "REQUIRED_AMOUNT", get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  278. return;
  279. }
  280. }
  281. else
  282. {
  283. if (cs_get_user_money(id) < get_pcvar_num(cvar_buy_ammo_cost_money))
  284. {
  285. zp_colored_print(id, "%L (%L)", id, "NOT_ENOUGH_MONEY", id, "REQUIRED_AMOUNT", get_pcvar_num(cvar_buy_ammo_cost_money))
  286. return;
  287. }
  288. }
  289.  
  290. // Get user weapons
  291. new weapons[32], num_weapons, index, weaponid, bpammo_before, refilled
  292. get_user_weapons(id, weapons, num_weapons)
  293.  
  294. // Loop through them and give the right ammo type
  295. for (index = 0; index < num_weapons; index++)
  296. {
  297. // Prevents re-indexing the array
  298. weaponid = weapons[index]
  299.  
  300. // Primary and secondary only
  301. if (MAXBPAMMO[weaponid] > 2)
  302. {
  303. bpammo_before = cs_get_user_bpammo(id, weaponid)
  304.  
  305. // Give additional ammo
  306. ExecuteHamB(Ham_GiveAmmo, id, BUYAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
  307.  
  308. // Check whether we actually refilled the weapon's ammo
  309. if (cs_get_user_bpammo(id, weaponid) - bpammo_before > 0)
  310. refilled = true
  311. }
  312. }
  313.  
  314. // Weapons already have full ammo
  315. if (!refilled)
  316. return;
  317.  
  318. // Deduce cost
  319. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  320. zp_ammopacks_set(id, zp_ammopacks_get(id) - get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  321. else
  322. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_buy_ammo_cost_money))
  323.  
  324. // Play clip purchase sound, and notify player
  325. emit_sound(id, CHAN_ITEM, g_sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
  326. zp_colored_print(id, "%L", id, "AMMO_BOUGHT")
  327. }
  328.  
  329. stock fm_cs_set_user_buyzone_offset(id, set = true)
  330. {
  331. // Prevent server crash if entity's private data not initalized
  332. if (pev_valid(id) != PDATA_SAFE)
  333. return false;
  334.  
  335. if (set)
  336. set_pdata_int(id, OFFSET_MAPZONE, get_pdata_int(id, OFFSET_MAPZONE) | PLAYER_IN_BUYZONE)
  337. else
  338. set_pdata_int(id, OFFSET_MAPZONE, get_pdata_int(id, OFFSET_MAPZONE) & ~PLAYER_IN_BUYZONE)
  339. return true;
  340. }


A 147.-ik sorból kivettem a kör eleji üdvözlő szöveget amely minden kör elején megjelenik!
És kaptam 1 ilyen hibát:

" killed "chasper.<56>" with "knife" L 06/12/2013 - 20:18:34: Team "CT" triggered "CTs_Win" (CT "3") (T "7") L 06/12/2013 - 20:18:34: World triggered "Round_End" L 06/12/2013 - 20:18:39: Function is not present (function "task_welcome_msg") (plugin "zp50_buy_zones.amxx") L 06/12/2013 - 20:18:39: [AMXX] Run time 10 (plugin "zp50_buy_zones.amxx") (native "set_task") - debug not enabled! L 06/12/2013 - 20:18:39: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes). L 06/12/2013 - 20:18:39: World triggered "Round_Start"


Valaki tudna benne segíteni?

_________________
[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. 20:34 
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
Eddig sikerült javítani :

L 06/12/2013 - 20:36:25: Function "event_round_start" was not found
L 06/12/2013 - 20:36:25: [AMXX] Run time error 19 (plugin "zp50_buy_zones.amxx") - debug not enabled!
L 06/12/2013 - 20:36:25: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini

_________________
[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. 20:34 
Offline
Tiszteletbeli
Avatar

Csatlakozott: 2011.09.18. 13:01
Hozzászólások: 4270
Megköszönt másnak: 55 alkalommal
Megköszönték neki: 514 alkalommal
Kód:
Forras mentese sikeres. (ID: 51b8bf03b3a45)

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Header size:           2180 bytes
Code size:             9076 bytes
Data size:             6568 bytes
Stack/heap size:      16384 bytes; estimated max. usage=58 cells (232 bytes)
Total requirements:   34208 bytes
Done.


Sikeres atalakitas. Letoltes:
- .amxx fajl
- .sma fajl
A fajlok hamarosan torolve lesznek.

_________________
Idk. Csak ugy funbooo.
Kép


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. 20:35 
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
Igen tudom ,hogy lekonvertálja csak az a para logba dobálja a hülyeséget!:D Azért akarom javítani nehogy fagyás legyen a vége!:)

_________________
[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. 20:37 
Offline
Felfüggesztve
Avatar

Csatlakozott: 2013.06.09. 18:47
Hozzászólások: 2004
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 220 alkalommal
chasper.cfg írta:
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. // Bots buy ammo automatically
  149. public event_ammo_x(id)
  150. {
  151. if (!is_user_bot(id) || !is_user_alive(id) || zp_core_is_zombie(id))
  152. return;
  153.  
  154. // Get ammo type
  155. new type = read_data(1)
  156.  
  157. // Unknown ammo type
  158. if (type >= sizeof AMMOWEAPON)
  159. return;
  160.  
  161. // Get weapon's id
  162. new weapon = AMMOWEAPON[type]
  163.  
  164. // Primary and secondary only
  165. if (MAXBPAMMO[weapon] <= 2)
  166. return;
  167.  
  168. // Get ammo amount
  169. new amount = read_data(2)
  170.  
  171. if (amount <= BUYAMMO[weapon])
  172. {
  173. // Task needed
  174. remove_task(id)
  175. set_task(0.1, "clcmd_buyammo", id)
  176. }
  177. }
  178.  
  179. // Entity Spawn Forward
  180. public fw_Spawn(entity)
  181. {
  182. // Invalid entity
  183. if (!pev_valid(entity))
  184. return FMRES_IGNORED;
  185.  
  186. // Get classname
  187. new classname[32]
  188. pev(entity, pev_classname, classname, charsmax(classname))
  189.  
  190. // Check whether it needs to be removed
  191. if (equal(classname, CS_BUYZONE_ENT))
  192. {
  193. engfunc(EngFunc_RemoveEntity, entity)
  194. return FMRES_SUPERCEDE;
  195. }
  196.  
  197. return FMRES_IGNORED;
  198. }
  199.  
  200. public zp_fw_core_cure_post(id, attacker)
  201. {
  202. if (get_pcvar_num(cvar_buyzone_humans) && (!LibraryExists(LIBRARY_SURVIVOR, LibType_Library) || !zp_class_survivor_get(id)))
  203. {
  204. // Buyzone time starts when player is set to human
  205. g_BuyTimeStart[id] = get_gametime()
  206. }
  207. else
  208. {
  209. // Buyzone time ends when player is set to human/survivor
  210. g_BuyTimeStart[id] = get_gametime() - get_pcvar_float(cvar_buyzone_time)
  211. }
  212. }
  213.  
  214. public zp_fw_core_infect_post(id, attacker)
  215. {
  216. if (get_pcvar_num(cvar_buyzone_zombies))
  217. {
  218. // Buyzone time starts when player is set to zombie
  219. g_BuyTimeStart[id] = get_gametime()
  220. }
  221. else
  222. {
  223. // Buyzone time ends when player is set to zombie
  224. g_BuyTimeStart[id] = get_gametime() - get_pcvar_float(cvar_buyzone_time)
  225. }
  226. }
  227.  
  228. // Forward Player PreThink
  229. public fw_PlayerPreThink(id)
  230. {
  231. // Not alive
  232. if (!is_user_alive(id))
  233. return;
  234.  
  235. // Enable custom buyzone for player during buytime, unless time expired
  236. if (get_gametime() < g_BuyTimeStart[id] + get_pcvar_float(cvar_buyzone_time))
  237. dllfunc(DLLFunc_Touch, g_BuyzoneEnt, id)
  238. // Remove offset immediately after buyzone time ends (bugfix)
  239. else if (cs_get_user_buyzone(id))
  240. fm_cs_set_user_buyzone_offset(id, false)
  241. }
  242.  
  243. public message_status_icon(msg_id, msg_dest, msg_entity)
  244. {
  245. if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
  246. return;
  247.  
  248. static sprite[10]
  249. get_msg_arg_string(2, sprite, charsmax(sprite))
  250.  
  251. if (!equal(sprite, "buyzone"))
  252. return;
  253.  
  254. if (get_gametime() < g_BuyTimeStart[msg_entity] + get_pcvar_float(cvar_buyzone_time))
  255. return;
  256.  
  257. // Hide buyzone icon after buyzone time is over (bugfix)
  258. set_msg_arg_int(1, get_msg_argtype(1), 0)
  259. }
  260.  
  261. // Buy BP Ammo
  262. public clcmd_buyammo(id)
  263. {
  264. // Setting disabled, player dead or zombie
  265. if (!get_pcvar_num(cvar_buy_ammo_human) || !is_user_alive(id) || zp_core_is_zombie(id))
  266. return;
  267.  
  268. // Player standing in buyzone, allow buying weapon's ammo normally instead
  269. if ((get_gametime() < g_BuyTimeStart[id] + get_pcvar_float(cvar_buyzone_time)) && cs_get_user_buyzone(id))
  270. return;
  271.  
  272. // Not enough money/ammo packs
  273. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  274. {
  275. if (zp_ammopacks_get(id) < get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  276. {
  277. zp_colored_print(id, "%L (%L)", id, "NOT_ENOUGH_AMMO", id, "REQUIRED_AMOUNT", get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  278. return;
  279. }
  280. }
  281. else
  282. {
  283. if (cs_get_user_money(id) < get_pcvar_num(cvar_buy_ammo_cost_money))
  284. {
  285. zp_colored_print(id, "%L (%L)", id, "NOT_ENOUGH_MONEY", id, "REQUIRED_AMOUNT", get_pcvar_num(cvar_buy_ammo_cost_money))
  286. return;
  287. }
  288. }
  289.  
  290. // Get user weapons
  291. new weapons[32], num_weapons, index, weaponid, bpammo_before, refilled
  292. get_user_weapons(id, weapons, num_weapons)
  293.  
  294. // Loop through them and give the right ammo type
  295. for (index = 0; index < num_weapons; index++)
  296. {
  297. // Prevents re-indexing the array
  298. weaponid = weapons[index]
  299.  
  300. // Primary and secondary only
  301. if (MAXBPAMMO[weaponid] > 2)
  302. {
  303. bpammo_before = cs_get_user_bpammo(id, weaponid)
  304.  
  305. // Give additional ammo
  306. ExecuteHamB(Ham_GiveAmmo, id, BUYAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
  307.  
  308. // Check whether we actually refilled the weapon's ammo
  309. if (cs_get_user_bpammo(id, weaponid) - bpammo_before > 0)
  310. refilled = true
  311. }
  312. }
  313.  
  314. // Weapons already have full ammo
  315. if (!refilled)
  316. return;
  317.  
  318. // Deduce cost
  319. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  320. zp_ammopacks_set(id, zp_ammopacks_get(id) - get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  321. else
  322. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_buy_ammo_cost_money))
  323.  
  324. // Play clip purchase sound, and notify player
  325. emit_sound(id, CHAN_ITEM, g_sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
  326. zp_colored_print(id, "%L", id, "AMMO_BOUGHT")
  327. }
  328.  
  329. stock fm_cs_set_user_buyzone_offset(id, set = true)
  330. {
  331. // Prevent server crash if entity's private data not initalized
  332. if (pev_valid(id) != PDATA_SAFE)
  333. return false;
  334.  
  335. if (set)
  336. set_pdata_int(id, OFFSET_MAPZONE, get_pdata_int(id, OFFSET_MAPZONE) | PLAYER_IN_BUYZONE)
  337. else
  338. set_pdata_int(id, OFFSET_MAPZONE, get_pdata_int(id, OFFSET_MAPZONE) & ~PLAYER_IN_BUYZONE)
  339. return true;
  340. }


A 147.-ik sorból kivettem a kör eleji üdvözlő szöveget amely minden kör elején megjelenik!
És kaptam 1 ilyen hibát:

" killed "chasper.<56>" with "knife" L 06/12/2013 - 20:18:34: Team "CT" triggered "CTs_Win" (CT "3") (T "7") L 06/12/2013 - 20:18:34: World triggered "Round_End" L 06/12/2013 - 20:18:39: Function is not present (function "task_welcome_msg") (plugin "zp50_buy_zones.amxx") L 06/12/2013 - 20:18:39: [AMXX] Run time 10 (plugin "zp50_buy_zones.amxx") (native "set_task") - debug not enabled! L 06/12/2013 - 20:18:39: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes). L 06/12/2013 - 20:18:39: World triggered "Round_Start"


Valaki tudna benne segíteni?


Üdv!

Debugolni kell a plugint, ha jól tudom. Nekem is volt ilyen hiba, és nekem ez oldotta meg!

Remélem tudtam segíteni.

Üdv.
Anonymous1337

_________________
Ha elnyerte valamelyik témában a hozzászólásom a tetszésedet melyet olvastál, akkor egy egyszerű gombnyomással kifejezheted, hogy tetszett.


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. 20:45 
Offline
Senior Tag

Csatlakozott: 2013.03.26. 18:25
Hozzászólások: 232
Megköszönt másnak: 40 alkalommal
Megköszönték neki: 6 alkalommal
A debug?? :D

_________________
skype:gallzsolt2




Ha segítettem kattints erre:Kép

Kép


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. 20:47 
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
L 06/12/2013 - 20:48:50: [AMXX] Displaying debug trace (plugin "zp50_buy_zones.amxx")
L 06/12/2013 - 20:48:50: [AMXX] Run time error 10: native error (native "get_pcvar_num")
L 06/12/2013 - 20:48:50: [AMXX] [0] 51b8bebc35640.sma::zp_fw_core_cure_post (line 190)
L 06/12/2013 - 20:49:02: Server cvar "sv_restartround" = "1"
L 06/12/2013 - 20:49:02: World triggered "Restart_Round_(1_second)"
L 06/12/2013 - 20:49:02: Team "CT" scored "0" with "1" players
L 06/12/2013 - 20:49:02: Team "TERRORIST" scored "0" with "0" players
L 06/12/2013 - 20:49:02: Server cvar "mp_timelimit" = "40.000000"
L 06/12/2013 - 20:49:02: Server cvar "sv_restartround" = "0"
L 06/12/2013 - 20:49:03: Invalid CVAR pointer
L 06/12/2013 - 20:49:03: [AMXX] Displaying debug trace (plugin "zp50_buy_zones.amxx")
L 06/12/2013 - 20:49:03: [AMXX] Run time error 10: native error (native "get_pcvar_num")
L 06/12/2013 - 20:49:03: [AMXX] [0] 51b8bebc35640.sma::zp_fw_core_cure_post (line 190)
L 06/12/2013 - 20:49:03: World triggered "Round_Start"
L 06/12/2013 - 20:49:05: [ZP] Invalid Player (0)
L 06/12/2013 - 20:49:05: [AMXX] Run time error 10 (plugin "pluginz_plug_apsleader_zp_aps_leader.amxx") (native "zp_get_user_ammo_packs") - debug not enabled!
L 06/12/2013 - 20:49:05: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 06/12/2013 - 20:49:17: Invalid CVAR pointer
L 06/12/2013 - 20:49:17: [AMXX] Displaying debug trace (plugin "zp50_buy_zones.amxx")
L 06/12/2013 - 20:49:17: [AMXX] Run time error 10: native error (native "get_pcvar_num")
L 06/12/2013 - 20:49:17: [AMXX] [0] 51b8bebc35640.sma::zp_fw_core_infect_post (line 204)


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

_________________
[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. 21:23 
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
Anonymous1337 írta:
chasper.cfg írta:
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. // Bots buy ammo automatically
  149. public event_ammo_x(id)
  150. {
  151. if (!is_user_bot(id) || !is_user_alive(id) || zp_core_is_zombie(id))
  152. return;
  153.  
  154. // Get ammo type
  155. new type = read_data(1)
  156.  
  157. // Unknown ammo type
  158. if (type >= sizeof AMMOWEAPON)
  159. return;
  160.  
  161. // Get weapon's id
  162. new weapon = AMMOWEAPON[type]
  163.  
  164. // Primary and secondary only
  165. if (MAXBPAMMO[weapon] <= 2)
  166. return;
  167.  
  168. // Get ammo amount
  169. new amount = read_data(2)
  170.  
  171. if (amount <= BUYAMMO[weapon])
  172. {
  173. // Task needed
  174. remove_task(id)
  175. set_task(0.1, "clcmd_buyammo", id)
  176. }
  177. }
  178.  
  179. // Entity Spawn Forward
  180. public fw_Spawn(entity)
  181. {
  182. // Invalid entity
  183. if (!pev_valid(entity))
  184. return FMRES_IGNORED;
  185.  
  186. // Get classname
  187. new classname[32]
  188. pev(entity, pev_classname, classname, charsmax(classname))
  189.  
  190. // Check whether it needs to be removed
  191. if (equal(classname, CS_BUYZONE_ENT))
  192. {
  193. engfunc(EngFunc_RemoveEntity, entity)
  194. return FMRES_SUPERCEDE;
  195. }
  196.  
  197. return FMRES_IGNORED;
  198. }
  199.  
  200. public zp_fw_core_cure_post(id, attacker)
  201. {
  202. if (get_pcvar_num(cvar_buyzone_humans) && (!LibraryExists(LIBRARY_SURVIVOR, LibType_Library) || !zp_class_survivor_get(id)))
  203. {
  204. // Buyzone time starts when player is set to human
  205. g_BuyTimeStart[id] = get_gametime()
  206. }
  207. else
  208. {
  209. // Buyzone time ends when player is set to human/survivor
  210. g_BuyTimeStart[id] = get_gametime() - get_pcvar_float(cvar_buyzone_time)
  211. }
  212. }
  213.  
  214. public zp_fw_core_infect_post(id, attacker)
  215. {
  216. if (get_pcvar_num(cvar_buyzone_zombies))
  217. {
  218. // Buyzone time starts when player is set to zombie
  219. g_BuyTimeStart[id] = get_gametime()
  220. }
  221. else
  222. {
  223. // Buyzone time ends when player is set to zombie
  224. g_BuyTimeStart[id] = get_gametime() - get_pcvar_float(cvar_buyzone_time)
  225. }
  226. }
  227.  
  228. // Forward Player PreThink
  229. public fw_PlayerPreThink(id)
  230. {
  231. // Not alive
  232. if (!is_user_alive(id))
  233. return;
  234.  
  235. // Enable custom buyzone for player during buytime, unless time expired
  236. if (get_gametime() < g_BuyTimeStart[id] + get_pcvar_float(cvar_buyzone_time))
  237. dllfunc(DLLFunc_Touch, g_BuyzoneEnt, id)
  238. // Remove offset immediately after buyzone time ends (bugfix)
  239. else if (cs_get_user_buyzone(id))
  240. fm_cs_set_user_buyzone_offset(id, false)
  241. }
  242.  
  243. public message_status_icon(msg_id, msg_dest, msg_entity)
  244. {
  245. if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
  246. return;
  247.  
  248. static sprite[10]
  249. get_msg_arg_string(2, sprite, charsmax(sprite))
  250.  
  251. if (!equal(sprite, "buyzone"))
  252. return;
  253.  
  254. if (get_gametime() < g_BuyTimeStart[msg_entity] + get_pcvar_float(cvar_buyzone_time))
  255. return;
  256.  
  257. // Hide buyzone icon after buyzone time is over (bugfix)
  258. set_msg_arg_int(1, get_msg_argtype(1), 0)
  259. }
  260.  
  261. // Buy BP Ammo
  262. public clcmd_buyammo(id)
  263. {
  264. // Setting disabled, player dead or zombie
  265. if (!get_pcvar_num(cvar_buy_ammo_human) || !is_user_alive(id) || zp_core_is_zombie(id))
  266. return;
  267.  
  268. // Player standing in buyzone, allow buying weapon's ammo normally instead
  269. if ((get_gametime() < g_BuyTimeStart[id] + get_pcvar_float(cvar_buyzone_time)) && cs_get_user_buyzone(id))
  270. return;
  271.  
  272. // Not enough money/ammo packs
  273. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  274. {
  275. if (zp_ammopacks_get(id) < get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  276. {
  277. zp_colored_print(id, "%L (%L)", id, "NOT_ENOUGH_AMMO", id, "REQUIRED_AMOUNT", get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  278. return;
  279. }
  280. }
  281. else
  282. {
  283. if (cs_get_user_money(id) < get_pcvar_num(cvar_buy_ammo_cost_money))
  284. {
  285. zp_colored_print(id, "%L (%L)", id, "NOT_ENOUGH_MONEY", id, "REQUIRED_AMOUNT", get_pcvar_num(cvar_buy_ammo_cost_money))
  286. return;
  287. }
  288. }
  289.  
  290. // Get user weapons
  291. new weapons[32], num_weapons, index, weaponid, bpammo_before, refilled
  292. get_user_weapons(id, weapons, num_weapons)
  293.  
  294. // Loop through them and give the right ammo type
  295. for (index = 0; index < num_weapons; index++)
  296. {
  297. // Prevents re-indexing the array
  298. weaponid = weapons[index]
  299.  
  300. // Primary and secondary only
  301. if (MAXBPAMMO[weaponid] > 2)
  302. {
  303. bpammo_before = cs_get_user_bpammo(id, weaponid)
  304.  
  305. // Give additional ammo
  306. ExecuteHamB(Ham_GiveAmmo, id, BUYAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
  307.  
  308. // Check whether we actually refilled the weapon's ammo
  309. if (cs_get_user_bpammo(id, weaponid) - bpammo_before > 0)
  310. refilled = true
  311. }
  312. }
  313.  
  314. // Weapons already have full ammo
  315. if (!refilled)
  316. return;
  317.  
  318. // Deduce cost
  319. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  320. zp_ammopacks_set(id, zp_ammopacks_get(id) - get_pcvar_num(cvar_buy_ammo_cost_ammopacks))
  321. else
  322. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_buy_ammo_cost_money))
  323.  
  324. // Play clip purchase sound, and notify player
  325. emit_sound(id, CHAN_ITEM, g_sound_buyammo, 1.0, ATTN_NORM, 0, PITCH_NORM)
  326. zp_colored_print(id, "%L", id, "AMMO_BOUGHT")
  327. }
  328.  
  329. stock fm_cs_set_user_buyzone_offset(id, set = true)
  330. {
  331. // Prevent server crash if entity's private data not initalized
  332. if (pev_valid(id) != PDATA_SAFE)
  333. return false;
  334.  
  335. if (set)
  336. set_pdata_int(id, OFFSET_MAPZONE, get_pdata_int(id, OFFSET_MAPZONE) | PLAYER_IN_BUYZONE)
  337. else
  338. set_pdata_int(id, OFFSET_MAPZONE, get_pdata_int(id, OFFSET_MAPZONE) & ~PLAYER_IN_BUYZONE)
  339. return true;
  340. }


A 147.-ik sorból kivettem a kör eleji üdvözlő szöveget amely minden kör elején megjelenik!
És kaptam 1 ilyen hibát:

" killed "chasper.<56>" with "knife" L 06/12/2013 - 20:18:34: Team "CT" triggered "CTs_Win" (CT "3") (T "7") L 06/12/2013 - 20:18:34: World triggered "Round_End" L 06/12/2013 - 20:18:39: Function is not present (function "task_welcome_msg") (plugin "zp50_buy_zones.amxx") L 06/12/2013 - 20:18:39: [AMXX] Run time 10 (plugin "zp50_buy_zones.amxx") (native "set_task") - debug not enabled! L 06/12/2013 - 20:18:39: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes). L 06/12/2013 - 20:18:39: World triggered "Round_Start"


Valaki tudna benne segíteni?


Üdv!

Debugolni kell a plugint, ha jól tudom. Nekem is volt ilyen hiba, és nekem ez oldotta meg!

Remélem tudtam segíteni.

Üdv.
Anonymous1337


a debug nem old meg semmilyen hibát csupán megmutatja az okát

_________________
[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. 21:27 
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
L 06/12/2013 - 20:49:03: [AMXX] Displaying debug trace (plugin "zp50_buy_zones.amxx")
L 06/12/2013 - 20:49:03: [AMXX] Run time error 10: native error (native "get_pcvar_num")
L 06/12/2013 - 20:49:03: [AMXX] [0] 51b8bebc35640.sma::zp_fw_core_cure_post (line 190)
L 06/12/2013 - 20:49:03: World triggered "Round_Start"
L 06/12/2013 - 20:49:05: [ZP] Invalid Player (0)
L 06/12/2013 - 20:49:17: Invalid CVAR pointer
L 06/12/2013 - 20:49:17: [AMXX] Displaying debug trace (plugin "zp50_buy_zones.amxx")
L 06/12/2013 - 20:49:17: [AMXX] Run time error 10: native error (native "get_pcvar_num")
L 06/12/2013 - 20:49:17: [AMXX] [0] 51b8bebc35640.sma::zp_fw_core_infect_post (line 204)


De ezzel mitévő legyek ? :/ Nem fog fagyást okozni?

_________________
[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. 21:32 
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
elküldöd a teljes kódot mielőtt megbuzeráltad volna? és írd le h mit akarsz benne átírni

_________________
[img]semmi[/img]


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 ]  Oldal 1 2 Következő


Ki van itt

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