basel-ksa Posted September 19, 2010 Share Posted September 19, 2010 bindKey("F7","down","basel") how can i Make it When i Press F7 the Gui Appears and When i Press F7 Again the Close this Small question Help Link to comment
Castillo Posted September 19, 2010 Share Posted September 19, 2010 function makeVisible() get = guiGetVisible(YOURWINDOW) if get == true then guiSetVisible(YOURWINDOW,false) else guiSetVisible(YOURWINDOW,true) end end bindKey("F7","down",makeVisible) Should work Link to comment
dzek (varez) Posted September 19, 2010 Share Posted September 19, 2010 function makeVisible() guiSetVisible(YOURWINDOW,not guiGetVisible(YOURWINDOW)) bindKey("F7","down",makeVisible) should work too Link to comment
basel-ksa Posted September 20, 2010 Author Share Posted September 20, 2010 (edited) is not working Wait to put lua file Edited September 21, 2010 by Guest Link to comment
basel-ksa Posted September 20, 2010 Author Share Posted September 20, 2010 client shopWindow = guiCreateWindow(367,105,334,435,"Shop",false) guiSetVisible (shopWindow, false) guiSetAlpha(shopWindow,1) guiWindowSetSizable(shopWindow,false) tabPanel = guiCreateTabPanel(11,23,314,372,false,shopWindow) guiGridListSetSelectionMode(carGrid,0) costColumn = guiGridListAddColumn(carGrid,"$",0.3) tab2 = guiCreateTab("ÃWeapon",tabPanel) weapGrid = guiCreateGridList(4,6,305,291,false,tab2) guiGridListSetSelectionMode(weapGrid,0) weapColumn = guiGridListAddColumn(weapGrid,"Weapon",0.5) costColumn = guiGridListAddColumn(weapGrid,"$",0.3) weapButton = guiCreateButton(107,308,100,29,"Buy",false,tab2)local weapons = {{5,50},{6,100},{7,200},{8,250},{9,500},{22,500},{23,500},{24,500},{29,500},{31,800},{33,900},{34,950},{30,1000},{25,1100},{26,1200},{27,1500},{28,1500},{32,2000},} for i,v in ipairs (weapons) do local itemName = getWeaponNameFromID (v[1]) local row = guiGridListAddRow (weapGrid) guiGridListSetItemText (weapGrid, row, 1, itemName, false, true) guiGridListSetItemText (weapGrid, row, 2, tostring(v[2]), false, true) end guiSetAlpha(weapGrid,1) closeButton = guiCreateButton(112,401,113,24,"Close",false,shopWindow) local vehicles = {{579,60000},{400,60000},{404,28000},{489,65000},{505,65000},{479,45000},{442,45000},{458,45000},{602,100000},{496,42500},{401,41000},{518,60000},{527,75000},{589,75000},{419,45000},{533,75000},{526,50000},{474,55000},{545,50000},{517,45000},{410,41000},{600,50000},{436,41000},{580,50000},{439,75000},{549,75000},{491,45000},{445,45000},{507,45000},{585,45000},{587,100000},{466,55000},{492,50000},{546,45000},{551,45000},{516,45000},{467,45000},{426,47500},{547,45000},{405,55000},{409,75000},{550,45000},{566,45000},{540,45000},{421,50000},{529,45000},{402,250000},{542,65000},{603,150000},{475,75000},{562,175000},{565,95000},{559,125000},{561,50000},{560,125000},{558,100000},{429,150000},{541,150000},{415,150000},{480,95000},{434,100000},{494,200000},{502,200000},{503,200000},{411,300000},{506,150000},{451,300000},{555,95000},{477,95000},{499,25000},{498,25000},{578,50000},{486,70000},{406,500000},{573,250000},{455,75000},{588,50000},{403,75000},{423,1000000},{414,50000},{443,75000},{515,75000},{514,75000},{531,12000},{456,45000},{422,45000},{482,95000},{530,12000},{418,45000},{572,12000},{582,50000},{413,50000},{440,50000},{543,65000},{583,12000},{478,35000},{554,50000},{536,75000},{575,75000},{534,75000},{567,75000},{535,75000},{576,75000},{412,75000},{568,75000},{457,12000},{483,45000},{508,40000},{571,10000},{500,55000},{444,250000},{556,250000},{557,250000},{495,100000},{539,75000},{485,12000},{431,60000},{438,45000},{437,60000},{574,12000},{420,45000},{525,75000},{408,50000},{428,65000}} for i,v in ipairs (vehicles) do local carName = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow (carGrid) guiGridListSetItemText (carGrid, row, 1, carName, false, true) guiGridListSetItemText (carGrid, row, 2, tostring(v[2]), false, true) end function closeShop() if guiGetVisible(shopWindow) then guiSetVisible(shopWindow,false) showCursor(false) end end addEventHandler ("onClientGUIClick", closeButton, closeShop) addEvent ("viewGUI", true) function viewGUI () if (getLocalPlayer() == source) then guiSetVisible (shopWindow, true) showCursor (true) end end addEventHandler ("viewGUI", getRootElement(), viewGUI) function onClientWeapBuy (button, state, absoluteX, absoluteYe) if (source == weapButton) then guiSetVisible (shopWindow, false) showCursor (false) if (guiGridListGetSelectedItem (weapGrid)) then local itemName = guiGridListGetItemText (weapGrid, guiGridListGetSelectedItem (weapGrid), 1) local itemID = getWeaponIDFromName (itemName) local itemCost = guiGridListGetItemText (weapGrid, guiGridListGetSelectedItem (weapGrid), 2) triggerServerEvent ("weapBuy", getLocalPlayer(), itemID, itemCost, itemName) end end end addEventHandler ("onClientGUIClick", weapButton, onClientWeapBuy) function onClientCarBuy (button, state, absoluteX, absoluteYe) if (source == carButton) then guiSetVisible (shopWindow, false) showCursor (false) if (guiGridListGetSelectedItem (carGrid)) then local carName = guiGridListGetItemText (carGrid, guiGridListGetSelectedItem (carGrid), 1) local carID = getVehicleModelFromName (carName) local carCost = guiGridListGetItemText (carGrid, guiGridListGetSelectedItem (carGrid), 2) triggerServerEvent ("carBuy", getLocalPlayer(), carID, carCost, carName) end end end addEventHandler ("onClientGUIClick", carButton, onClientCarBuy) --------------------------------------------------------- function makeVisible() get = guiGetVisible(shop) if get == true then guiSetVisible(shop,false) else guiSetVisible(shop,true) end end bindKey("F7","down",makeVisible) ---------------------------------------------------------- server addEvent ("viewGUI", true) function showGui (hitPlayer, matchingDimension) triggerClientEvent ("viewGUI", hitPlayer) end addCommandHandler("shop",showGui) addEvent ("weapBuy", true) addEventHandler ("weapBuy", getRootElement(), function(id, cost, name, ammo) if (getPlayerMoney (source) >= tonumber(cost)) then outputChatBox ("You Bought a " .. name, source, 255, 0, 0, false) outputChatBox ("ID: " .. id, source, 255, 0, 0, false) outputChatBox ("Cost: " .. cost, source, 255, 0, 0, false) takePlayerMoney (source, tonumber (cost)) giveWeapon(source, tonumber(id),1000) else outputChatBox ("You are too poor!", source, 255, 0, 0, false) end end) addEvent ("carBuy", true) addEventHandler ("carBuy", getRootElement(), function(id2, cost2, name2,x, y, z, sRz) if (getPlayerMoney (source) >= tonumber(cost2)) then outputChatBox ("Bought a " .. name2, source, 255, 0, 0, false) outputChatBox ("ID: " .. id2, source, 255, 0, 0, false) outputChatBox ("Cost: " .. cost2, source, 255, 0, 0, false) takePlayerMoney (source, tonumber (cost2)) local x,y,z = getElementPosition (source) local vehicle = createVehicle (id2, x, y, z, 0, 0, sRz ) warpPedIntoVehicle(source, vehicle) else outputChatBox ("You are too poor!", source, 255, 0, 0, false) end end) function vExplode () toggleVehicleRespawn ( source, false ) setTimer(destroyElement, 5000, 1, source) end addEventHandler ( "onVehicleExplode", getResourceRootElement(getThisResource()), vExplode ) function skillButton (id, cost) if (id == "0") then skillBuyPlayer (250,source,69) elseif (id == "1") then skillBuyPlayer (2000,source,70) elseif (id == "2") then skillBuyPlayer (500,source,71) elseif (id == "3") then skillBuyPlayer (5800,source,72) elseif (id == "4") then skillBuyPlayer (11000,source,73) elseif (id == "5") then skillBuyPlayer (7500,source,74) elseif (id == "6") then skillBuyPlayer (5500,source,75) elseif (id == "7") then skillBuyPlayer (7000,source,76) elseif (id == "8") then skillBuyPlayer (8000,source,77) elseif (id == "9") then skillBuyPlayer (10000,source,78) elseif (id == "10") then skillBuyPlayer (10000,source,79) end end addEvent ("skillBuy", true) addEventHandler ("skillBuy", getRootElement(),skillButton) function skillBuyPlayer (cash,player,id) if (getPlayerMoney (player) >= cash) then takePlayerMoney (player,cash) setPedStat(player, id, 999) else outputChatBox ("You are too poor!", player, 255,0,0) end end and i try function makeVisible() guiSetVisible(YOURWINDOW,not guiGetVisible(YOURWINDOW)) bindKey("F7","down",makeVisible) Does not work this is shop Script but i make Some Change !!! but i whant it Opens and closes in "F7" Link to comment
Castillo Posted September 20, 2010 Share Posted September 20, 2010 Oh my shop script, well you are doing a complete mess out there shopWindow = guiCreateWindow(367,105,334,435,"Shop",false) guiSetVisible (shopWindow, false) guiSetAlpha(shopWindow,1) guiWindowSetSizable(shopWindow,false) tabPanel = guiCreateTabPanel(11,23,314,372,false,shopWindow) guiGridListSetSelectionMode(carGrid,0) costColumn = guiGridListAddColumn(carGrid,"$",0.3) tab2 = guiCreateTab("ÃWeapon",tabPanel) weapGrid = guiCreateGridList(4,6,305,291,false,tab2) guiGridListSetSelectionMode(weapGrid,0) weapColumn = guiGridListAddColumn(weapGrid,"Weapon",0.5) costColumn = guiGridListAddColumn(weapGrid,"$",0.3) weapButton = guiCreateButton(107,308,100,29,"Buy",false,tab2)local weapons = {{5,50},{6,100},{7,200},{8,250},{9,500},{22,500},{23,500},{24,500},{29,500},{31,800},{33,900},{34,950},{30,1000},{25,1100},{26,1200},{27,1500},{28,1500},{32,2000},} for i,v in ipairs (weapons) do local itemName = getWeaponNameFromID (v[1]) local row = guiGridListAddRow (weapGrid) guiGridListSetItemText (weapGrid, row, 1, itemName, false, true) guiGridListSetItemText (weapGrid, row, 2, tostring(v[2]), false, true) end guiSetAlpha(weapGrid,1) closeButton = guiCreateButton(112,401,113,24,"Close",false,shopWindow) local vehicles = {{579,60000},{400,60000},{404,28000},{489,65000},{505,65000},{479,45000},{442,45000},{458,45000},{602,100000},{496,42500},{401,41000},{518,60000},{527,75000},{589,75000},{419,45000},{533,75000},{526,50000},{474,55000},{545,50000},{517,45000},{410,41000},{600,50000},{436,41000},{580,50000},{439,75000},{549,75000},{491,45000},{445,45000},{507,45000},{585,45000},{587,100000},{466,55000},{492,50000},{546,45000},{551,45000},{516,45000},{467,45000},{426,47500},{547,45000},{405,55000},{409,75000},{550,45000},{566,45000},{540,45000},{421,50000},{529,45000},{402,250000},{542,65000},{603,150000},{475,75000},{562,175000},{565,95000},{559,125000},{561,50000},{560,125000},{558,100000},{429,150000},{541,150000},{415,150000},{480,95000},{434,100000},{494,200000},{502,200000},{503,200000},{411,300000},{506,150000},{451,300000},{555,95000},{477,95000},{499,25000},{498,25000},{578,50000},{486,70000},{406,500000},{573,250000},{455,75000},{588,50000},{403,75000},{423,1000000},{414,50000},{443,75000},{515,75000},{514,75000},{531,12000},{456,45000},{422,45000},{482,95000},{530,12000},{418,45000},{572,12000},{582,50000},{413,50000},{440,50000},{543,65000},{583,12000},{478,35000},{554,50000},{536,75000},{575,75000},{534,75000},{567,75000},{535,75000},{576,75000},{412,75000},{568,75000},{457,12000},{483,45000},{508,40000},{571,10000},{500,55000},{444,250000},{556,250000},{557,250000},{495,100000},{539,75000},{485,12000},{431,60000},{438,45000},{437,60000},{574,12000},{420,45000},{525,75000},{408,50000},{428,65000}} for i,v in ipairs (vehicles) do local carName = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow (carGrid) guiGridListSetItemText (carGrid, row, 1, carName, false, true) guiGridListSetItemText (carGrid, row, 2, tostring(v[2]), false, true) end function closeShop() if guiGetVisible(shopWindow) then guiSetVisible(shopWindow,false) showCursor(false) end end addEventHandler ("onClientGUIClick", closeButton, closeShop) addEvent ("viewGUI", true) function viewGUI () if (getLocalPlayer() == source) then guiSetVisible (shopWindow, true) showCursor (true) end end addEventHandler ("viewGUI", getRootElement(), viewGUI) function onClientWeapBuy (button, state, absoluteX, absoluteYe) if (source == weapButton) then guiSetVisible (shopWindow, false) showCursor (false) if (guiGridListGetSelectedItem (weapGrid)) then local itemName = guiGridListGetItemText (weapGrid, guiGridListGetSelectedItem (weapGrid), 1) local itemID = getWeaponIDFromName (itemName) local itemCost = guiGridListGetItemText (weapGrid, guiGridListGetSelectedItem (weapGrid), 2) triggerServerEvent ("weapBuy", getLocalPlayer(), itemID, itemCost, itemName) end end end addEventHandler ("onClientGUIClick", weapButton, onClientWeapBuy) function onClientCarBuy (button, state, absoluteX, absoluteYe) if (source == carButton) then guiSetVisible (shopWindow, false) showCursor (false) if (guiGridListGetSelectedItem (carGrid)) then local carName = guiGridListGetItemText (carGrid, guiGridListGetSelectedItem (carGrid), 1) local carID = getVehicleModelFromName (carName) local carCost = guiGridListGetItemText (carGrid, guiGridListGetSelectedItem (carGrid), 2) triggerServerEvent ("carBuy", getLocalPlayer(), carID, carCost, carName) end end end addEventHandler ("onClientGUIClick", carButton, onClientCarBuy) function makeVisible() get = guiGetVisible(shopWindow) if get == true then guiSetVisible(shopWindow,false) showCursor(false) else guiSetVisible(shopWindow,true) showCursor(true) end end bindKey("F7","down",makeVisible) that should work Link to comment
dzek (varez) Posted September 20, 2010 Share Posted September 20, 2010 Your shop window is called shopWindow and you put just shop in showing/hiding function .. Link to comment
UAEpro Posted September 20, 2010 Share Posted September 20, 2010 Change to this function makeVisible() get = guiGetVisible(shopWindow) if get == true then guiSetVisible(shopWindow ,false) else guiSetVisible(shopWindow ,true) end end bindKey("F7","down",makeVisible) it will work (i think) reasons in your language لانك انت كتبت guiSetVisible(shop ,false) لكن اسم النافذة المطلوب تظهرها هو shopWindow وليس Shop وننتظر ابداعادك بأحر من الجمر ,, وانا اسف اذا غلطت عليك في يوم من الايام .. تقبل مروري Link to comment
Castillo Posted September 20, 2010 Share Posted September 20, 2010 (edited) I don't see the point of your post, i already posted this and added showCursor function also. Edited September 20, 2010 by Guest Link to comment
basel-ksa Posted September 21, 2010 Author Share Posted September 21, 2010 Change to this function makeVisible() get = guiGetVisible(shopWindow) if get == true then guiSetVisible(shopWindow ,false) else guiSetVisible(shopWindow ,true) end end bindKey("F7","down",makeVisible) it will work (i think) reasons in your language لانك انت كتبت guiSetVisible(shop ,false) لكن اسم النافذة المطلوب تظهرها هو shopWindow وليس Shop وننتظر ابداعادك بأحر من الجمر ,, وانا اسف اذا غلطت عليك في يوم من الايام .. تقبل مروري Thx man I knew What the problem from varez RE and Thank you So Much مرورك تاج عل الراس ونشاء الله مايكون بـيـنـى زعل بالنهايه حنى خوان وما راح يفرق بينى العاب ولا منتدى اخووكــ: باسل 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