Grimaexreaper Posted February 29, 2012 Share Posted February 29, 2012 in debug 3 to check my code error i get this ERROR: shopfolder\c_generalshop_system.lua:342:attempt to get length of upvalue 'availableskins' (a nill value) now i will post the shop system script also my account system folder has all the pics also so i have no idea why its doing this i have never heard of a upvalue before so heres the codes wGeneralshop, iClothesPreview = nil items = nil tGShopItemTypeTab = {} gGShopItemTypeGrid = {} gcGShopItemTypeColumnName = {} gcGShopItemTypeColumnDesc = {} gcGShopItemTypeColumnPrice = {} grGShopItemTypeRow = {{ },{}} --- clothe shop skins blackMales = {7, 14, 15, 16, 17, 18, 20, 21, 22, 24, 25, 28, 35, 36, 50, 51, 66, 67, 78, 79, 80, 83, 84, 102, 103, 104, 105, 106, 107, 134, 136, 142, 143, 144, 156, 163, 166, 168, 176, 180, 182, 183, 185, 220, 221, 222, 249, 253, 260, 262, 269, 270 } whiteMales = {1, 2, 23, 26, 27, 29, 30, 32, 33, 34, 35, 36, 37, 38, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 58, 59, 60, 61, 62, 68, 70, 72, 73, 78, 81, 82, 94, 95, 96, 97, 98, 99, 100, 101, 108, 109, 110, 111, 112, 113, 114, 115, 116, 120, 121, 122, 124, 125, 126, 127, 128, 132, 133, 135, 137, 146, 147, 153, 154, 155, 158, 159, 160, 161, 162, 164, 165, 170, 171, 173, 174, 175, 177, 179, 181, 184, 186, 187, 188, 189, 200, 202, 204, 206, 209, 212, 213, 217, 223, 230, 234, 235, 236, 240, 241, 242, 247, 248, 250, 252, 254, 255, 258, 259, 261, 264 } asianMales = {49, 57, 58, 59, 60, 117, 118, 120, 121, 122, 123, 170, 186, 187, 203, 210, 227, 228, 229} blackFemales = {9, 10, 11, 12, 13, 40, 41, 63, 64, 69, 76, 91, 139, 148, 190, 195, 207, 215, 218, 219, 238, 243, 244, 245, 256 } whiteFemales = {12, 31, 38, 39, 40, 41, 53, 54, 55, 56, 64, 75, 77, 85, 86, 87, 88, 89, 90, 91, 92, 93, 129, 130, 131, 138, 140, 145, 150, 151, 152, 157, 172, 178, 192, 193, 194, 196, 197, 198, 199, 201, 205, 211, 214, 216, 224, 225, 226, 231, 232, 233, 237, 243, 246, 251, 257, 263 } asianFemales = {38, 53, 54, 55, 56, 88, 141, 169, 178, 224, 225, 226, 263} local fittingskins = {[0] = {[0] = blackMales, [1] = whiteMales, [2] = asianMales}, [1] = {[0] = blackFemales, [1] = whiteFemales, [2] = asianFemales}} local availableskins = {} -- these are all the skins skins = { 1, 2, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 184, 185, 186, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 263, 264, 269, 270, 272, 292, 295, 298, 299, 300 } function resourceStart(res) guiSetInputEnabled(false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), resourceStart) function getDiscountedPrice(price, isweapon, id) if not isweapon and id ~= 68 then if exports.global:cisPlayerPearlDonator(getLocalPlayer()) then return math.ceil( 0.5 * price ) elseif exports.global:cisPlayerSilverDonator(getLocalPlayer()) then return math.ceil( 0.75 * price ) end end return price end function showGeneralshopUI(shop_type, race, gender) if (wGeneralshop==nil) then -- Shop Tooltip if(getResourceFromName("tooltips-system"))then triggerEvent("tooltips:showHelp",getLocalPlayer(),5) end setElementData(getLocalPlayer(), "exclusiveGUI", true, false) local screenwidth, screenheight = guiGetScreenSize () local Width = 500 local Height = 350 local X = (screenwidth - Width)/2 local Y = (screenheight - Height)/2 local shopTypeName = getShopTypeName(shop_type) local ShopTabTitles = getShopTabTitles(shop_type) local imageName = getImageName(shop_type) local introMessage = getIntroMessage(shop_type) wGeneralshop = guiCreateWindow ( X , Y , Width , Height , shopTypeName, false ) lInstruction = guiCreateLabel ( 0, 20, 500, 15, "Double click on an item to buy it.", false, wGeneralshop ) guiLabelSetHorizontalAlign ( lInstruction,"center" ) lIntro = guiCreateLabel ( 0, 40, 500, 15,introMessage, false, wGeneralshop ) guiLabelSetHorizontalAlign ( lIntro,"center" ) guiBringToFront (lIntro) guiSetFont ( lIntro, "default-bold-small" ) iImage = guiCreateStaticImage ( 400, 20, 90, 80,"images/"..imageName, false,wGeneralshop ) tGShopItemType = guiCreateTabPanel ( 15, 60, 470, 240, false,wGeneralshop ) items = getItemsForSale(shop_type, race, gender) -- loop through each heading for i = 1, #ShopTabTitles do tGShopItemTypeTab[i] = guiCreateTab (ShopTabTitles[i], tGShopItemType) gGShopItemTypeGrid[i] = guiCreateGridList ( 0.02, 0.05, 0.96, 0.9, true, tGShopItemTypeTab[i]) gcGShopItemTypeColumnName[i] = guiGridListAddColumn (gGShopItemTypeGrid[i],"Name", 0.25) gcGShopItemTypeColumnPrice[i] = guiGridListAddColumn (gGShopItemTypeGrid[i] ,"Price", 0.1) gcGShopItemTypeColumnDesc[i] = guiGridListAddColumn (gGShopItemTypeGrid[i] ,"Description", 0.62) for y = 1, #items do if(items[y][6] == i) then grGShopItemTypeRow[i][y] = guiGridListAddRow (gGShopItemTypeGrid[i] ) guiGridListSetItemText ( gGShopItemTypeGrid[i] , grGShopItemTypeRow[i][y] , gcGShopItemTypeColumnName[i] ,items[y][1], false, false ) guiGridListSetItemText ( gGShopItemTypeGrid[i] , grGShopItemTypeRow[i][y] ,gcGShopItemTypeColumnPrice[i], "$"..getDiscountedPrice(items[y][3], items[y][7], items[y][4]), false, false ) guiGridListSetItemText ( gGShopItemTypeGrid[i] , grGShopItemTypeRow[i][y], gcGShopItemTypeColumnDesc[i] ,items[y][2], false, false) end end end guiSetInputEnabled(true) guiSetVisible(wGeneralshop, true) bClose = guiCreateButton(200, 315, 100, 25, "Close", false, wGeneralshop) addEventHandler("onClientGUIClick", bClose, hideGeneralshopUI) addEventHandler("onClientGUIDoubleClick", getRootElement(), getShopSelectedItem) -- if player has clicked to see a skin preview addEventHandler ( "onClientGUIClick", getRootElement(), function (button, state) if(button == "left") then if(iClothesPreview) then destroyElement(iClothesPreview ) iClothesPreview = nil end if(shop_type == 5) then if(source == gGShopItemTypeGrid[1]) then if(guiGetVisible(wGeneralshop)) then -- get the selected row local row, column = nil local row_temp, column_temp = guiGridListGetSelectedItem ( source ) if((row == nil) and (row_temp)) then row = row_temp column = column_temp local skin = tonumber(availableskins[row+1] ) if(skin<10) then skin = tostring("00"..skin) elseif(skin < 100) then skin = tostring("0"..skin) else skin = tostring(skin) end iClothesPreview = guiCreateStaticImage ( 320, 20, 100, 100, ":accounts-system/img/" .. skin..".png" , false , gGShopItemTypeGrid[1], accountRes) end end end end end end) end end addEvent("showGeneralshopUI", true ) addEventHandler("showGeneralshopUI", getRootElement(), showGeneralshopUI) function hideGeneralshopUI() if (source==bClose) then triggerServerEvent("exitShopMenu", root, localPlayer) setElementData(getLocalPlayer(), "exclusiveGUI", false, false) guiSetInputEnabled(false) showCursor(false) guiSetVisible(wGeneralshop, false) destroyElement(wGeneralshop) wGeneralshop = nil removeEventHandler ("onClientGUIDoubleClick", getRootElement(), getShopSelectedItem ) end end -- function gets the shop name, function getShopTypeName(shop_type) if(shop_type == 1) then return "General Store" elseif(shop_type == 2) then return "Gun and Ammo Store" elseif(shop_type == 3) then return "Food store" elseif(shop_type == 4) then return "Sex Shop" elseif(shop_type == 5) then return "Clothes Shop" elseif(shop_type == 6) then return "Gym" elseif(shop_type == 7) then return "Furniture Store" elseif(shop_type == then return "Electronics Store" elseif(shop_type == 9) then return "Alcohol Store" elseif(shop_type == 10) then return "Book Store" elseif(shop_type == 11) then return "Cafe" elseif(shop_type == 12) then return "Santa's Grotto" elseif(shop_type == 13) then return "Prison Worker" elseif(shop_type == 14) then return "Pizza Stack" elseif(shop_type == 15) then return "Cluckin' Bell" elseif(shop_type == 16) then return "Burger Shot" elseif(shop_type == 17) then return "Trap Spot Dealer" elseif(shop_type == 18) then return "Trap Spot Dealer #2" else return "This isn't a shop. Go Away." end end function getShopTabTitles(shop_type) if(shop_type == 1) then return {"General Items", "Consumable"} elseif(shop_type == 2) then return {"Guns"} elseif(shop_type == 3) then return {"Food","Drink"} elseif(shop_type == 4) then return {"Sexy"} elseif(shop_type == 5) then return {"Clothes"} elseif(shop_type == 6) then return {"Fighting Styles"} elseif(shop_type == 7) then return {"General NPC"} elseif(shop_type == then return {"Electronics"} elseif(shop_type == 9) then return { "Alcohol" } elseif(shop_type == 10) then return { "Books" } elseif(shop_type == 11) then return {"Food","Drink"} elseif(shop_type == 12) then return {"Presents","Free Food & Drink"} elseif(shop_type == 13) then return {"Prison Food", "Prison Drink"} elseif(shop_type == 14) then return "Pizza Stack" elseif(shop_type == 15) then return "Cluckin' Bell" elseif(shop_type == 16) then return "Burger Shot" elseif(shop_type == 17) then return {"Drugs","Guns And Ammo"} elseif(shop_type == 18) then return {"DrugZ","GunZ And Ammo"} Link to comment
Grimaexreaper Posted February 29, 2012 Author Share Posted February 29, 2012 hello any clue of what the problem is? Link to comment
Kenix Posted February 29, 2012 Share Posted February 29, 2012 You have syntax error in script. Link to comment
Grimaexreaper Posted February 29, 2012 Author Share Posted February 29, 2012 Hmm on which line and any idea how to fix it i tryed for a long time but i coulent figure it out i just hate to have to re script a hole new shop system for clothing Link to comment
Grimaexreaper Posted February 29, 2012 Author Share Posted February 29, 2012 i did as you can see in the first post where it says ERROR Link to comment
Kenix Posted March 1, 2012 Share Posted March 1, 2012 Learn viewtopic.php?f=91&t=40809 Link to comment
Grimaexreaper Posted March 2, 2012 Author Share Posted March 2, 2012 Learn viewtopic.php?f=91&t=40809 Good looks homie Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now