function I4800279_GiftBag(MapID, InstanceID, TypeID, TargetID) --??ID, ????TypeID,??,??,????,log??????? local r = math.random(4000) local temp = 0 local index = 1 local tbl = {} tbl[1] = {3100274,5,6,500} for i = 1,#tbl do temp = temp + tbl[i][4] if temp >= r then index = i break end end role.AddRoleItem(MapID, InstanceID, TargetID, tbl[index][1], tbl[index][2], tbl[index][3], 8, 35) end function I4800279_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --???????????? local FreeSize = role.GetBagFreeSize(TargetID) if(FreeSize < 1) then --?????????? bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(4800279, 1, "I4800279_GiftBag") aux.RegisterItemEvent(4800279, 0, "I4800279_CanUseGiftBag")