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

onAddItem ... problem with CID

d4rkbl0od

Member
Joined
Mar 21, 2008
Messages
160
Reaction score
7
Code:
function onAddItem(moveitem, tileitem, pos, cid)
local newpos = {x=32791, y=32332, z=10}


if tileitem.uid == 10200 and moveitem.type == 2 then
      doRemoveItem(moveitem.uid, 1)
      doSendMagicEffect(pos,0)
      doTeleportThing(cid, newpos)

	  doCreatureSay(cid, "Muahahahaha...", TALKTYPE_ORANGE_1, false, 0, newpos)
      doSendMagicEffect(newpos,10)
      

end 
return TRUE
end

Well, it was supposed to work.. but it send me errors in console saying that has a nil value at do teleportThing ( probably cid)...
Any ideas? :S
 
0.40a1 (doomed elderberry), Also i looked into the sources :
Code:
uint32_t MoveEvent::executeAddRemItem(Creature* actor, Item* item, Item* tileItem, const Position& pos)
{
	//onAddItem(moveItem, tileItem, position, cid)
	//onRemoveItem(moveItem, tileItem, position, cid)


Is this the way it should be placed?
onAddItem(moveItem, tileItem, position, cid)
 
You should make a little check first,
LUA:
if cid ~= nil and cid > 0 then
should work fine like that
 
Last edited:
You should make a little check first,
LUA:
if cid ~= nil and cid > 0 then
should work fine like that

Going to try it out!
Edit later,

---EDIIT--
Well, now nothing happens, and no console error Oo
when i put this: function onAddItem(moveitem, tileitem, pos, cid)
no console error

and when I put this : function onAddItem(cid, moveitem, tileitem, pos)
It comew with some console errors
 

Attachments

Last edited:
Back
Top