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.
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.