Matevsz Posted April 30, 2016 Share Posted April 30, 2016 Hello all, I have a problem with SkinShop, I want to make the entry into the marker was selected skins from gridlist when you press "backspace" gui is shut off, and as you press "enter" to select a skin and is gui shut off. Client: local markerKupnaSkina = createMarker(161.30000305176, -83.900001525879, 1000.799987793, "cylinder", 1, 0,0,255,255) okno = { gridlist = {} } addEventHandler("onClientResourceStart", resourceRoot, function() gridlist = guiCreateGridList(1350, 383, 236, 293, false) guiGridListAddColumn(gridlist, "Skiny", 0.5) guiGridListAddColumn(gridlist, "ID", 0.5) for i = 1, 20 do guiGridListAddRow(gridlist) end guiGridListSetItemText(gridlist, 0, 1, "Mężczyźni", false, false) guiGridListSetItemColor(gridlist, 0, 1, 206, 0, 0, 255) guiGridListSetItemText(gridlist, 0, 2, " ", false, false) guiGridListSetItemText(gridlist, 1, 1, "CJ", false, false) guiGridListSetItemText(gridlist, 1, 2, "0", false, false) guiGridListSetItemText(gridlist, 2, 1, "Maccer", false, false) guiGridListSetItemText(gridlist, 2, 2, "2", false, false) guiGridListSetItemText(gridlist, 3, 1, "Taxi Driver", false, false) guiGridListSetItemText(gridlist, 3, 2, "7", false, false) guiGridListSetItemText(gridlist, 4, 1, "Mr. Whittaker", false, false) guiGridListSetItemText(gridlist, 4, 2, "15", false, false) guiGridListSetItemText(gridlist, 5, 1, "DJ", false, false) guiGridListSetItemText(gridlist, 5, 2, "19", false, false) guiGridListSetItemText(gridlist, 6, 1, "Joe", false, false) guiGridListSetItemText(gridlist, 6, 2, "21", false, false) guiGridListSetItemText(gridlist, 7, 1, "Ped", false, false) guiGridListSetItemText(gridlist, 7, 2, "22", false, false) guiGridListSetItemText(gridlist, 8, 1, "Drug Dealer", false, false) guiGridListSetItemText(gridlist, 8, 2, "29", false, false) guiGridListSetItemText(gridlist, 9, 1, "Ryder", false, false) guiGridListSetItemText(gridlist, 9, 2, "86", false, false) guiGridListSetItemText(gridlist, 10, 1, " ", false, false) guiGridListSetItemText(gridlist, 10, 2, " ", false, false) guiGridListSetItemText(gridlist, 11, 1, "Kobiety", false, false) guiGridListSetItemColor(gridlist, 11, 1, 23, 114, 40, 255) guiGridListSetItemText(gridlist, 11, 2, " ", false, false) guiGridListSetItemText(gridlist, 12, 1, "Rich", false, false) guiGridListSetItemText(gridlist, 12, 2, "12", false, false) guiGridListSetItemText(gridlist, 13, 1, "Normal Girl", false, false) guiGridListSetItemText(gridlist, 13, 2, "40", false, false) guiGridListSetItemText(gridlist, 14, 1, "Grandmother", false, false) guiGridListSetItemText(gridlist, 14, 2, "54", false, false) guiGridListSetItemText(gridlist, 15, 1, "Businesswoman", false, false) guiGridListSetItemText(gridlist, 15, 2, "91", false, false) guiGridListSetItemText(gridlist, 16, 1, "Normal Girl 2", false, false) guiGridListSetItemText(gridlist, 16, 2, "93", false, false) guiGridListSetItemText(gridlist, 17, 1, "Farm Girl", false, false) guiGridListSetItemText(gridlist, 17, 2, "131", false, false) guiGridListSetItemText(gridlist, 18, 1, "Normal Girl 3", false, false) guiGridListSetItemText(gridlist, 18, 2, "169", false, false) guiGridListSetItemText(gridlist, 19, 1, "Barbara", false, false) guiGridListSetItemText(gridlist, 19, 2, "190", false, false) guiSetVisible(gridlist, false) end ) addEventHandler("onMarkerHit", root, function(markerKupnaSkina) if getLocalPlayer() ~= markerKupnaSkina then return end guiSetVisible(gridlist, true) showCursor(true) liczba = 0 for i = 1,20 do number = number+1 end ped = createPed(0, 180.10000610352, -88.199996948242, 1002, 87.9990844) setElementData(ped,"clothes", true) setCameraMatrix(ped, 174.46969604492, -88.212097167969, 1003.6256713867, 175.40690612793, -88.209663391113, 1003.2769165039) end) addEventHandler("onClientGUIClick",root,function(gui) if (keyState == "down") then guiSetVisible(gridlist, false) showCursor(false) setCameraTarget(getLocalPlayer(),getLocalPlayer()) for _,v in ipairs (getElementsByType("ped")) do if getElementData (v, "clothes") then destroyElement(v) end setElementFrozen(getLocalPlayer(), true) setTimer(setElementFrozen,2000,1,getLocalPlayer(),false) end elseif source == grid then wybrany_row, wybrany_Col = guiGridListGetSelectedItem(grid) id = guiGridListGetItemText(grid, wybrany_row, wybrany_Col) if id == "" then return end setElementModel(ped, tonumber(id)) elseif (keyState == "down") then wybrany_row1, wybrany_Col1 = guiGridListGetSelectedItem(grid) id_skina = guiGridListGetItemText(grid, wybrany_row1, wybrany_Col1) end end) bindKey("backspace", "down", gui) bindKey("enter", "down", gui) Server: local ikona = createBlip(-1882.0999755859, 866.70001220703, 35.799999237061, 45) local wejscie = createMarker(-1882.0999755859, 866.70001220703, 35.799999237061, "arrow", 1, 0,0,0,0) local wyjscie = createMarker(161.39999389648, -97.400001525879, 1002.5, "arrow", 1, 0,0,0,0) local sprzedawca = createPed(211, 161.30000305176, -81, 1001.799987793, 180) local markerKupnaSkina = createMarker(161.30000305176, -83.900001525879, 1000.799987793, "cylinder", 1, 0,0,255,255) function TeleportDoSkinShop(player) if getElementType(player)=="player" then if source == wejscie then setElementPosition(player, 161.60000610352, -95.699996948242, 1001.799987793) setElementInterior(player, 18) setElementInterior(wyjscie, 18) setElementInterior(sprzedawca, 18) setElementInterior(markerKupnaSkina, 18) setElementFrozen(player, true) setTimer(setElementFrozen,3000,1,player,false) end end end addEventHandler("onMarkerHit", wejscie, TeleportDoSkinShop) function TeleportZSkinShop(player) if getElementType(player)=="player" then if source == wyjscie then setElementPosition(player, -1883.5999755859, 865.29998779297, 35.200000762939) setElementInterior(player, 0) setElementFrozen(player, true) setTimer(setElementFrozen,3000,1,player,false) end end end addEventHandler("onMarkerHit", wyjscie, TeleportZSkinShop) Console, no errors. Debugscript Error: Bad argument 'BindKey' Expected function at argument, 3 got nil. Bad argument 'BindKey' Expected function at argument, 3 got nil. Help pls Link to comment
justn Posted May 1, 2016 Share Posted May 1, 2016 Your code seems pretty messed up, like a lot. Also here's a small fix: function gui(btn,keyState) if (btn == "left") and (keyState == "down") then if (source == grid) then wybrany_row1 = guiGridListGetSelectedItem(grid) id = guiGridListGetItemText(grid, wybrany_row, 2) if tonumber(id) == nil then return end setElementModel(ped, tonumber(id)) end end end addEventHandler("onClientGUIClick",root,gui) function manageGUI(key,keyState) if ( keyState == "down" ) then if ( key == "enter" ) then -- do what you want here when the player presses enter elseif ( key == "backspace" ) then -- do what you want here when the player presses backspace end end end bindKey("backspace", "down", manageGUI) bindKey("enter", "down", manageGUI) PM or Contact me on skype so I can help you a bit more with this. 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