undefined Posted July 18, 2014 Posted July 18, 2014 Hi guys. Im work on the vehicle upgrade. I want to reserve upgrades. [spoiler, Wheels,...] I've made several attempts but has failed. How to do it?
Castillo Posted July 18, 2014 Posted July 18, 2014 What do you mean by "reserve"? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
undefined Posted July 18, 2014 Author Posted July 18, 2014 What do you mean by "reserve"? For Example: Wheels 1080 1079 ... ... Nitro 1008 1009 1010 Spoiler ... ... ... ________________________________________________________________________________________________________ It's my simple code: vehUpgradeWindow = guiCreateWindow(447, 214, 303, 380, "Araç Yükseltmesi", false) guiWindowSetSizable(vehUpgradeWindow, false) guiSetVisible(vehUpgradeWindow, false) vehUpgradeGrid = guiCreateGridList(10, 26, 283, 317, false, vehUpgradeWindow) guiGridListAddColumn(vehUpgradeGrid, "Name", 0.6) guiGridListAddColumn(vehUpgradeGrid, "Installed", 0.33) vehUpgradeAddRemove = guiCreateButton(10, 353, 67, 19, "Ekle", false, vehUpgradeWindow) vehUpgradeClose = guiCreateButton(226, 353, 67, 19, "Kapat", false, vehUpgradeWindow) guiGridListSetSortingEnabled ( vehUpgradeGrid, false ) addEventHandler("onClientVehicleEnter", getRootElement(), function( thePlayer, seat ) if thePlayer == gMe then local vehicle = getPedOccupiedVehicle(gMe) for i,upgrade in ipairs(getVehicleCompatibleUpgrades(vehicle)) do local row = guiGridListAddRow( vehUpgradeGrid ) guiGridListSetItemText ( vehUpgradeGrid, row, 1, tostring(upgrade), false, false ) guiGridListSetItemData ( vehUpgradeGrid, row, 1, tostring(upgrade) ) end end end) addEventHandler("onClientVehicleStartExit", getRootElement(), function( player, seat, door ) if player == gMe then guiGridListClear(vehUpgradeGrid) end end) addEventHandler("onClientGUIClick", guiRoot, function() if source == upgradeVehicleButton then local vehicle = getPedOccupiedVehicle(gMe) if guiGetVisible(vehUpgradeWindow) == false then if vehicle then guiSetVisible(vehUpgradeWindow, true) end elseif guiGetVisible(vehUpgradeWindow) == true then guiSetVisible(vehUpgradeWindow, false) triggerServerEvent("vehUpgradeWindowAyar", localPlayer) end elseif source == vehUpgradeClose then guiSetVisible(vehUpgradeWindow, false) triggerServerEvent("vehUpgradeWindowAyar", localPlayer) end end) addEventHandler( "onClientGUIDoubleClick", gRoot, function() if source == vehUpgradeGrid then local vehicle = getPedOccupiedVehicle(gMe) if not vehicle then return end local row, col = guiGridListGetSelectedItem ( vehUpgradeGrid ) if ( row and col and row ~= -1 and col ~= -1 ) then local vehUpgrade = guiGridListGetItemData ( vehUpgradeGrid, row, 1 ) addVehicleUpgrade ( vehicle, vehUpgrade ) end end end)
Castillo Posted July 19, 2014 Posted July 19, 2014 What is the result of that code? can you post a screenshot? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
TAPL Posted July 20, 2014 Posted July 20, 2014 Try. addEventHandler("onClientVehicleEnter", root, function(thePlayer, seat) if thePlayer == gMe then local vehicle = getPedOccupiedVehicle(gMe) gTable = {} for i,upgrade in ipairs(getVehicleCompatibleUpgrades(vehicle)) do if not gTable[getVehicleUpgradeSlotName(upgrade)] then gTable[getVehicleUpgradeSlotName(upgrade)] = {} end table.insert(gTable[getVehicleUpgradeSlotName(upgrade)], upgrade) end for name, upgrade in pairs(gTable) do if n ~= name and #upgrade > 0 then n = name local row = guiGridListAddRow(vehUpgradeGrid) guiGridListSetItemText(vehUpgradeGrid, row, 1, tostring(name), true, false) end for i, upgrade in ipairs(upgrade) do local row = guiGridListAddRow(vehUpgradeGrid) guiGridListSetItemText(vehUpgradeGrid, row, 1, tostring(upgrade), false, false) guiGridListSetItemData(vehUpgradeGrid, row, 1, tostring(upgrade)) end end end end)
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