debug

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
garbiz
Jau po truputį tampa savu
Posts: 156
Joined: 2015 Feb 01 18:15
Skype: babuinas9

debug

Post by garbiz »

Sveiki, pluginą pasitvarkiau - viskas veikia bet debuginant gaunu errorą, gal yra minčių kaip išspęst ? Googlinau bet nelabai ką radau

L 01/23/2019 - 16:18:47: [CSTRIKE] Non-player entity -1 out of range
L 01/23/2019 - 16:18:47: [AMXX] Displaying debug trace (plugin "csgoevent.amxx", version "1.0")
L 01/23/2019 - 16:18:47: [AMXX] Run time error 10: native error (native "cs_get_weapon_ammo")
L 01/23/2019 - 16:18:47: [AMXX] [0] csgoevent.sma::fwdPlayerCmdStart (line 47)
L 01/23/2019 - 16:30:52: Start of error session.

Code: Select all

public fwdPlayerCmdStart(id, iUc, iRandom){    if(g_bIsDeagleRound)    {           cs_set_user_bpammo(id, CSW_DEAGLE, 1)                if(is_user_alive(id) && get_user_weapon(id) == CSW_DEAGLE && cs_get_weapon_ammo(get_pdata_cbase(id, 373)) > 1)            cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_deagle", id), 1)    } }
47eilutė

Code: Select all

if(is_user_alive(id) && get_user_weapon(id) == CSW_DEAGLE && cs_get_weapon_ammo(get_pdata_cbase(id, 373)) > 1)
Image

User avatar
psychical
Viršininkas
Posts: 2094
Joined: 2011 Mar 12 22:19
Skype: tautvydas11
Location: Linksmakalnis
Contact:

Re: debug

Post by psychical »

Code: Select all

public fwdPlayerCmdStart(id, iUc, iRandom){   if(!is_user_connected(id))      return;     if(g_bIsDeagleRound)    {          cs_set_user_bpammo(id, CSW_DEAGLE, 1)               if(is_user_alive(id) && get_user_weapon(id) == CSW_DEAGLE && cs_get_weapon_ammo(get_pdata_cbase(id, 373)) > 1)            cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_deagle", id), 1)    } }

garbiz
Jau po truputį tampa savu
Posts: 156
Joined: 2015 Feb 01 18:15
Skype: babuinas9

Re: debug

Post by garbiz »

psychical wrote:

Code: Select all

public fwdPlayerCmdStart(id, iUc, iRandom){   if(!is_user_connected(id))      return;     if(g_bIsDeagleRound)    {          cs_set_user_bpammo(id, CSW_DEAGLE, 1)               if(is_user_alive(id) && get_user_weapon(id) == CSW_DEAGLE && cs_get_weapon_ammo(get_pdata_cbase(id, 373)) > 1)            cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_deagle", id), 1)    } }
Dėkui, bet Nepadėjo
Image

User avatar
psychical
Viršininkas
Posts: 2094
Joined: 2011 Mar 12 22:19
Skype: tautvydas11
Location: Linksmakalnis
Contact:

Re: debug

Post by psychical »

Tuomet, spėsiu, kad klaida yra ne su žaidėjo ID, o su ginklo ID, bet tingiu gilintis ir teks sprendimo ieško pačiam.

cs_get_weapon_ammo(get_pdata_cbase(id, 373))

garbiz
Jau po truputį tampa savu
Posts: 156
Joined: 2015 Feb 01 18:15
Skype: babuinas9

Re: debug

Post by garbiz »

Dėkui, bandysiuos
Image

User avatar
psychical
Viršininkas
Posts: 2094
Joined: 2011 Mar 12 22:19
Skype: tautvydas11
Location: Linksmakalnis
Contact:

Re: debug

Post by psychical »

Code: Select all

public fwdPlayerCmdStart(id, iUc, iRandom){    if(!is_user_connected(id))        return;        if(g_bIsDeagleRound)    {          cs_set_user_bpammo(id, CSW_DEAGLE, 1);               if(!is_user_alive(id))            return;                    if(get_user_weapon(id) != CSW_DEAGLE)            return;                    if(cs_get_weapon_ammo(get_pdata_cbase(id, 373)) > 1)            cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_deagle", id), 1);    }}
Jei pasirašytum kodą taip, matytum kurio vietoje tiksliai yra klaida, nes visi klausimai sudėlioti skirtingose eilutėse....

garbiz
Jau po truputį tampa savu
Posts: 156
Joined: 2015 Feb 01 18:15
Skype: babuinas9

Re: debug

Post by garbiz »

Tikslią klaidą išmeta čia

Code: Select all

if(cs_get_weapon_ammo(get_pdata_cbase(id, 373)) > 1)
Image

User avatar
psychical
Viršininkas
Posts: 2094
Joined: 2011 Mar 12 22:19
Skype: tautvydas11
Location: Linksmakalnis
Contact:

Re: debug

Post by psychical »

Code: Select all

public fwdPlayerCmdStart(id, iUc, iRandom){    if(!is_user_connected(id))        return;       if(g_bIsDeagleRound)    {          cs_set_user_bpammo(id, CSW_DEAGLE, 1);               if(!is_user_alive(id))            return;                   if(get_user_weapon(id) != CSW_DEAGLE)            return;                   new wIndex = get_pdata_cbase(id, 373);                if(wIndex <= 0)            return;                    if(cs_get_weapon_ammo(wIndex) > 1)            cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_deagle", id), 1);    }}
Pagal error'ą reiškia, kad ginklo ID -1, nu tai tikrink ar ginklo ID yra > 0 ir tada tik žiūrėk ar yra ammo

garbiz
Jau po truputį tampa savu
Posts: 156
Joined: 2015 Feb 01 18:15
Skype: babuinas9

Re: debug

Post by garbiz »

Sveikas, dėkui, erroro lyg ir nebemeta +rep :happy:
Image

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 7 guests