Witam,
czy ktos jest mi w stanie wytlumaczyc jak pobrac ID lub/i CSW broni ?
Mam taki kod:
#include <amxmodx> #include <cstrike> #include <amxmisc> #include <colorchat> #include <fakemeta> #include <hamsandwich> #include <csgo> #define PLUGIN "My script" #define VERSION "1.0" #define AUTHOR "Pierdolka" #define TAG "CS GO" new const c_WeaponNames[ ][ ] = { "", // 0 "P228", // 1 "", // 2 "Schmidt Scout", // 3 "HE Grenade", // 4 "XM1014", // 5 "C4", // 6 "Mac-10", // 7 "Aug", // 8 "Smoke Grenade", // 9 "Dual Elites", // 10 "Five-SeveN", // 11 "UMP45", // 12 "Sg550", // 13 "GALIL", // 14 "FAMAS", // 15 "USP", // 16 "Glock-18", // 17 "AWP", // 18 "MP5-Navy", // 19 "M249", // 20 "M3", // 21 "M4A1", // 22 "TMP", // 23 "G3SG1", // 24 "Flashbang", // 25 "Desert Eagle", // 26 "SG552", // 27 "AK-47", // 28 "Knife", // 29 "P90" // 30 } new const c_LongWpnName[ ][ ] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90" } public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) for(new i = 1; i < sizeof c_LongWpnName; i++) { if(c_LongWpnName[i][0]) { RegisterHam(Ham_Item_Deploy, c_LongWpnName[i], "OnItemDeployPost", 1) RegisterHam(Ham_CS_Item_CanDrop, c_LongWpnName[i], "OnItemDropPre", 0) } } } public OnItemDropPre(ent) { static owner; owner = fm_cs_get_weapon_ent_owner(ent); if(owner && !pev(ent, pev_iuser2)) set_pev(ent, pev_iuser2, get_user_userid(owner)) } public OnItemDeployPost(ent) { static holder; holder = fm_cs_get_weapon_ent_owner(ent); new iWeapon = cs_get_weapon_id(holder); // linia 105 ColorChat(holder, NORMAL, "Index broni: %s", iWeapon); } fm_cs_get_weapon_ent_owner(ent) { return (pev_valid(ent) != 2) ? 0 : get_pdata_cbase(ent, 41, 4); }
jednak konsola serwera wywala mi taki blad:
L 01/20/2018 - 17:55:20: [AMXX] Run time error 10: native error (native "cs_get_weapon_id") L 01/20/2018 - 17:55:20: [AMXX] [0] myscript.sma::OnItemDeployPost (line 105)
Probowalem juz chyba wszystkiego i nic ... Ciagle cos...
Plugin debuguje poprzez dodanie 'debug' w plugins.ini gdyz kiedy tego nie zrobie to konsola wywala mi blad.
Bardzo proszę o jakakolwiek pomoc za co będę niezmiernie wdzieczny bo siedzie juz nad tym wiele godzin...
Pozdrawiam