Problem z extra itemami
Ariovsky
21.11.2018
Wgrałem na serwer extra itemy dla ludzi takie jak:
zp_extra_human_armor_v3.amxx ; armor zp_extra_lasermine.amxx ; laser mine zp_no_recoil.amxx ; no-recoil zp_extra_unlimited_clip.amxx ; nieskonczonsc ammo zp_virus.amxx ; t-virus zp_extra_sandbags.amxx ; worki z piaskiem zp43_pipebomb.amxx ; pipe bomb zp_extra_bazooka.amxx ; bazooka
to jest wycinek z plugins-zplague.ini niby jest wszystko ok, ale jak ktoś kupi jakikolwiek item z tej listy to nie zabierze mu nic AP jedynie pipe bomb działa normalnie, jak ktoś kupi to zabiera AP a w przypadku reszty jest cena podana, ale gracz obojętnie co kupi to i tak AP będzie miał tyle samo.
zp_extraitems.ini
; ---------------------------------- ; Zombie Plague 4.3 Extra Items File ; ---------------------------------- ; Any changes you make here will be ; automatically loaded at map start ; This file will be automatically updated with new ; editable entries as you install new custom items. [Bazooka] NAME = Bazooka COST = 30 TEAMS = HUMAN [15 Sandbags] NAME = 15 Sandbags COST = 15 TEAMS = HUMAN [Anti-Infection Armor] NAME = Anti-Infection Armor COST = 5 TEAMS = HUMAN [T-Virus] NAME = T-Virus COST = 12 TEAMS = HUMAN [No Recoil (Single Round)] NAME = No Recoil (Single Round) COST = 10 TEAMS = HUMAN [Unlimited Clip (single round)] NAME = Unlimited Clip (single round) COST = 15 TEAMS = HUMAN [Laserowa Mina] NAME = Laserowa Mina COST = 7 TEAMS = HUMAN [Pipe Bomb] NAME = Pipe Bomb COST = 20 TEAMS = HUMAN [LaserMines] NAME = LaserMines COST = 8 TEAMS = HUMAN
W zalaczniku dałem pipe bomb, która działa jako jedyna i bazooke, jeśli trzeba mogę reszte dać lub jakieś inne rzeczy.
Attached Files
koloseum
21.11.2018
Jak pobierałes te pluginy/extra itemy to wgrywałeś od razu na serwer je? Spróbuj skompilowac lokalnie i wgraj
Robiin
21.11.2018
Jak pobierałes te pluginy/extra itemy to wgrywałeś od razu na serwer je? Spróbuj skompilowac lokalnie i wgraj
Z tego co się orientuję to alliedy (bo domyślam się, że stamtąd zostały ściągnięte pliki) mają dedykowany plug na forum, który kompiluje plik sma na amxx i wstawia do posta (tak jak mamy tutaj). Tym samym nie ma sensu rekompilacja, żeby coś się "naprawiło". Jeśli działa ogółem, to nie ma znaczenia rekompilacja.
Autorowi tematu polecam przy kupnie (forward zp_extra_item_selected) dodać:
- Przed dodaniem extra itemu
log_amx("Extra item PRE: %i", zp_get_user_ammo_packs(id));
- Po dodaniu extra itemu (chociażby w głupim tasku, chociaż najczęściej extra itemy z forwardu zp_extra_item_selected przechodzą do odosobnionej funkcji nadającej dany item):
log_amx("Extra item POST: %i", zp_get_user_ammo_packs(id));
I pokazać logi z konsoli serwera. Wtedy będziemy wiedzieli czy kupno zabiera ap. Domyślnie nie trzeba tego robić w kazdym pluginie z osobna (a przynajmniej nie w 4.3), potwierdza to ta część kodu:
// Ignore item's cost? if (!ignorecost) { // Check that we have enough ammo packs if (g_ammopacks[id] < ArrayGetCell(g_extraitem_cost, itemid)) { zp_colored_print(id, "%L", id, "NOT_ENOUGH_AMMO") return; } // Deduce item cost g_ammopacks[id] -= ArrayGetCell(g_extraitem_cost, itemid) }
pobrana z głównego silnika zp v4.3.
Edited by aSiorr, 21.11.2018 20:32.
Ariovsky
22.11.2018
Można troche jaśniej? bo ja tak średnio wiem co mam zrobić czy to chodzi o plik zombieplague.inc? bo jeśli tak to w nim mam takie coś:
/** * Called when a player buys an extra item from the ZP menu. * * Note: You can now return ZP_PLUGIN_HANDLED in your plugin to block * the purchase and the player will be automatically refunded. * * @param id Player index of purchaser. * @param itemid Internal extra item ID. */ forward zp_extra_item_selected(id, itemid)
Ariovsky
22.11.2018
logi z konsoli:
L 11/22/2018 - 21:30:22: [AMXX] Run time error 10 (plugin "zombie_plague40.amxx") (native "ArrayGetString") - debug not enabled! L 11/22/2018 - 21:30:22: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes). L 11/22/2018 - 21:30:23: [zp_extra_human_armor_v3.amxx] Extra item PRE: 0 L 11/22/2018 - 21:30:23: [zp_extra_human_armor_v3.amxx] Extra item PRE: 0 L 11/22/2018 - 21:30:23: [zp_extra_human_armor_v3.amxx] Extra item PRE: 0 L 11/22/2018 - 21:30:23: [zp_extra_bazooka.amxx] Extra item PRE: 0 L 11/22/2018 - 21:30:24: [zp_extra_human_armor_v3.amxx] Extra item PRE: 0 L 11/22/2018 - 21:30:24: [zp_extra_human_armor_v3.amxx] Extra item PRE: 0 L 11/22/2018 - 21:30:24: [zp_extra_bazooka.amxx] Extra item PRE: 0 L 11/22/2018 - 21:30:24: [zp_extra_human_armor_v3.amxx] Extra item PRE: 0 L 11/22/2018 - 21:30:24: [zp_extra_human_armor_v3.amxx] Extra item PRE: 0 L 11/22/2018 - 21:30:24: [zp_extra_bazooka.amxx] Extra item PRE: 0
Nie wiem czy do końca o to chodziło, ale zrobiłem coś takiego w przypadku armora
pobrałem go stąd: https://amxx.pl/topi...human-armor-v3/
i wpisałem cos takiego:
// Human buys our upgrade, give him some armor public zp_extra_item_selected(player, itemid) { if (itemid == g_itemid_humanarmor) { log_amx("Extra item PRE: %i", zp_get_user_ammo_packs(player)); set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue)+g_armor_amount, g_armor_limit))) log_amx("Extra item PRE: %i", zp_get_user_ammo_packs(player)); engfunc(EngFunc_EmitSound, player, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM) //set_view(player, CAMERA_3RDPERSON) if(Ent[player] < 1) { Ent[player] = create_entity("info_target") if(is_valid_ent(Ent[player])) { entity_set_model(Ent[player], g_Santa) entity_set_int(Ent[player], EV_INT_movetype, MOVETYPE_FOLLOW) entity_set_edict(Ent[player], EV_ENT_aiment, player) } } } }
zamieniłem id na player bo jak było id nie chciało skompilować, a jak to public public zp_extra_item_selected(player, itemid) zmieniałem na takie public zp_extra_item_selected(player, itemid, id) to tez byl error jakis.
Robiin
26.11.2018
Włącz debug silnika (zombie_plague40.amxx) i podaj log, który wyskoczy (najprawdopodobniej przy kupnie extra itemu).
Ariovsky
27.11.2018
Dodałem debug i teraz jest takie coś:
L 11/27/2018 - 16:00:55: "Ariovsky<1><STEAM_0:1:2692860><>" joined team "CT" L 11/27/2018 - 16:00:56: [zp_extra_human_armor_v3.amxx] Extra item PRE: 0 L 11/27/2018 - 16:00:56: [zp_extra_human_armor_v3.amxx] Extra item PRE: 0 L 11/27/2018 - 16:00:56: Invalid cellvector handle provided (66:0:0) L 11/27/2018 - 16:00:56: [AMXX] Displaying debug trace (plugin "zombie_plague_advance_v1-6-1.amxx") L 11/27/2018 - 16:00:56: [AMXX] Run time error 10: native error (native "ArrayGetString") L 11/27/2018 - 16:00:56: [AMXX] [0] zombie_plague_advance_v1-6-1.sma::lighting_effects (line 9564)