• 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!

Does this LUA-script work? (I don't got a server, to lazy)

lizz

Good Mapper
Joined
May 24, 2009
Messages
38
Reaction score
0
Location
Sweden, Oregrund
Hello, I wanna know if this script works. I'm really not sure. Please answer me fast there's so many good scripters here so someone could help me? :$

function onUse(cid, item, fromposition, itemex, toposition)
if item.itemid == 1945 then
doplayersendtextmessage(cid,20,"Cheer's you got a bag.")
docreatureadditem(item.uid,item.itemid 2000)
dotransformitem(item.uid,item.itemid 1946)
elseif item.itemid == 1946
doplayersendtextmessage(cid,21,"Cheer's you got a bag.")
docreatureadditem(item.uid,item.itemid 2000)
dotransformitem(item.uid,item.itemid 1946)
end
return TRUE
end
That should add a item by ID 2000 shouldn't it?:huh:
 
first, all those horrible lowercases, all functions will be nil

second, 'docreatureadditem' doesnt exist 'doPlayerAddItem?'

third, missing (,) separation: "docreatureadditem(item.uid,item.itemid 2000)"

4th, docreatureadditem(item.uid,item.itemid 2000) :eek: 2000 #itams??
 
Last edited:
Lua:
t = {
    [1945] = {msg = 20},
    [1946] = {msg = 21}
    }

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if t[item.itemid] then
        doPlayerSendTextMessage(cid, t[item.itemid].msg, "Cheer's you got a bag.")
        doPlayerAddItem(cid, 2000, 1)        
        doTransformItem(item.uid, 1946)
    end
return TRUE
end
 
local t

It does[?] make a difference

Also,
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doPlayerSendTextMessage(cid, item.itemid == 1945 and 20 or 21, "Cheers, you got a bag!")
	doPlayerAddItem(cid, 2000, 1)     
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
because the table was unnecessary
 
nope, it's just my style (i don't make it for lag concern, which isn't noticed)
 

Similar threads

Back
Top Bottom