What's new
  • logo_cipsoft
    Latest servers:
    New servers will open on: 19th Feb 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

Talkactions Crash fix.

Status
Not open for further replies.

sawex

Advanced User
Joined
Aug 17, 2008
Messages
421
Reaction score
23
Nie wiem ile os?b to zauwa?y?o, ale w silniku 8.54 jest b??d w talkactions/scripts/createitem.lua
Spowodowane jest to jakim? b??dem z jego przechowywaniem w pami?ci aplikacji (Nie chcia?o mi si? kopa? za bardzo w ?r?d?ach). Dok?adniej je?eli item ma skrypt onEquip i onDeEquip, to je?eli stworzymy go przy pomocy komendy /i a item za?o?y si? na nas w sw?j slot (np he?m w miejsce g?owy) nast?pi crash.

Og?lnie swoje createitem.lua zamieni? mo?ecie na:
[LUA]function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return true
end

local t = string.explode(param, ",")
local ret = RETURNVALUE_NOERROR
local pos = getCreaturePosition(cid)

local id = tonumber(t[1])
if(not id) then
id = getItemIdByName(t[1], false)
if(not id) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
return true
end
end

local amount = 100
if(t[2]) then
amount = t[2]
end

if(t[3] and getBooleanFromString(t[3])) then
if(t[4] and getBooleanFromString(t[4])) then
pos = getCreatureLookPosition(cid)
end
local item = doCreateItemEx(id, amount)
ret = doTileAddItemEx(pos, item)
else
ret = doPlayerAddItem(cid, id, amount, false)
end

if(ret ~= RETURNVALUE_NOERROR) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
return true
end

doDecayItem(item)
if(not isPlayerGhost(cid)) then
doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
end

return true
end
[/LUA]
I to za?atwia spraw? przypadkowego crashu.
 

Placek

Blue Waffle
Joined
Sep 30, 2008
Messages
6,793
Reaction score
667
Age
9
Odp: Crash fix.

Ale toz to nie problem tylko wynikajacy z pojawienia sie itemu po uzyciu komendy. Przeciez jak kupujesz np z sms shopu to tez dodaje item i tez czasem sa crashe w niektorych silnikach(nie pamietam jakich, bo to juz dosc dawno ogarnialem, ale bylo to w tfsach od 8.54 do 8.6, moze i dalej). A na to fixa w talkactionie nie zrobisz ;P
Jak ktos chce sobie fixnac komende to jest ok. Ale jak ma ten blad w silniku to takie cos nie wystarczy.
Ot, takie info jak by ktos mial sobie przypadkiem pomyslec, ze wszystkie jego problemy z tworzeniem itemow zostana rozwiazane ;P
 
Last edited:

sawex

Advanced User
Joined
Aug 17, 2008
Messages
421
Reaction score
23
Odp: Crash fix.

Problemem jest dodawanie itemu przez doPlayerAddItemEx.. U mnie na npc nie by?o jeszcze problemu. Jak Ci nie szkoda czasu to ?mia?o poszukaj. Problem jest w tym ?e przy tworzeniu itemu i dodawaniu go do gracza item dodany jest prawid?owo (inventory[index] jest spoko). Natomiast po przeleceniu tam jeszcze paru funkcji w C++ odwo?anie si? do tego slota przez inventory[index] ju? wywala b??d segmentacji.
 
Status
Not open for further replies.
Top