• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Why this error? ._. HALP PL0X LoL

Luciano

Member
Joined
Feb 18, 2010
Messages
998
Reaction score
24
Code:
local breakChance = 0
local rustyItems = {
[9927] = {2128}, --rich helmet
[8879] = {8880}, --rich armor
[9928] = {9777}, --rich legs
[6391] = {6391}, --rich shield
[7892] = {7893}, --rich boots
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if rustyItems[itemEx.itemid] ~= nil then
doRemoveItem(itemEx.uid)
else
local newId = rustyItems[itemEx.itemid][math.random(#rustyItems[itemEx.itemid])]
doTransformItem(itemEx.uid,newId)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You upgraded your armor too"..getItemNameById(newId))
end
doRemoveItem(item.uid)
return TRUE
end
return FALSE
end

Error in console:
Code:
[26/03/2010 20:00:21] data/actions/scripts/rustremover.lua:22: '<eof>' expected near 'end'


Basicly it is rust remover.
Made to change X iten in Y item.
Why error? ._.
 
edit this from your script:
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if rustyItems[itemEx.itemid] ~= nil then
doRemoveItem(itemEx.uid)
else
local newId = rustyItems[itemEx.itemid][math.random(#rustyItems[itemEx.itemid])]
doTransformItem(itemEx.uid,newId)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You upgraded your armor too"..getItemNameById(newId))
end
doRemoveItem(item.uid)
return TRUE
end
return FALSE
end


To this
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if rustyItems[itemEx.itemid] ~= nil then
        if math.random(100) <= breakChance then
            doRemoveItem(itemEx.uid)
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You broke it.")
        else
            local newId = rustyItems[itemEx.itemid][math.random(#rustyItems[itemEx.itemid])]
            doTransformItem(itemEx.uid,newId)
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You removed the rust, revealing a "..getItemNameById(newId))
        end
        doRemoveItem(item.uid,1)
        return TRUE
    end
    return FALSE
end

Forgot to add
LUA:
local breakChance = 10

Add this^ on top of you'r script.
 
Last edited:
[26/03/2010 21:40:05] [Error - Action Interface]
[26/03/2010 21:40:05] data/actions/scripts/rustremover.lua:onUse
[26/03/2010 21:40:05] Description:
[26/03/2010 21:40:05] data/actions/scripts/rustremover.lua:12: attempt to get length of field '?' (a nil value)
[26/03/2010 21:40:05] stack traceback:
[26/03/2010 21:40:05] data/actions/scripts/rustremover.lua:12: in function <data/actions/scripts/rustremover.lua:1>


im working with him. added that to server and it removes the item when u use the rust remover, Just it doesnt Give you anything, and doesnt remove the rust remover after use help?
 
Code:
local rustyItems = {
	[9927] = {2128}, --rich helmet
	[8879] = {8880}, --rich armor
	[9928] = {9777}, --rich legs
	[6391] = {6391}, --rich shield
	[7892] = {7893}, --rich boots
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local i = rustyItems[itemEx.itemid]
	if i then
		local newId = i[math.random(#i)]
		doTransformItem(itemEx.uid, newId)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You upgraded your armor to " .. getItemNameById(newId) .. ".")
		doRemoveItem(item.uid, 1)
		return true
	end
end
 
Code:
[26/03/2010 21:40:05] [Error - Action Interface] 
[26/03/2010 21:40:05] data/actions/scripts/rustremover.lua nUse
[26/03/2010 21:40:05] Description: 
[26/03/2010 21:40:05] data/actions/scripts/rustremover.lua:12: attempt to get length of field '?' (a nil value)
[26/03/2010 21:40:05] stack traceback:
[26/03/2010 21:40:05] 	data/actions/scripts/rustremover.lua:12: in function <data/actions/scripts/
 
Back
Top