BrianDUTCH Posted September 13, 2014 Posted September 13, 2014 (edited) Hello ! I made a CJ Customize GUI only I want to upgrade it, I need some help with it and I have 1 error but I don't know what the problem is.. The GUI looks like this now: Screenshot The Error = ERROR: CJ/customizeCJ-s.lua:18: attempt to index field '?' (a nil value) The error appears when I press on the save button.. I want to upgrade the following thing: The Editbox will be read only if the buttons < and > works. When I would press on the button > I want that the ID go higher so, 1,2,3,4 etc. and when I press it, it must set my new shirt for example.. button < must go down.. so 4,3,2,1,0 Need more info about the idea please just ask I want to fix it.. it will be a public resource to download on community ! Client function activateMenu ( player, key ) if (mainWindow) then guiSetVisible ( mainWindow, true ) else mainWindow = guiCreateWindow(0, 0, 280, 528, "CJ Customize", false) guiCreateLabel(10, 29, 64, 20, "Torso", false, mainWindow) guiCreateLabel(10, 54, 64, 20, "Hair", false, mainWindow) guiCreateLabel(10, 80, 64, 20, "Legs", false, mainWindow) guiCreateLabel(10, 106, 64, 20, "Shoes", false, mainWindow) guiCreateLabel(10, 132, 89, 20, "Left Upper Arm", false, mainWindow) guiCreateLabel(10, 158, 89, 20, "Left Lower Arm", false, mainWindow) guiCreateLabel(10, 184, 93, 19, "Right Upper Arm", false, mainWindow) guiCreateLabel(10, 208, 93, 19, "Right Lower Arm", false, mainWindow) guiCreateLabel(10, 233, 93, 19, "Back Top", false, mainWindow) guiCreateLabel(10, 258, 93, 19, "Left Chest", false, mainWindow) guiCreateLabel(10, 283, 93, 19, "Right Chest", false, mainWindow) guiCreateLabel(10, 308, 93, 19, "Stomach", false, mainWindow) guiCreateLabel(10, 333, 93, 19, "Lower Back", false, mainWindow) guiCreateLabel(10, 358, 93, 19, "Necklace", false, mainWindow) guiCreateLabel(10, 383, 93, 19, "Watch", false, mainWindow) guiCreateLabel(10, 408, 93, 19, "Glasses", false, mainWindow) guiCreateLabel(10, 433, 93, 19, "Hat", false, mainWindow) guiCreateLabel(10, 458, 93, 19, "Suit", false, mainWindow) button1 = guiCreateButton(154, 29, 24, 19, "<", false, mainWindow) button2 = guiCreateButton(154, 54, 24, 19, "<", false, mainWindow) button3 = guiCreateButton(154, 80, 24, 19, "<", false, mainWindow) button4 = guiCreateButton(154, 106, 24, 19, "<", false, mainWindow) button5 = guiCreateButton(154, 132, 24, 19, "<", false, mainWindow) button6 = guiCreateButton(154, 158, 24, 19, "<", false, mainWindow) button7 = guiCreateButton(154, 184, 24, 19, "<", false, mainWindow) button8 = guiCreateButton(154, 208, 24, 19, "<", false, mainWindow) button9 = guiCreateButton(154, 233, 24, 19, "<", false, mainWindow) button10 = guiCreateButton(154, 258, 24, 19, "<", false, mainWindow) button11 = guiCreateButton(154, 283, 24, 19, "<", false, mainWindow) button12 = guiCreateButton(154, 308, 24, 19, "<", false, mainWindow) button13 = guiCreateButton(154, 333, 24, 19, "<", false, mainWindow) button14 = guiCreateButton(154, 358, 24, 19, "<", false, mainWindow) button15 = guiCreateButton(154, 383, 24, 19, "<", false, mainWindow) button16 = guiCreateButton(154, 408, 24, 19, "<", false, mainWindow) button17 = guiCreateButton(154, 433, 24, 19, "<", false, mainWindow) button18 = guiCreateButton(154, 458, 24, 19, "<", false, mainWindow) button19 = guiCreateButton(241, 29, 24, 19, ">", false, mainWindow) button20 = guiCreateButton(241, 54, 24, 19, ">", false, mainWindow) button21 = guiCreateButton(241, 80, 24, 19, ">", false, mainWindow) button22 = guiCreateButton(241, 106, 24, 19, ">", false, mainWindow) button23 = guiCreateButton(241, 132, 24, 19, ">", false, mainWindow) button24 = guiCreateButton(241, 158, 24, 19, ">", false, mainWindow) button25 = guiCreateButton(241, 184, 24, 19, ">", false, mainWindow) button26 = guiCreateButton(241, 208, 24, 19, ">", false, mainWindow) button27 = guiCreateButton(241, 233, 24, 19, ">", false, mainWindow) button28 = guiCreateButton(241, 258, 24, 19, ">", false, mainWindow) button29 = guiCreateButton(241, 283, 24, 19, ">", false, mainWindow) button30 = guiCreateButton(241, 308, 24, 19, ">", false, mainWindow) button31 = guiCreateButton(241, 333, 24, 19, ">", false, mainWindow) button32 = guiCreateButton(241, 358, 24, 19, ">", false, mainWindow) button33 = guiCreateButton(241, 383, 24, 19, ">", false, mainWindow) button34 = guiCreateButton(241, 408, 24, 19, ">", false, mainWindow) button35 = guiCreateButton(241, 433, 24, 19, ">", false, mainWindow) button36 = guiCreateButton(241, 458, 24, 19, ">", false, mainWindow) editA = guiCreateEdit(182, 29, 55, 19, "0", false, mainWindow ) editB = guiCreateEdit(182, 54, 55, 19, "0", false, mainWindow ) editC = guiCreateEdit(182, 80, 55, 19, "0", false, mainWindow ) editD = guiCreateEdit(182, 106, 55, 19, "0", false, mainWindow ) editE = guiCreateEdit(182, 132, 55, 19, "0", false, mainWindow ) editF = guiCreateEdit(182, 158, 55, 19, "0", false, mainWindow ) editG = guiCreateEdit(182, 184, 55, 19, "0", false, mainWindow ) editH = guiCreateEdit(182, 208, 55, 19, "0", false, mainWindow ) editI = guiCreateEdit(182, 233, 55, 19, "0", false, mainWindow ) editJ = guiCreateEdit(182, 258, 55, 19, "0", false, mainWindow ) editK = guiCreateEdit(182, 283, 55, 19, "0", false, mainWindow ) editL = guiCreateEdit(182, 308, 55, 19, "0", false, mainWindow ) editM = guiCreateEdit(182, 333, 55, 19, "0", false, mainWindow ) editN = guiCreateEdit(182, 358, 55, 19, "0", false, mainWindow ) editO = guiCreateEdit(182, 383, 55, 19, "0", false, mainWindow ) editP = guiCreateEdit(182, 408, 55, 19, "0", false, mainWindow ) editQ = guiCreateEdit(182, 433, 55, 19, "0", false, mainWindow ) editR = guiCreateEdit(182, 458, 55, 19, "0", false, mainWindow ) applyButton = guiCreateButton(40, 495, 79, 18, "Save", false, mainWindow ) guiSetProperty( applyButton, "HoverTextColour", "FF00FF00" ) exitButton = guiCreateButton(153, 495, 79, 18, "Exit", false, mainWindow ) guiSetProperty( exitButton, "HoverTextColour", "FFFF0000" ) end showCursor ( true ) end addCommandHandler ( "customize", activateMenu ) function clickedButtonCheck ( element ) if source == applyButton then incredibleTable = { --the order is mixed because i sorted GUI menu better than type listings in code [0] = { storedValue = guiGetText ( editA ) }, [1] = { storedValue = guiGetText ( editB ) }, [2] = { storedValue = guiGetText ( editC ) }, [3] = { storedValue = guiGetText ( editD ) }, [4] = { storedValue = guiGetText ( editE ) }, [5] = { storedValue = guiGetText ( editF ) }, [6] = { storedValue = guiGetText ( editG ) }, [7] = { storedValue = guiGetText ( editH ) }, [8] = { storedValue = guiGetText ( editI ) }, [9] = { storedValue = guiGetText ( editJ ) }, [10] = { storedValue = guiGetText ( editK ) }, [11] = { storedValue = guiGetText ( editL ) }, [12] = { storedValue = guiGetText ( editM ) }, [13] = { storedValue = guiGetText ( editN ) }, [14] = { storedValue = guiGetText ( editO ) }, [15] = { storedValue = guiGetText ( editP ) }, [16] = { storedValue = guiGetText ( editQ ) }, [17] = { storedValue = guiGetText ( editR ) }, } triggerServerEvent ( "applyClothes", localPlayer, incredibleTable ) elseif source == exitButton then guiSetVisible ( mainWindow, false ) showCursor ( false ) end end addEventHandler ( "onClientGUIClick", root, clickedButtonCheck ) Server function applyClothing ( incredibleTable ) if getElementModel ( source ) ~= 0 then setElementModel ( source, 0 ) end count = 0 while count ~= 18 do if tostring(incredibleTable[count].storedValue) == "0" then removePedClothes ( source, count ) elseif tostring(incredibleTable[count].storedValue) ~= "" then --blank fields do nothing texture, model = getClothesByTypeIndex ( count, tostring(incredibleTable[count].storedValue) ) addPedClothes ( source, texture, model, count ) --outputChatBox ( "texture: "..texture.." model: "..model.." count: "..count ) end count = count + 1 end if tostring(incredibleTable[18].storedValue) ~= "" then setPedStat ( source, 21, incredibleTable[18].storedValue ) --outputChatBox ( "Fat stuff triggered" ) end if tostring(incredibleTable[19].storedValue) ~= "" then setPedStat ( source, 23, incredibleTable[19].storedValue ) --outputChatBox ( "Strong stuff triggered" ) end end addEvent("applyClothes", true, "incredibleTable" ) addEventHandler("applyClothes", root, applyClothing) Edited September 14, 2014 by Guest
Anubhav Posted September 13, 2014 Posted September 13, 2014 function applyClothing ( incredibleTable ) if getElementModel ( source ) ~= 0 then setElementModel ( source, 0 ) end count = 0 while count ~= 18 do if tostring(incredibleTable[count].storedValue) == "0" then removePedClothes ( source, count ) elseif tostring(incredibleTable[count].storedValue) ~= "" then --blank fields do nothing texture, model = getClothesByTypeIndex ( count, tostring(incredibleTable[count].storedValue) ) addPedClothes ( source, texture, model, count ) --outputChatBox ( "texture: "..texture.." model: "..model.." count: "..count ) end count = count + 1 end if tostring(incredibleTable[18].storedValue) ~= "" then setPedStat ( source, 21, incredibleTable[18].storedValue ) --outputChatBox ( "Fat stuff triggered" ) end if tostring(incredibleTable[19].storedValue) ~= "" and incredibleTable[19].storedValue ~= false and incredibleTable[19].storedValue ~= nil then setPedStat ( source, 23, incredibleTable[19].storedValue ) --outputChatBox ( "Strong stuff triggered" ) end end addEvent("applyClothes", true ) addEventHandler("applyClothes", root, applyClothing)
BrianDUTCH Posted September 14, 2014 Author Posted September 14, 2014 Anubhav, I still have the same error..
BrianDUTCH Posted September 14, 2014 Author Posted September 14, 2014 Only checking the topic won't help me guys.. please support me in this !!
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