JustP Posted May 7, 2019 Posted May 7, 2019 local function updateGrid() guiGridListClear(grid) local only_fitting = guiCheckBoxGetSelected(checkbox) local fitting_skins = getFittingSkins() for k, v in ipairs(list) do if canBuySkin(localPlayer, v) or canEdit(localPlayer) then if not only_fitting or fitting_skins[v.skin] then local row = guiGridListAddRow(grid) guiGridListSetItemText(grid, row, 1, tostring(v.id), false, true) guiGridListSetItemData(grid, row, 1, tostring(k)) guiGridListSetItemText(grid, row, 2, tostring(v.description), false, false) guiGridListSetItemText(grid, row, 3, tostring(v.skin), false, true) guiGridListSetItemText(grid, row, 4, v.price == 0 and 'N/A' or ('$' .. exports.global:formatMoney(v.price)), false, false) end end end end -- ذا كلاينت سايد هل انو في طريقة اخلي انو لو شخص ضاف شيء يضهر للي ضايفه فقط يعني مو كل الناس؟
KillerX Posted May 7, 2019 Posted May 7, 2019 1 minute ago, JustP said: local function updateGrid() guiGridListClear(grid) local only_fitting = guiCheckBoxGetSelected(checkbox) local fitting_skins = getFittingSkins() for k, v in ipairs(list) do if canBuySkin(localPlayer, v) or canEdit(localPlayer) then if not only_fitting or fitting_skins[v.skin] then local row = guiGridListAddRow(grid) guiGridListSetItemText(grid, row, 1, tostring(v.id), false, true) guiGridListSetItemData(grid, row, 1, tostring(k)) guiGridListSetItemText(grid, row, 2, tostring(v.description), false, false) guiGridListSetItemText(grid, row, 3, tostring(v.skin), false, true) guiGridListSetItemText(grid, row, 4, v.price == 0 and 'N/A' or ('$' .. exports.global:formatMoney(v.price)), false, false) end end end end -- ذا كلاينت سايد هل انو في طريقة اخلي انو لو شخص ضاف شيء يضهر للي ضايفه فقط يعني مو كل الناس؟ triggerServerEvent triggerClientEvent هل ساعدتك في شئ ؟؟؟؟ KillerX#9078
JustP Posted May 7, 2019 Author Posted May 7, 2019 1 minute ago, KillerX said: triggerServerEvent triggerClientEvent -- server addEvent('clothing:list', true) addEventHandler('clothing:list', resourceRoot, function() if type(savedClothing) == 'table' then triggerLatentClientEvent(client, 'clothing:list', resourceRoot, savedClothing) else outputChatBox('Clothing list is currently not available.', client, 255, 0, 0) end end, false) -- client addEvent('clothing:list', true) addEventHandler('clothing:list', resourceRoot, function(list_) closeWindow() local margin = 30 window = guiCreateWindow(screen_width - width - margin+20, screen_height - height-margin, width, height, 'Dupont Fashion', false) guiWindowSetSizable(window, false) grid = guiCreateGridList(10, 25, width - 20, height - 60, false, window) guiGridListAddColumn(grid, 'ID', 0.07) guiGridListAddColumn(grid, 'Description', 0.7) guiGridListAddColumn(grid, 'Base Skin', 0.1) guiGridListAddColumn(grid, 'Price', 0.1) local close = guiCreateButton(width - 110, height - 30, 100, 25, 'Close', false, window) addEventHandler('onClientGUIClick', close, closeWindow, false) local buy = guiCreateButton(width - 220, height - 30, 100, 25, 'Buy', false, window) guiSetEnabled(buy, false) checkbox = guiCreateCheckBox(width - 380, height - 33, 155, 22, 'Only Skins you can wear', true, false, window) addEventHandler('onClientGUIClick', checkbox, updateGrid, false) local scrollbar = guiCreateScrollBar(120, height - 32, 185, 22, true, false, window) guiSetProperty(scrollbar, "StepSize", "0.0028") addEventHandler('onClientGUIScroll', scrollbar, function() local rotation = tonumber(guiGetProperty(source, "ScrollPosition")) setElementRotation(previewPed, 0, 0, 155 + rotation * 360) end, false) local newedit = nil if canEdit(localPlayer) then newedit = guiCreateButton(10, height - 30, 100, 25, 'New', false, window) end -- fill the skins list list = sortList(list_) updateGrid() -- event handler for previewing items addEventHandler('onClientGUIClick', grid, function(button) if button == 'left' then -- update the preview ped to reflect actual clothing changes local row, column = guiGridListGetSelectedItem(grid) if row == -1 then resetPed() guiSetEnabled(buy, false) if newedit then guiSetText(newedit, 'New') end else local item = list[tonumber(guiGridListGetItemData(grid, row, 1))] if item then setElementModel(previewPed, item.skin) setElementData(previewPed, 'clothing:id', item.id, false) guiSetEnabled(buy, item.price == 0 or exports.global:hasMoney(localPlayer, item.price)) if newedit then guiSetText(newedit, 'Edit') end else outputDebugString('Clothing preview broke, aw.') guiSetEnabled(buy, false) end end -- we selected another row, so tweak that a bit closeEditingWindow() end end, false) -- buying things addEventHandler('onClientGUIClick', buy, function(button) if button == 'left' then local row, column = guiGridListGetSelectedItem(grid) if row ~= -1 then local item = list[tonumber(guiGridListGetItemData(grid, row, 1))] if item then triggerServerEvent('clothing:buy', resourceRoot, item.id) end end end end, false) -- new/edit if newedit then addEventHandler('onClientGUIClick', newedit, function(button) if button == 'left' then createEditWindow() end end, false) end setSoundVolume(playSound(":resources/inv_open.mp3"), 0.3) end, false)
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