cs_set_weapon_ammo

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
xedga
Jau po truputį tampa savu
Posts: 154
Joined: 2010 Sep 24 20:12
Skype: xedga-beribu
Location: Šiauliai/Kaunas

cs_set_weapon_ammo

Post by xedga »

Na va mėto toki error ir nesuprantu kodėl, todėl prašau jūsų pagalbos.

Code: Select all

L 04/05/2012 - 20:54:04: [AMXX] Displaying debug trace (plugin "xxx.amxx")L 04/05/2012 - 20:54:04: [AMXX] Run time error 10: native error (native "cs_set_weapon_ammo")L 04/05/2012 - 20:54:04: [AMXX]    [0] xxx.sma::duel_guns (line 2158)
O čia ta kodo dalis:

Code: Select all

        strip_user_weapons(id)        g_DuelA = id        gun = give_item(id, _Duel[g_Duel - 4][_entname])        cs_set_weapon_ammo(gun, 1) // 2158 eilute        set_user_health(id, 100)        player_glow(id, g_Colors[3])

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: cs_set_weapon_ammo

Post by aaarnas »

Turėtų šiaip gerai būti, atrodo. Patikrink ar gun nėra 0.
Palikau CS pasaulį ;/ . Nebepasiekiamas.

xedga
Jau po truputį tampa savu
Posts: 154
Joined: 2010 Sep 24 20:12
Skype: xedga-beribu
Location: Šiauliai/Kaunas

Re: cs_set_weapon_ammo

Post by xedga »

Code: Select all

public duel_guns(id, menu, item){    if(item == MENU_EXIT || g_PlayerLast != id)    {        menu_destroy(menu)        g_LastDenied = 0        g_Duel = 0        return PLUGIN_HANDLED    }            static gun, dst[32], data[5], access, callback, option[128], player, src[32]        menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)    get_user_name(id, src, charsmax(src))    player = str_to_num(data)    formatex(option, charsmax(option), "%L^n%L", LANG_SERVER, _Duel[g_Duel - 4][_sel], src, LANG_SERVER, "MENU_DUEL_SEL", src, dst)    emit_sound(0, CHAN_AUTO, "lol.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)    player_hudmessage(0, 6, 3.0, {0, 255, 0}, option)                    switch (_Duel[g_Duel - 4][_csw])    {        case  CSW_M249:        {            g_DuelA = id            player_strip_weapons(id)            gun = give_item(id, _Duel[g_Duel - 4][_entname])            cs_set_weapon_ammo(gun, 2000)            cs_set_user_bpammo(id,CSW_M249,0)            set_user_health(id, 2000)            entity_set_int(id, EV_INT_body, 4)            player_glow(id, g_Colors[3])                                    g_DuelB = player            player_strip_weapons(player)            gun = give_item(player, _Duel[g_Duel - 4][_entname])            cs_set_weapon_ammo(gun, 2000)            set_user_health(player, 2000)            cs_set_user_bpammo(player,CSW_M249,0)            entity_set_int(player, EV_INT_body, 4)            player_glow(player, g_Colors[2])        }                case  CSW_FLASHBANG:        {            g_DuelA = id            player_strip_weapons(id)            gun = give_item(id, _Duel[g_Duel - 4][_entname])            cs_set_weapon_ammo(gun, 1)            set_user_health(id, 2000)            entity_set_int(id, EV_INT_body, 4)            player_glow(id, g_Colors[3])                        current_weapon_fl(id)                        g_DuelB = player            player_strip_weapons(player)            gun = give_item(player, _Duel[g_Duel - 4][_entname])            cs_set_weapon_ammo(gun, 1)            set_user_health(player, 2000)            entity_set_int(player, EV_INT_body, 4)            player_glow(player, g_Colors[2])            current_weapon_fl(player)        }                                default:    {        strip_user_weapons(id)        g_DuelA = id        gun = give_item(id, _Duel[g_Duel - 4][_entname])        cs_set_weapon_ammo(gun, 1) //2158        set_user_health(id, 100)        player_glow(id, g_Colors[3])                g_DuelB = player        strip_user_weapons(player)        gun = give_item(player, _Duel[g_Duel - 4][_entname])        cs_set_weapon_ammo(gun, 1)        set_user_health(player, 100)        player_glow(player, g_Colors[2])    }}    server_cmd("lol")    return PLUGIN_HANDLED}
Na va visa bloka pateikiu, nes nerandu klaidos, viskas atrodo kaip ir gerai...

User avatar
beast
AMX Mod X ekspertai
Posts: 509
Joined: 2011 Jan 08 18:44
Skype: thefurious4
Contact:

Re: cs_set_weapon_ammo

Post by beast »

Taigi sakė tau patikrint ar gun nelygus 0.

Po kiekvienos eilutės

Code: Select all

gun = give_item(id, _Duel[g_Duel - 4][_entname])
tikrink

Code: Select all

if(gun)    cs_set_weapon_ammo(gun, 1)
Last edited by beast on 2012 May 06 15:05, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests