Dimos7 Posted December 11, 2016 Share Posted December 11, 2016 (edited) Marker1 = createMarker(321.04, -1965.3171, 17.9757, "cylinder", 4, 255, 255, 0, 255) Marker2 = createMarker(193.7826, 1919.5389, 17.64, "cylinder", 4, 255, 255, 0, 255) local Vehicles = { {"Landstalker", 400}, {"Bravura", 401}, {"Buffalo", 402}, {"Linerunner", 403}, {"Pernniel", 404}, {"Sentiel", 405}, {"Trashmaster", 408}, {"Stretch", 409}, {"Manana", 410}, {"Ifernus", 411}, {"Voodoo", 412}, {"Pony", 413}, {"Mule", 414}, {"Cheetah", 415}, {"Leviathan", 417}, {"Moonbeam", 418}, {"Esperanto", 419}, {"Washington", 421}, {"Bobcat", 422}, {"Mr.Whoopee", 423}, {"BF Injection", 424}, {"Premier", 426}, {"Securicar", 428}, {"Bunshee", 429}, {"Barracks", 433}, {"Hotknife", 434}, {"Previon", 436}, {"Stallion", 439}, {"Rumpo", 440}, {"Romero", 442}, {"Packer", 443}, {"Monster", 444}, {"Admiral", 445}, {"Pizzaboy", 448}, {"Turismo", 451}, {"Flatbed", 455}, {"Yankee", 456}, {"Caddy", 457}, {"Solair", 458}, {"Berkley's RC", 459}, {"Skimmer", 460}, {"PCJ-600", 461}, {"Faggio", 462}, {"Freeway", 463}, {"Glendale", 466}, {"Oceanic", 467}, {"Sanchez", 468}, {"Sparrow", 469}, {"Patriot", 470}, {"Quad", 471}, {"Hermes", 474}, {"Sabre", 475}, {"Rustler", 476}, {"ZR-350", 477}, {"Walton", 478}, {"Regina",479}, {"Comet", 480}, {"BMX", 481}, {"Burrito", 482}, {"Camper", 483}, {"Baggage", 485}, {"Dozer", 486}, {"Maverick", 487}, {"News Maverick", 488}, {"Rancher", 489}, {"Virgo", 491}, {"Greenwood", 492}, {"Hotring Racer", 494}, {"Sandking", 495}, {"Blista Compact", 496}, {"Boxville", 498}, {"Benson", 499}, {"Mesa", 500}, {"Hotring Racer A", 502}, {"Hotring Racer B", 503}, {"Bloodring Banger", 504}, {"Rancher Lure", 505}, {"Super GT", 506}, {"Elegant", 507}, {"Journey", 508}, {"Bike", 509}, {"Mountain Bike", 510}, {"Beagle", 511}, {"Cropduster", 512}, {"Stuntplane", 513}, {"Tanker", 514}, {"Roadtrain", 515}, {"Nebula", 516}, {"Majestic", 517}, {"Buccaneer", 518}, {"Shamal", 519}, {"FCR-900", 521}, {"NRG-500", 522}, {"Cement Truck", 524}, {"Towtruck", 525}, {"Fortune", 526}, {"Cadrona", 527}, {"Willard", 529}, {"forklift", 530}, {"Tractor", 531}, {"Combine Harvester", 532}, {"Feltzer", 533}, {"Remington", 534}, {"Slamvan", 535}, {"Blade", 536}, {"Vincent", 540}, {"Bullet", 541}, {"Clover", 542}, {"Sadler", 543}, {"Huntler", 545}, {"Intruder", 546}, {"Primo", 547}, {"Cargobob", 548}, {"Tampa", 549}, {"Sunrise", 550}, {"Merit", 551}, {"Utility Van", 552}, {"Nevada", 553}, {"Yosemite", 554}, {"Windsor", 555}, {"Moster A", 556}, {"Monster B", 557}, {"Uranus", 558}, {"Jester", 559}, {"Sultan", 560}, {"Stratum", 561}, {"Elegy", 562}, {"Flash", 565}, {"Tahoma", 566}, {"Savana", 567}, {"Bandito", 568}, {"Kart", 571}, {"Mower", 572}, {"Dune", 573}, {"Sweeper", 574}, {"Broadway", 575}, {"Tomado", 576}, {"DFT-30", 578}, {"Huntley", 579}, {"Stafford", 580}, {"BF-400", 581}, {"Newsvan", 582}, {"Tug", 583}, {"Emperor", 585}, {"Wayfarer", 586}, {"Euros", 587}, {"Hotdog", 588}, {"Club", 589}, {"Dodo", 593}, {"Picador", 600}, {"Alpha", 602}, {"Pheonix", 603}, {"Glendale :~", 604}, {"Sadler :~", 605}, } local Prices= { } local GUIEditor = { window = {}, gridlist = {}, column = {}, button = {} } function shop_buyCar() local screenWidth , screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 305, 264 local left, top = screenWidth/2 - windowWidth/2 , screenHeight/2 - windowHeight/2 GUIEditor.window[1] = guiCreateWindow(left, top, windowWidth, windowHeight, "Buy Vehicle", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(9, 21, 568, 201, false, GUIEditor.window[1]) GUIEditor.column[1] = guiGridListAddColum(GUIEditor.gridlist[1], "Vehicles", 0.60) GUIEditor.column[2] = guiGridListAddColum(GUIEditor.gridlist[1], "Prices", 0.60) guiCreateScrollBar(264, 6, 18, 121, false, false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(19, 233, 37, 19, "Buy", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(62, 233, 154, 19, "View the vehicle", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(221, 233, 69, 19, "Cancel", false, GUIEditor.window[1]) guiSetVisible(GUIEditor.window[1], true) showCursor(true) for _, v in ipairs(Vehicles) do local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, v[1], false, false) guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, v[2]) end for _, k in ipairs(Prices) do local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, k[1], false, false) guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, k[2]) end end addEventHandler("onClientMarkerHit", Marker1, shop_buyCar) addEventHandler("onClientMarkerHit", Marker2, shop_buyCar) addEventHandler("onClientGUIClick", root, function(button, state) if not GUIEditor.window[1] or not guiGetVisible(GUIEditor.window[1]) then return end if source == GUIEditor.button[1] and button == "left" and state == "up" then if guiGridListGetSelectedItem(GUIEditor.gridlist[1]) == -1 then outputChatBox("Select a vehicle!", 255, 0, 0) return end local vehicleID = guiGridListGetItemData(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) local price = tonumber(guiGridListGetItemData(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1)) triggerServerEvent("buycar", localPlayer, vehicleID, price) guiSetVisible(GUIEditor.window[1], false) showCursor(false) elseif source == GUIEditor.button[2] and button == "left" and state == "up" then if guiGridListGetSelectedItem(GUIEditor.gridlist[1]) == -1 then outputChatBox("Select a vehicle!", 255, 0, 0) return end local vehicleID = guiGridListGetItemData(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) local x, y, z = getElementPosition(localPlayer) theVehicle = createVehicle(vehicleID, x, y-5, z) setCameraTarget(theVehicle) setTimer(destoryElement, 5000, 1, theVehicle) setTimer(setCameraTarget, 5000, 1, localPlayer) guiSetVisible(GUIEditor.window[1], false) showCursor(false) elseif source == GUIEditor.button[3] and button == "left" and state == "up" then guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end) addEventHandler("onResourceStart", resourceRoot, function() handler = dbConnect("sqlite", "database.db") end) function buyCar(vehicle, price) if isElement(source) and source == client then local money = getPlayerMoney(source) if vehicle and price <= money then local x, y, z = getElementPosition(source) createVehicle(vehicle, x, y-5, z) outputChatBox("You succefully buy a "..getVheicleNameFromModel(vehicle).." you now own it!", source, 0, 255, 0) takePlayerMoney(source, price) else outputChatBox("You don't have enought money for buy this vehicle!", source, 255, 0, 0) end end end addEvent("buycar", true) addEventHandler("buycar", root, buyCar) attemept call guiGridListAddComuln a nill value Edited December 11, 2016 by Dimos7 Link to comment
pa3ck Posted December 11, 2016 Share Posted December 11, 2016 guiGridListAddColumn you spelt it wrong.. 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