Jump to content

Global function giving errors


Hale

Recommended Posts

Hi there lads, so I got some scripts from an old pal, and what it does is that you can put custom textured masks onto your face, and you can edit the X, Y and Z with a GUI, making it much simpler. Sadly, the most important part of the script was compiled, so when I decompiled it, it got messy as hell. Now this below is just a small part of it, and this is the part where I get the error. The script was working fine, but I wanted to add some more masks, and when I edited the other .lua files I got an error in this script, and these were shown in /debugscript mode:

Bad Argument @ 'createObject', expected number at argument 1, got nil.

And after that error it just stacks up more errors because the global of 'createObject' (POSITION_OBJECT) didn't work. I suppose something is wrong with "ITEM_OBJECT = v.objectID" but I have no idea why wouldn't that work... If you need more than this, just reply saying so and I'll put more :)

function wearable_initialize_system(WEARABLE_ITEM) 
  ITEM_ID_NAME = WEARABLE_ITEM 
  for k, v in ipairs(items) do 
    if v.name == WEARABLE_ITEM and legit == 1 and WEARABLE_GENUINE_CHECK then 
      ITEM_ID = v.itemID 
      ITEM_OBJECT = v.objectID 
      POSITION_BONE = v.bone 
      ITEM_DEFAULT = v.default 
      break 
    end 
  end 
  wearable_check_position_exist() 
  POSITION_OBJECT = createObject(ITEM_OBJECT, 0, 0, 0) 
  local _, _, X_ATTACH, Y_ATTACH, Z_ATTACH, RX_ATTACH, RY_ATTACH, RZ_ATTACH = exports.bone_attach:getElementBoneAttachmentDetails(POSITION_OBJECT) 
  exports.bone_attach:attachElementToBone(POSITION_OBJECT, LOCAL_PLAYER, 1, 0, 0, 0, 0, 0, 0) 
  for OFFSET_ADDRESS = 1, NUM_CUBOIDS do 
    local CUB_X, CUB_Y, CUB_Z, CUB_WIDTH, CUB_DEPTH, CUB_HEIGHT = unpack(CUBOID_PARAMETERS) 
    local X_OFF, Y_OFF, Z_OFF = unpack(ATTACH_OFFSETS[OFFSET_ADDRESS]) 
    local CUB_ELEMENT_TEMP = createColCuboid(CUB_X, CUB_Y, CUB_Z, CUB_WIDTH, CUB_DEPTH, CUB_HEIGHT) 
    attachElements(CUB_ELEMENT_TEMP, POSITION_OBJECT, X_OFF, Y_OFF, Z_OFF, RX_ATTACH, RY_ATTACH, RZ_ATTACH) 
    POSITION_DATA.CUBOIDS[OFFSET_ADDRESS] = CUB_ELEMENT_TEMP 
  end 
  addEventHandler("onClientPreRender", getRootElement(), wearable_initialize_lines) 
  setElementDimension(POSITION_OBJECT, getElementDimension(LOCAL_PLAYER)) 
  setElementInterior(POSITION_OBJECT, getElementInterior(LOCAL_PLAYER)) 
end 

Link to comment
 items = { 
  
    {name = "Pig Mask", itemID = 223, objectID = 2374, bone = 1, position = {0, 0, 0, 0, 0, 0, 1}}, 
    {name = "Monster Mask", itemID = 224, objectID = 2396, bone = 1, position = {0, 0, 0, 0, 0, 0, 1}}, 
    {name = "Hockey Mask", itemID = 225, objectID = 2397, bone = 1, position = {0, 0, 0, 0, 0, 0, 1}}, 
    {name = "Monkey Mask", itemID = 226, objectID = 2398, bone = 1, position = {0, 0, 0, 0, 0, 0, 1}}, 
    {name = "Smoking Monkey Mask", itemID = 227, objectID = 2399, bone = 1, position = {0, 0, 0, 0, 0, 0, 1}}, 
    {name = "Carnival Mask", itemID = 228, objectID = 2407, bone = 1, position = {0, 0, 0, 0, 0, 0, 1}}, 
    {name = "Anonymous Mask", itemID = 240, objectID = 953, bone = 1, position = {0, 0, 0, 0, 0, 0, 1}}, 
    {name = "Sun Glasses", itemID = 241, objectID = 1666, bone = 1, position = {0, 0, 0, 0, 0, 0, 1}}, 
    {name = "Bandana (Head)", itemID = 0, objectID = 2377, bone = 1, position = {0, 0, 0, 0, 0, 0, 1}, default = false}, 
    {name = "Bandana (Mask)", itemID = 0, objectID = 2392, bone = 1, position = {0, 0, 0, 0, 0, 0, 1}, default = true}, 
    {name = "Bandana (Knot)", itemID = 0, objectID = 2382, bone = 1, position = {0, 0, 0, 0, 0, 0, 1}, default = false} 
  
}  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...