• Object doesn't exist, but if statement still lets it pass.
    0 replies, posted
[lua] local item = POINTSHOP.FindItemByID(item_id) evolve:Notify( LocalPlayer(), evolve.colors.red, tostring( item.TYPE ) ) if item then if item.Model then if item.TYPE == MODEL then --all the other stuff [/lua] So I'm trying to get item.TYPE and check if it's MODEL, HAT, WEAPON, etc.... But when I go to print the item.TYPE it returns nil. When I go to do a check if item.TYPE == MODEL it thinks that is a true statement. But it just a second ago said item.TYPE == nil. By this logic it's saying nil == MODEL... Could this be happening because it thinks MODEL is a variable and since I never stated MODEL as a variable, MODEL is nil? O_O I'm so confused. This is the general structure of one item [lua] Afro = { Name = "Afro", Enabled = true, Description = "Gives you a hip afro.", Cost = 2000, TYPE = HAT, Model = "models/dav0r/hoverball.mdl", Functions = { -- All the functions and such [/lua] [editline]20th June 2012[/editline] My guess was right, I changed it all to a string and it worked... lol
Sorry, you need to Log In to post a reply to this thread.