├── clothing ├── __resource.lua ├── models.txt ├── server.lua ├── config.lua ├── client.lua └── gui.lua └── README.md /clothing/__resource.lua: -------------------------------------------------------------------------------- 1 | resource_manifest_version '05cfa83c-a124-4cfa-a768-c24a5811d8f9' 2 | description 'Model Menu v3 by Frazzle :D' 3 | client_scripts { 4 | 'gui.lua', 5 | 'client.lua', 6 | 'config.lua', 7 | } 8 | 9 | server_script 'server.lua' -------------------------------------------------------------------------------- /clothing/models.txt: -------------------------------------------------------------------------------- 1 | {"steam:1100001057052a0":{"new":false,"props":{"textures":[-1,-1,-1,-1,-1,-1,-1,-1],"drawables":[-1,-1,-1,-1,-1,-1,-1,-1]},"overlays":{"drawables":[255,255,0,255,255,0,255,255,0,255,255,255,255],"colours":[{"colour":0,"colourType":0},{"colour":0,"colourType":0},{"colour":15,"colourType":1},{"colour":0,"colourType":0},{"colour":0,"colourType":0},{"colour":5,"colourType":2},{"colour":0,"colourType":0},{"colour":0,"colourType":0},{"colour":29,"colourType":2},{"colour":0,"colourType":0},{"colour":0,"colourType":0},{"colour":0,"colourType":0},{"colour":0,"colourType":0}],"opacity":[1.0,1.0,1.0,1.0,1.0,0.9,1.0,1.0,0.9,1.0,1.0,1.0,1.0]},"model":-1667301416,"clothing":{"textures":[0,0,12,0,1,0,4,0,5,0,0,2],"drawables":[45,0,17,38,12,0,8,1,13,0,0,1],"palette":[0,0,1,0,0,0,0,0,0,0,0,0]}}} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Model-Menu V3 2 | A Menu that: 3 | 4 | * Can be opened and closed using E in a clothing shop 5 | * lets you choose from every working model 6 | * lets you fully customise models 7 | * Loads/Saves models to a textfile 8 | 9 | 10 | 11 | 12 | ---------- 13 | ## Latest change(s) 14 | 15 | **Version 3** 16 | * Rebuilt from the ground up 17 | * New UI Modified version of @MrDaGree 's menu 18 | * A lot easier for players to use 19 | * Freemode and Ped customisation 20 | * Lipstick, Facial Hair etc 21 | * Saves to a text file (i will add async option) 22 | * Users get a random ped model on first spawn 23 | * Auto saves models 24 | * Has all clothing items and accessories 25 | 26 | **Screenshots** 27 | https://prnt.sc/gvbq6l 28 | http://prntscr.com/gvbq9p 29 | http://prntscr.com/gvbqng 30 | http://prntscr.com/gvbqgk 31 | 32 | ---------- 33 | **If you have modified it and it stopped working, don't come to me for help.** 34 | -------------------------------------------------------------------------------- /clothing/server.lua: -------------------------------------------------------------------------------- 1 | models = {} 2 | RegisterServerEvent("clothes:firstspawn") 3 | AddEventHandler("clothes:firstspawn",function() 4 | local source = source 5 | local identifier = getID("steam",source) 6 | print(identifier) 7 | if models[identifier] then 8 | TriggerClientEvent("clothes:spawn", source, models[identifier]) 9 | else 10 | local default_models = {1413662315,-781039234,1077785853,2021631368,1423699487,1068876755,2120901815,-106498753,131961260,-1806291497,1641152947,115168927,330231874,-1444213182,1809430156,1822107721,2064532783,-573920724,-782401935,808859815,-1106743555,-1606864033,1004114196,532905404,1699403886,-1656894598,1674107025,-88831029,-1244692252,951767867,1388848350,1090617681,379310561,-569505431,-1332260293,-840346158} 11 | models[identifier] = { 12 | model = default_models[math.random(1,tonumber(#default_models))], 13 | new = true, 14 | clothing = {drawables = {0,0,0,0,0,0,0,0,0,0,0,0},textures = {2,0,1,1,0,0,0,0,0,0,0,0},palette = {0,0,0,0,0,0,0,0,0,0,0,0}}, 15 | props = {drawables = {-1,-1,-1,-1,-1,-1,-1,-1}, textures = {-1,-1,-1,-1,-1,-1,-1,-1}}, 16 | overlays = {drawables = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, opacity = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, colours = {{colourType = 0, colour = 0},{colourType = 0, colour = 0},{colourType = 0, colour = 0},{colourType = 0, colour = 0},{colourType = 0, colour = 0},{colourType = 0, colour = 0},{colourType = 0, colour = 0},{colourType = 0, colour = 0},{colourType = 0, colour = 0},{colourType = 0, colour = 0},{colourType = 0, colour = 0},{colourType = 0, colour = 0},{colourType = 0, colour = 0}}}, 17 | } 18 | saveModels() 19 | TriggerClientEvent("clothes:spawn", source, models[identifier]) 20 | end 21 | end) 22 | 23 | RegisterServerEvent("clothes:spawn") 24 | AddEventHandler("clothes:spawn",function() 25 | local source = source 26 | local identifier = getID("steam",source) 27 | TriggerClientEvent("clothes:spawn", source, models[identifier]) 28 | end) 29 | 30 | RegisterServerEvent("clothes:loaded") 31 | AddEventHandler("clothes:loaded",function() 32 | -- Give weapons etc 33 | end) 34 | 35 | RegisterServerEvent("clothes:save") 36 | AddEventHandler("clothes:save",function(player_data) 37 | local source = source 38 | local identifier = getID("steam",source) 39 | models[identifier] = player_data 40 | saveModels() 41 | -- Give weapons etc 42 | end) 43 | 44 | function loadModels() 45 | models = LoadResourceFile(GetCurrentResourceName(), "models.txt") or "[]" 46 | models = json.decode(models) 47 | end 48 | 49 | function saveModels() 50 | SaveResourceFile(GetCurrentResourceName(), "models.txt", json.encode(models), -1) 51 | end 52 | 53 | function getID(type, source) 54 | for k,v in ipairs(GetPlayerIdentifiers(source)) do 55 | if string.sub(tostring(v), 1, string.len("steam:")) == "steam:" and (type == "steam" or type == 1) then 56 | return v 57 | elseif string.sub(tostring(v), 1, string.len("license:")) == "license:" and (type == "license" or type == 2) then 58 | return v 59 | elseif string.sub(tostring(v), 1, string.len("ip:")) == "ip:" and (type == "ip" or type == 3) then 60 | return v 61 | end 62 | end 63 | return nil 64 | end 65 | 66 | loadModels() -------------------------------------------------------------------------------- /clothing/config.lua: -------------------------------------------------------------------------------- 1 | male_models = {'a_m_m_acult_01','a_m_m_afriamer_01','a_m_m_beach_01','a_m_m_beach_02','a_m_m_bevhills_01','a_m_m_bevhills_02','a_m_m_business_01','a_m_m_eastsa_01','a_m_m_eastsa_02','a_m_m_farmer_01','a_m_m_fatlatin_01','a_m_m_genfat_01','a_m_m_genfat_02','a_m_m_golfer_01','a_m_m_hasjew_01','a_m_m_hillbilly_01','a_m_m_hillbilly_02','a_m_m_indian_01','a_m_m_ktown_01','a_m_m_malibu_01','a_m_m_mexcntry_01','a_m_m_mexlabor_01','a_m_m_og_boss_01','a_m_m_paparazzi_01','a_m_m_polynesian_01','a_m_m_prolhost_01','a_m_m_rurmeth_01','a_m_m_salton_01','a_m_m_salton_02','a_m_m_salton_03','a_m_m_salton_04','a_m_m_skater_01','a_m_m_skidrow_01','a_m_m_socenlat_01','a_m_m_soucent_01','a_m_m_soucent_02','a_m_m_soucent_03','a_m_m_soucent_04','a_m_m_stlat_02','a_m_m_tennis_01','a_m_m_tourist_01','a_m_m_trampbeac_01','a_m_m_tramp_01','a_m_m_tranvest_01','a_m_m_tranvest_02','a_m_o_acult_01','a_m_o_acult_02','a_m_o_beach_01','a_m_o_genstreet_01','a_m_o_ktown_01','a_m_o_salton_01','a_m_o_soucent_01','a_m_o_soucent_02','a_m_o_soucent_03','a_m_o_tramp_01','a_m_y_acult_01','a_m_y_acult_02','a_m_y_beachvesp_01','a_m_y_beachvesp_02','a_m_y_beach_01','a_m_y_beach_02','a_m_y_beach_03','a_m_y_bevhills_01','a_m_y_bevhills_02','a_m_y_breakdance_01','a_m_y_busicas_01','a_m_y_business_01','a_m_y_business_02','a_m_y_business_03','a_m_y_cyclist_01','a_m_y_dhill_01','a_m_y_downtown_01','a_m_y_eastsa_01','a_m_y_eastsa_02','a_m_y_epsilon_01','a_m_y_epsilon_02','a_m_y_gay_01','a_m_y_gay_02','a_m_y_genstreet_01','a_m_y_genstreet_02','a_m_y_golfer_01','a_m_y_hasjew_01','a_m_y_hiker_01','a_m_y_hippy_01','a_m_y_hipster_01','a_m_y_hipster_02','a_m_y_hipster_03','a_m_y_indian_01','a_m_y_jetski_01','a_m_y_juggalo_01','a_m_y_ktown_01','a_m_y_ktown_02','a_m_y_latino_01','a_m_y_methhead_01','a_m_y_mexthug_01','a_m_y_motox_01','a_m_y_motox_02','a_m_y_musclbeac_01','a_m_y_musclbeac_02','a_m_y_polynesian_01','a_m_y_roadcyc_01','a_m_y_runner_01','a_m_y_runner_02','a_m_y_salton_01','a_m_y_skater_01','a_m_y_skater_02','a_m_y_soucent_01','a_m_y_soucent_02','a_m_y_soucent_03','a_m_y_soucent_04','a_m_y_stbla_01','a_m_y_stbla_02','a_m_y_stlat_01','a_m_y_stwhi_01','a_m_y_stwhi_02','a_m_y_sunbathe_01','a_m_y_surfer_01','a_m_y_vindouche_01','a_m_y_vinewood_01','a_m_y_vinewood_02','a_m_y_vinewood_03','a_m_y_vinewood_04','a_m_y_yoga_01','csb_anton','csb_ballasog','csb_burgerdrug','csb_car3guy1','csb_car3guy2','csb_chef','csb_chin_goon','csb_cletus', 'csb_customer', 'csb_fos_rep', 'csb_g', 'csb_groom', 'csb_grove_str_dlr', 'csb_hao', 'csb_hugh', 'csb_imran', 'csb_janitor', 'csb_ortega', 'csb_oscar', 'csb_porndudes', 'csb_prologuedriver', 'csb_ramp_gang', 'csb_ramp_hic', 'csb_ramp_hipster', 'csb_ramp_mex', 'csb_reporter', 'csb_roccopelosi', 'csb_trafficwarden','cs_bankman', 'cs_barry', 'cs_beverly', 'cs_brad', 'cs_carbuyer', 'cs_chengsr', 'cs_chrisformage', 'cs_clay', 'cs_dale', 'cs_davenorton', 'cs_devin', 'cs_dom', 'cs_dreyfuss', 'cs_drfriedlander', 'cs_fabien', 'cs_floyd', 'cs_hunter', 'cs_jimmyboston', 'cs_jimmydisanto', 'cs_joeminuteman', 'cs_johnnyklebitz', 'cs_josef', 'cs_josh', 'cs_lazlow', 'cs_lestercrest', 'cs_lifeinvad_01', 'cs_manuel', 'cs_martinmadrazo', 'cs_milton', 'cs_movpremmale', 'cs_mrk', 'cs_nervousron', 'cs_nigel', 'cs_old_man1a', 'cs_old_man2', 'cs_omega', 'cs_orleans', 'cs_paper', 'cs_priest', 'cs_prolsec_02', 'cs_russiandrunk', 'cs_siemonyetarian', 'cs_solomon', 'cs_stevehains', 'cs_stretch', 'cs_taocheng', 'cs_taostranslator', 'cs_tenniscoach', 'cs_terry', 'cs_tom', 'cs_tomepsilon', 'cs_wade', 'cs_zimbor', 'g_m_m_armboss_01','g_m_m_armgoon_01','g_m_m_armlieut_01','g_m_m_chemwork_01','g_m_m_chiboss_01','g_m_m_chicold_01','g_m_m_chigoon_01','g_m_m_chigoon_02','g_m_m_korboss_01','g_m_m_mexboss_01','g_m_m_mexboss_02','g_m_y_armgoon_02','g_m_y_azteca_01','g_m_y_ballaeast_01','g_m_y_ballaorig_01','g_m_y_ballasout_01','g_m_y_famca_01','g_m_y_famdnf_01','g_m_y_famfor_01','g_m_y_korean_01','g_m_y_korean_02','g_m_y_korlieut_01','g_m_y_lost_01','g_m_y_lost_02','g_m_y_lost_03','g_m_y_mexgang_01','g_m_y_mexgoon_01','g_m_y_mexgoon_02','g_m_y_mexgoon_03','g_m_y_pologoon_01','g_m_y_pologoon_02','g_m_y_salvaboss_01','g_m_y_salvagoon_01','g_m_y_salvagoon_02','g_m_y_salvagoon_03','g_m_y_strpunk_01','g_m_y_strpunk_02','hc_driver', 'hc_gunman', 'hc_hacker', 's_m_m_ammucountry','s_m_m_autoshop_01','s_m_m_autoshop_02','s_m_m_bouncer_01','s_m_m_ciasec_01','s_m_m_cntrybar_01','s_m_m_dockwork_01','s_m_m_doctor_01','s_m_m_fiboffice_02','s_m_m_gaffer_01','s_m_m_gardener_01','s_m_m_gentransport','s_m_m_hairdress_01','s_m_m_highsec_01','s_m_m_highsec_02','s_m_m_janitor','s_m_m_lathandy_01','s_m_m_lifeinvad_01','s_m_m_linecook','s_m_m_lsmetro_01','s_m_m_mariachi_01','s_m_m_migrant_01','s_m_m_movprem_01','s_m_m_movspace_01','s_m_m_pilot_01','s_m_m_pilot_02','s_m_m_postal_01','s_m_m_postal_02','s_m_m_scientist_01','s_m_m_strperf_01','s_m_m_strpreach_01','s_m_m_strvend_01','s_m_m_trucker_01','s_m_m_ups_01','s_m_m_ups_02','s_m_o_busker_01','s_m_y_airworker','s_m_y_ammucity_01','s_m_y_armymech_01','s_m_y_autopsy_01','s_m_y_barman_01','s_m_y_baywatch_01','s_m_y_busboy_01','s_m_y_chef_01','s_m_y_clown_01','s_m_y_construct_01','s_m_y_construct_02','s_m_y_dealer_01','s_m_y_devinsec_01','s_m_y_dockwork_01','s_m_y_dwservice_01','s_m_y_dwservice_02','s_m_y_factory_01','s_m_y_garbage','s_m_y_grip_01','s_m_y_mime','s_m_y_pestcont_01','s_m_y_pilot_01','s_m_y_prismuscl_01','s_m_y_prisoner_01','s_m_y_robber_01','s_m_y_shop_mask','s_m_y_strvend_01','s_m_y_uscg_01','s_m_y_valet_01','s_m_y_waiter_01','s_m_y_winclean_01','s_m_y_xmech_01','s_m_y_xmech_02','u_m_m_aldinapoli','u_m_m_bankman','u_m_m_bikehire_01','u_m_m_fibarchitect','u_m_m_filmdirector','u_m_m_glenstank_01','u_m_m_griff_01','u_m_m_jesus_01','u_m_m_jewelsec_01','u_m_m_jewelthief','u_m_m_markfost','u_m_m_partytarget','u_m_m_promourn_01','u_m_m_rivalpap','u_m_m_spyactor','u_m_m_willyfist','u_m_o_finguru_01','u_m_o_taphillbilly','u_m_o_tramp_01','u_m_y_abner','u_m_y_antonb','u_m_y_babyd','u_m_y_baygor','u_m_y_burgerdrug_01','u_m_y_chip','u_m_y_cyclist_01','u_m_y_fibmugger_01','u_m_y_guido_01','u_m_y_gunvend_01','u_m_y_hippie_01','u_m_y_imporage','u_m_y_justin','u_m_y_mani','u_m_y_militarybum','u_m_y_paparazzi','u_m_y_party_01','u_m_y_pogo_01','u_m_y_prisoner_01','u_m_y_proldriver_01','u_m_y_rsranger_01','u_m_y_sbike','u_m_y_staggrm_01','u_m_y_tattoo_01'} 2 | female_models = {'a_f_m_beach_01','a_f_m_bevhills_01','a_f_m_bevhills_02','a_f_m_bodybuild_01','a_f_m_business_02','a_f_m_downtown_01','a_f_m_eastsa_01','a_f_m_eastsa_02','a_f_m_fatbla_01','a_f_m_fatcult_01','a_f_m_fatwhite_01','a_f_m_ktown_01','a_f_m_ktown_02','a_f_m_prolhost_01','a_f_m_salton_01','a_f_m_skidrow_01','a_f_m_soucentmc_01','a_f_m_soucent_01','a_f_m_soucent_02','a_f_m_tourist_01','a_f_m_trampbeac_01','a_f_m_tramp_01','a_f_o_genstreet_01','a_f_o_indian_01','a_f_o_ktown_01','a_f_o_salton_01','a_f_o_soucent_01','a_f_o_soucent_02','a_f_y_beach_01','a_f_y_bevhills_01','a_f_y_bevhills_02','a_f_y_bevhills_03','a_f_y_bevhills_04','a_f_y_business_01','a_f_y_business_02','a_f_y_business_03','a_f_y_business_04','a_f_y_eastsa_01','a_f_y_eastsa_02','a_f_y_eastsa_03','a_f_y_epsilon_01','a_f_y_fitness_01','a_f_y_fitness_02','a_f_y_genhot_01','a_f_y_golfer_01','a_f_y_hiker_01','a_f_y_hippie_01','a_f_y_hipster_01','a_f_y_hipster_02','a_f_y_hipster_03','a_f_y_hipster_04','a_f_y_indian_01','a_f_y_juggalo_01','a_f_y_runner_01','a_f_y_rurmeth_01','a_f_y_scdressy_01','a_f_y_skater_01','a_f_y_soucent_01','a_f_y_soucent_02','a_f_y_soucent_03','a_f_y_tennis_01','a_f_y_topless_01','a_f_y_tourist_01','a_f_y_tourist_02','a_f_y_vinewood_01','a_f_y_vinewood_02','a_f_y_vinewood_03','a_f_y_vinewood_04','a_f_y_yoga_01','cs_tracydisanto','cs_tanisha', 'cs_patricia', 'cs_mrsphillips', 'cs_mrs_thornhill', 'cs_natalia', 'cs_molly', 'cs_movpremf_01', 'cs_maryann', 'cs_michelle', 'cs_marnie', 'cs_magenta', 'cs_janet', 'cs_jewelass', 'cs_guadalope', 'cs_gurk', 'cs_debra', 'cs_denise', 'cs_amandatownley', 'cs_ashley', 'csb_screen_writer', 'csb_stripper_01', 'csb_stripper_02', 'csb_tonya', 'csb_maude', 'csb_denise_friend', 'csb_abigail', 'csb_anita', 'g_f_y_ballas_01','g_f_y_families_01','g_f_y_lost_01','g_f_y_vagos_01','s_f_m_fembarber','s_f_m_maid_01','s_f_m_shop_high','s_f_m_sweatshop_01','s_f_y_airhostess_01','s_f_y_bartender_01','s_f_y_baywatch_01','s_f_y_factory_01','s_f_y_hooker_01','s_f_y_hooker_02','s_f_y_hooker_03','s_f_y_migrant_01','s_f_y_movprem_01','s_f_y_shop_low','s_f_y_shop_mid','s_f_y_stripperlite','s_f_y_stripper_01','s_f_y_stripper_02','s_f_y_sweatshop_01','u_f_m_corpse_01','u_f_m_miranda','u_f_m_promourn_01','u_f_o_moviestar','u_f_o_prolhost_01','u_f_y_bikerchic','u_f_y_comjane','u_f_y_hotposh_01','u_f_y_jewelass_01','u_f_y_mistress','u_f_y_poppymich','u_f_y_princess','u_f_y_spyactress'} 3 | animal_models = {'a_c_chickenhawk','a_c_chimp','a_c_cormorant','a_c_cow','a_c_coyote','a_c_crow','a_c_hen','a_c_deer','a_c_fish','a_c_seagull','a_c_pig','a_c_pigeon','a_c_rat'} 4 | ems_models = {'csb_mweather','csb_prolsec','csb_ramp_marine','cs_casey','cs_fbisuit_01','ig_andreas','s_f_y_ranger_01','s_f_y_scrubs_01','s_f_y_sheriff_01','s_m_m_armoured_01','s_m_m_armoured_02','s_m_m_chemsec_01','s_m_m_fiboffice_01','s_m_m_marine_01','s_m_m_marine_02','s_m_m_paramedic_01','s_m_m_prisguard_01','s_m_m_security_01','s_m_m_snowcop_01','s_m_y_blackops_01','s_m_y_blackops_02','s_m_y_doorman_01','s_m_y_fireman_01','s_m_y_hwaycop_01','s_m_y_marine_01','s_m_y_marine_02','s_m_y_marine_03','s_m_y_ranger_01','s_m_y_sheriff_01','s_m_y_swat_01'} 5 | mp_models = {'mp_f_deadhooker','mp_f_misty_01','mp_f_stripperlite','mp_g_m_pros_01','mp_m_claude_01','mp_m_exarmy_01','mp_m_famdd_01','mp_m_fibsec_01','mp_m_marston_01','mp_m_niko_01','mp_m_shopkeep_01','mp_s_m_armoured_01'} 6 | freemode_models = {'mp_m_freemode_01','mp_f_freemode_01'} 7 | menu_options = { 8 | {name = "Clothing", f = customise, param = nil}, 9 | {name = "Accessories", f = accessories, param = nil}, 10 | {name = "Face", f = overlays, param = nil}, 11 | {name = "Male models", f = listModels, param = male_models}, 12 | {name = "Female models", f = listModels, param = female_models}, 13 | {name = "Animal models", f = listModels, param = animal_models}, 14 | {name = "EMS models", f = listModels, param = ems_models}, 15 | {name = "Multiplayer models", f = listModels, param = mp_models}, 16 | {name = "Freemode models", f = listModels, param = freemode_models}, 17 | } 18 | player_data = { 19 | model = GetHashKey("mp_m_freemode_01"), 20 | new = true, 21 | clothing = { 22 | drawables = {}, 23 | textures = { 24 | 1,1,1 25 | }, 26 | palette = {}, 27 | }, 28 | props = { 29 | drawables = {}, 30 | textures = {}, 31 | }, 32 | overlays = { 33 | drawables = {}, 34 | opacity = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, 35 | colours = { 36 | {colourType = 0, colour = 0}, 37 | {colourType = 0, colour = 0}, 38 | {colourType = 0, colour = 0}, 39 | {colourType = 0, colour = 0}, 40 | {colourType = 0, colour = 0}, 41 | {colourType = 0, colour = 0}, 42 | {colourType = 0, colour = 0}, 43 | {colourType = 0, colour = 0}, 44 | {colourType = 0, colour = 0}, 45 | {colourType = 0, colour = 0}, 46 | {colourType = 0, colour = 0}, 47 | {colourType = 0, colour = 0}, 48 | {colourType = 0, colour = 0}, 49 | }, 50 | }, 51 | } 52 | local clothing_shops = { 53 | {name="Clothing Store", id=73, x=1932.76989746094, y=3727.73510742188, z=32.8444557189941}, 54 | {name="Clothing Store", id=73, x=1693.26, y=4822.27, z=42.06}, 55 | {name="Clothing Store", id=73, x=125.83, y=-223.16, z=54.55}, 56 | {name="Clothing Store", id=73, x=-710.16, y=-153.26, z=37.41}, 57 | {name="Clothing Store", id=73, x=-821.69, y=-1073.90, z=11.32}, 58 | {name="Clothing Store", id=73, x=-1192.81, y=-768.24, z=17.31}, 59 | {name="Clothing Store", id=73, x=4.25, y=6512.88, z=31.87}, 60 | {name="Clothing Store", id=73, x=425.471, y=-806.164, z=29.4911}, 61 | } 62 | incircle = false 63 | Citizen.CreateThread(function() 64 | for _, item in pairs(clothing_shops) do 65 | item.blip = AddBlipForCoord(item.x, item.y, item.z) 66 | SetBlipSprite(item.blip, item.id) 67 | SetBlipColour(item.blip, item.colour) 68 | SetBlipAsShortRange(item.blip, true) 69 | BeginTextCommandSetBlipName("STRING") 70 | AddTextComponentString(item.name) 71 | EndTextCommandSetBlipName(item.blip) 72 | end 73 | while true do 74 | Citizen.Wait(0) 75 | local pos = GetEntityCoords(GetPlayerPed(-1), true) 76 | for k,v in ipairs(clothing_shops) do 77 | if(Vdist(pos.x, pos.y, pos.z, v.x, v.y, v.z) < 15.0)then 78 | DrawMarker(1, v.x, v.y, v.z - 1, 0, 0, 0, 0, 0, 0, 3.0001, 3.0001, 0.5001, 1555, 0, 0,165, 0, 0, 0,0) 79 | if(Vdist(pos.x, pos.y, pos.z, v.x, v.y, v.z) < 2.0)then 80 | if (incircle == false) then 81 | DisplayHelpText("Press ~INPUT_CONTEXT~ to customise your character.") 82 | end 83 | incircle = true 84 | if IsControlJustReleased(1, 51) then -- INPUT_CELLPHONE_DOWN 85 | GUI.maxVisOptions = 20 86 | titleTextSize = {0.85, 0.80} ------------ {p1, Size} 87 | titleRectSize = {0.23, 0.085} ----------- {Width, Height} 88 | optionTextSize = {0.5, 0.5} ------------- {p1, Size} 89 | optionRectSize = {0.23, 0.035} ---------- {Width, Height} 90 | menuX = 0.745 ----------------------------- X position of the menu 91 | menuXOption = 0.11 --------------------- X postiion of Menu.Option text 92 | menuXOtherOption = 0.06 ---------------- X position of Bools, Arrays etc text 93 | menuYModify = 0.1500 -------------------- Default: 0.1174 ------ Top bar 94 | menuYOptionDiv = 4.285 ------------------ Default: 3.56 ------ Distance between buttons 95 | menuYOptionAdd = 0.21 ------------------ Default: 0.142 ------ Move buttons up and down 96 | clothing_menu = not clothing_menu 97 | OpenClothes() 98 | end 99 | elseif(Vdist(pos.x, pos.y, pos.z, v.x, v.y, v.z) > 3.0)then 100 | incircle = false 101 | if clothing_menu then 102 | save() 103 | end 104 | clothing_menu = false 105 | end 106 | end 107 | end 108 | if clothing_menu then 109 | Menu.DisplayCurMenu() 110 | end 111 | end 112 | end) -------------------------------------------------------------------------------- /clothing/client.lua: -------------------------------------------------------------------------------- 1 | local firstSpawn = true 2 | local componentScroller = 0 3 | local subComponentScroller = 0 4 | local textureScroller = 0 5 | local paletteScroller = 0 6 | local removeScroller = 0 7 | local opacityScroller = 0 8 | local colourScroller = 0 9 | 10 | function OpenClothes() 11 | Menu.SetupMenu("clothing_main","Clothing") 12 | Menu.Switch(nil, "clothing_main") 13 | for k,v in pairs(menu_options) do 14 | Menu.addOption("clothing_main", function() 15 | if(Menu.Option(v.name))then 16 | v.f(v.name,v.param) 17 | end 18 | end) 19 | end 20 | end 21 | 22 | function listModels(title, table) 23 | Menu.SetupMenu("clothing_models", title) 24 | Menu.Switch("clothing_main", "clothing_models") 25 | for k,v in pairs(table) do 26 | Menu.addOption("clothing_models", function() 27 | if(Menu.Option(v))then 28 | TriggerEvent("clothes:changemodel", v) 29 | end 30 | end) 31 | end 32 | end 33 | 34 | function customise(title) 35 | Menu.SetupMenu("clothing_customise", title) 36 | Menu.Switch("clothing_main", "clothing_customise") 37 | if GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_m_freemode_01") or GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_f_freemode_01") then 38 | componentScroller = 0 39 | subComponentScroller = GetPedDrawableVariation(GetPlayerPed(-1), componentScroller) 40 | textureScroller = GetPedTextureVariation(GetPlayerPed(-1), componentScroller) 41 | paletteScroller = GetPedPaletteVariation(GetPlayerPed(-1), componentScroller) 42 | Menu.addOption("clothing_customise", function() 43 | if(Menu.ScrollBarString({"Head","Mask","Hair","Arms","Pants","Parachutes","Shoes","Necklace & Ties","Undershirt","Body Armour","Decals","Shirts"}, componentScroller, function(cb) componentScroller = cb end)) then 44 | subComponentScroller = GetPedDrawableVariation(GetPlayerPed(-1), componentScroller) 45 | textureScroller = GetPedTextureVariation(GetPlayerPed(-1), componentScroller) 46 | paletteScroller = GetPedPaletteVariation(GetPlayerPed(-1), componentScroller) 47 | end 48 | end) 49 | Menu.addOption("clothing_customise", function() 50 | if(Menu.ScrollBarInt("Components", subComponentScroller, GetNumberOfPedDrawableVariations(GetPlayerPed(-1), componentScroller), function(cb) subComponentScroller = cb end)) then 51 | if componentScroller == 0 then 52 | SetPedHeadBlendData(GetPlayerPed(-1), subComponentScroller, subComponentScroller, 0, subComponentScroller, subComponentScroller, 0, 0.5, 0.5, 0.0, false) 53 | end 54 | SetPedComponentVariation(GetPlayerPed(-1), componentScroller, 0, 240, 0) 55 | SetPedComponentVariation(GetPlayerPed(-1), componentScroller, subComponentScroller, textureScroller, paletteScroller) 56 | textureScroller = 0 57 | paletteScroller = 0 58 | end 59 | end) 60 | Menu.addOption("clothing_customise", function() 61 | local textureMax = 0 62 | if componentScroller == 2 then textureMax = GetNumHairColors() else textureMax = GetNumberOfPedTextureVariations(GetPlayerPed(-1), componentScroller, subComponentScroller) end 63 | if(Menu.ScrollBarInt("Textures", textureScroller, textureMax, function(cb) textureScroller = cb end)) then 64 | if componentScroller == 2 then 65 | SetPedComponentVariation(GetPlayerPed(-1), componentScroller, subComponentScroller, 0, 1) 66 | SetPedHairColor(GetPlayerPed(-1), textureScroller, textureScroller) 67 | player_data.clothing.textures[3] = textureScroller 68 | else 69 | SetPedComponentVariation(GetPlayerPed(-1), componentScroller, subComponentScroller, textureScroller, paletteScroller) 70 | end 71 | end 72 | end) 73 | Menu.addOption("clothing_customise", function() 74 | if(Menu.ScrollBarInt("Colour Palette", paletteScroller, 2, function(cb) paletteScroller = cb end)) then 75 | SetPedComponentVariation(GetPlayerPed(-1), componentScroller, subComponentScroller, textureScroller, paletteScroller) 76 | end 77 | end) 78 | Menu.addOption("clothing_customise", function() 79 | if(Menu.Option("Remove Undershirt"))then 80 | SetPedComponentVariation(GetPlayerPed(-1), 8, 0, 240, 0) 81 | end 82 | end) 83 | Menu.addOption("clothing_customise", function() 84 | if(Menu.Option("Randomize"))then 85 | SetPedRandomComponentVariation(GetPlayerPed(-1), true) 86 | end 87 | end) 88 | else 89 | componentScroller = 0 90 | subComponentScroller = GetPedDrawableVariation(GetPlayerPed(-1), componentScroller) 91 | textureScroller = GetPedTextureVariation(GetPlayerPed(-1), componentScroller) 92 | paletteScroller = GetPedPaletteVariation(GetPlayerPed(-1), componentScroller) 93 | Menu.addOption("clothing_customise", function() 94 | local precomponentTable = {"Head","No idea","Hair","Shirts","Pants","No idea","No idea","No idea","Necklace & Ties","No idea","No idea","No idea"} 95 | local componentTable = {} 96 | for i = 0, 11 do 97 | if GetNumberOfPedDrawableVariations(GetPlayerPed(-1), i) ~= 0 and GetNumberOfPedDrawableVariations(GetPlayerPed(-1), i) ~= false then 98 | componentTable[i+1] = precomponentTable[i+1] 99 | else 100 | componentTable[i+1] = "Empty slot" 101 | end 102 | end 103 | if(Menu.ScrollBarString(componentTable, componentScroller, function(cb) componentScroller = cb end)) then 104 | subComponentScroller = GetPedDrawableVariation(GetPlayerPed(-1), componentScroller) 105 | textureScroller = GetPedTextureVariation(GetPlayerPed(-1), componentScroller) 106 | paletteScroller = GetPedPaletteVariation(GetPlayerPed(-1), componentScroller) 107 | end 108 | end) 109 | Menu.addOption("clothing_customise", function() 110 | if(Menu.ScrollBarInt("Components", subComponentScroller, GetNumberOfPedDrawableVariations(GetPlayerPed(-1), componentScroller), function(cb) subComponentScroller = cb end)) then 111 | SetPedComponentVariation(GetPlayerPed(-1), componentScroller, 0, 240, 0) 112 | SetPedComponentVariation(GetPlayerPed(-1), componentScroller, subComponentScroller, textureScroller, paletteScroller) 113 | textureScroller = 0 114 | paletteScroller = 0 115 | end 116 | end) 117 | Menu.addOption("clothing_customise", function() 118 | if(Menu.ScrollBarInt("Textures", textureScroller, GetNumberOfPedTextureVariations(GetPlayerPed(-1), componentScroller, subComponentScroller), function(cb) textureScroller = cb end)) then 119 | if componentScroller == 2 then player_data.clothing.textures[3] = textureScroller end 120 | SetPedComponentVariation(GetPlayerPed(-1), componentScroller, subComponentScroller, textureScroller, paletteScroller) 121 | end 122 | end) 123 | Menu.addOption("clothing_customise", function() 124 | if(Menu.ScrollBarInt("Colour Palette", paletteScroller, 2, function(cb) paletteScroller = cb end)) then 125 | SetPedComponentVariation(GetPlayerPed(-1), componentScroller, subComponentScroller, textureScroller, paletteScroller) 126 | end 127 | end) 128 | Menu.addOption("clothing_customise", function() 129 | if(Menu.Option("Randomize"))then 130 | SetPedRandomComponentVariation(GetPlayerPed(-1), true) 131 | end 132 | end) 133 | end 134 | end 135 | 136 | function accessories(title) 137 | Menu.SetupMenu("clothing_accessories", title) 138 | Menu.Switch("clothing_main", "clothing_accessories") 139 | if GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_m_freemode_01") or GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_f_freemode_01") then 140 | componentScroller = 0 141 | subComponentScroller = GetPedPropIndex(GetPlayerPed(-1), componentScroller) 142 | textureScroller = GetPedPropTextureIndex(GetPlayerPed(-1), componentScroller) 143 | Menu.addOption("clothing_accessories", function() 144 | if(Menu.ScrollBarString({"Hats/Helmets","Glasses","Earrings","Empty slot","Empty slot","Empty slot","Left Wrist","Right Wrist"}, componentScroller, function(cb) componentScroller = cb end)) then 145 | subComponentScroller = GetPedPropIndex(GetPlayerPed(-1), componentScroller) 146 | textureScroller = GetPedPropTextureIndex(GetPlayerPed(-1), componentScroller) 147 | end 148 | end) 149 | Menu.addOption("clothing_accessories", function() 150 | if(Menu.ScrollBarInt("Components", subComponentScroller, GetNumberOfPedPropDrawableVariations(GetPlayerPed(-1), componentScroller), function(cb) subComponentScroller = cb end)) then 151 | SetPedPropIndex(GetPlayerPed(-1), componentScroller, 0, 240, 0) 152 | SetPedPropIndex(GetPlayerPed(-1), componentScroller, subComponentScroller, textureScroller, false) 153 | textureScroller = 0 154 | end 155 | end) 156 | Menu.addOption("clothing_accessories", function() 157 | if(Menu.ScrollBarInt("Textures", textureScroller, GetNumberOfPedPropTextureVariations(PlayerPedId(), componentScroller, subComponentScroller), function(cb) textureScroller = cb end)) then 158 | SetPedPropIndex(GetPlayerPed(-1), componentScroller, subComponentScroller, textureScroller, false) 159 | end 160 | end) 161 | Menu.addOption("clothing_accessories", function() 162 | if(Menu.ScrollBarStringSelect({"Remove helmets","Remove glasses","Remove earrings","Remove left wrist","Remove right wrist"}, removeScroller, function(cb) removeScroller = cb end)) then 163 | if removeScroller ~= 3 and removeScroller ~= 4 then 164 | ClearPedProp(GetPlayerPed(-1), tonumber(removeScroller)) 165 | elseif removeScroller == 3 then 166 | ClearPedProp(GetPlayerPed(-1), 6) 167 | else 168 | ClearPedProp(GetPlayerPed(-1), 7) 169 | end 170 | end 171 | end) 172 | Menu.addOption("clothing_accessories", function() 173 | if(Menu.Option("Randomize"))then 174 | SetPedRandomProps(GetPlayerPed(-1)) 175 | end 176 | end) 177 | else 178 | local precomponentTable = {"Hats/Helmets","Glasses","Earrings","Empty slot","Empty slot","Empty slot","Left Wrist","Right Wrist"} 179 | local componentTable = {} 180 | for i = 0, 7 do 181 | if GetNumberOfPedPropDrawableVariations(GetPlayerPed(-1), i) ~= 0 and GetNumberOfPedPropDrawableVariations(GetPlayerPed(-1), i) ~= false then 182 | componentTable[i+1] = precomponentTable[i+1] 183 | else 184 | componentTable[i+1] = "Empty slot" 185 | end 186 | end 187 | componentScroller = 0 188 | subComponentScroller = GetPedDrawableVariation(GetPlayerPed(-1), componentScroller) 189 | textureScroller = GetPedTextureVariation(GetPlayerPed(-1), componentScroller) 190 | Menu.addOption("clothing_accessories", function() 191 | if(Menu.ScrollBarString(componentTable, componentScroller, function(cb) componentScroller = cb end)) then 192 | subComponentScroller = GetPedPropIndex(GetPlayerPed(-1), componentScroller) 193 | textureScroller = GetPedPropTextureIndex(GetPlayerPed(-1), componentScroller) 194 | end 195 | end) 196 | Menu.addOption("clothing_accessories", function() 197 | if(Menu.ScrollBarInt("Components", subComponentScroller, GetNumberOfPedPropDrawableVariations(GetPlayerPed(-1), componentScroller), function(cb) subComponentScroller = cb end)) then 198 | SetPedPropIndex(GetPlayerPed(-1), componentScroller, 0, 240, 0) 199 | SetPedPropIndex(GetPlayerPed(-1), componentScroller, subComponentScroller, textureScroller, false) 200 | textureScroller = 0 201 | end 202 | end) 203 | Menu.addOption("clothing_accessories", function() 204 | if(Menu.ScrollBarInt("Textures", textureScroller, GetNumberOfPedTextureVariations(GetPlayerPed(-1), componentScroller, subComponentScroller), function(cb) textureScroller = cb end)) then 205 | SetPedPropIndex(GetPlayerPed(-1), componentScroller, subComponentScroller, textureScroller, false) 206 | end 207 | end) 208 | Menu.addOption("clothing_accessories", function() 209 | if(Menu.ScrollBarStringSelect({"Remove helmets","Remove glasses","Remove earrings","Remove left wrist","Remove right wrist"}, removeScroller, function(cb) removeScroller = cb end)) then 210 | if removeScroller ~= 3 and removeScroller ~= 4 then 211 | ClearPedProp(GetPlayerPed(-1), tonumber(removeScroller)) 212 | elseif removeScroller == 3 then 213 | ClearPedProp(GetPlayerPed(-1), 6) 214 | else 215 | ClearPedProp(GetPlayerPed(-1), 7) 216 | end 217 | end 218 | end) 219 | Menu.addOption("clothing_accessories", function() 220 | if(Menu.Option("Randomize"))then 221 | SetPedRandomProps(GetPlayerPed(-1)) 222 | end 223 | end) 224 | end 225 | end 226 | 227 | function overlays(title) 228 | Menu.SetupMenu("clothing_overlays", title) 229 | Menu.Switch("clothing_main", "clothing_overlays") 230 | if GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_m_freemode_01") or GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_f_freemode_01") then 231 | componentScroller = 0 232 | subComponentScroller = GetPedHeadOverlayValue(GetPlayerPed(-1), componentScroller) 233 | Menu.addOption("clothing_overlays", function() 234 | if(Menu.ScrollBarString({"Blemishes","Facial Hair","Eyebrows","Ageing","Makeup","Blush","Complexion","Sun Damage","Lipstick","Moles/Freckles","Chest hair","Body blemishes","Add Body blemishes"}, componentScroller, function(cb) componentScroller = cb end)) then 235 | subComponentScroller = GetPedHeadOverlayValue(GetPlayerPed(-1), componentScroller) 236 | end 237 | end) 238 | Menu.addOption("clothing_overlays", function() 239 | if(Menu.ScrollBarInt("Components", subComponentScroller, GetNumHeadOverlayValues(GetPlayerPed(-1), componentScroller), function(cb) subComponentScroller = cb end)) then 240 | SetPedHeadOverlay(GetPlayerPed(-1), componentScroller, subComponentScroller, 1.0) 241 | opacityScroller = 1.0 242 | end 243 | end) 244 | Menu.addOption("clothing_overlays", function() 245 | if(Menu.ScrollBarInt("Opacity", opacityScroller, 10, function(cb) opacityScroller = cb end)) then 246 | SetPedHeadOverlay(GetPlayerPed(-1), componentScroller, subComponentScroller, tonumber(opacityScroller/10)) 247 | player_data.overlays.opacity[componentScroller+1] = tonumber(opacityScroller/10) 248 | end 249 | end) 250 | Menu.addOption("clothing_overlays", function() 251 | if(Menu.ScrollBarInt("Colours", colourScroller, 63, function(cb) colourScroller = cb end)) then 252 | local colourType = 0 253 | if componentScroller == 1 or componentScroller == 2 or componentScroller == 10 then colourType = 1 elseif componentScroller == 5 or componentScroller == 8 then colourType = 2 else colourType = 0 end 254 | SetPedHeadOverlayColor(GetPlayerPed(-1), componentScroller, colourType, colourScroller, colourScroller) 255 | player_data.overlays.colours[componentScroller+1] = {colourType = colourType, colour = colourScroller} 256 | end 257 | end) 258 | else 259 | end 260 | end 261 | 262 | function save() 263 | player_data.model = GetEntityModel(GetPlayerPed(-1)) 264 | player_data.new = false 265 | for i = 0, 11 do 266 | player_data.clothing.drawables[i+1] = GetPedDrawableVariation(GetPlayerPed(-1), i) 267 | if i ~= 2 then 268 | player_data.clothing.textures[i+1] = GetPedTextureVariation(GetPlayerPed(-1), i) 269 | end 270 | player_data.clothing.palette[i+1] = GetPedPaletteVariation(GetPlayerPed(-1), i) 271 | end 272 | for i = 0, 7 do 273 | player_data.props.drawables[i+1] = GetPedPropIndex(GetPlayerPed(-1), i) 274 | player_data.props.textures[i+1] = GetPedPropTextureIndex(GetPlayerPed(-1), i) 275 | end 276 | for i = 0, 12 do 277 | player_data.overlays.drawables[i+1] = GetPedHeadOverlayValue(GetPlayerPed(-1), i) 278 | end 279 | 280 | if player_data.clothing.drawables[12] == 55 and GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_m_freemode_01") then player_data.clothing.drawables[12] = 56 SetPedComponentVariation(GetPlayerPed(-1), 11, 56, 0, 2) end 281 | if player_data.clothing.drawables[12] == 48 and GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_f_freemode_01") then player_data.clothing.drawables[12] = 49 SetPedComponentVariation(GetPlayerPed(-1), 11, 49, 0, 2) end 282 | 283 | TriggerServerEvent("clothes:save", player_data) 284 | end 285 | 286 | function DisplayHelpText(str) 287 | SetTextComponentFormat("STRING") 288 | AddTextComponentString(str) 289 | DisplayHelpTextFromStringLabel(0, 0, 1, -1) 290 | end 291 | 292 | AddEventHandler("clothes:changemodel", function(skin) 293 | local model = GetHashKey(skin) 294 | if IsModelInCdimage(model) and IsModelValid(model) then 295 | RequestModel(model) 296 | while not HasModelLoaded(model) do 297 | Citizen.Wait(0) 298 | end 299 | SetPlayerModel(PlayerId(), model) 300 | if skin ~= "mp_f_freemode_01" and skin ~= "mp_m_freemode_01" then 301 | SetPedRandomComponentVariation(GetPlayerPed(-1), true) 302 | else 303 | SetPedComponentVariation(GetPlayerPed(-1), 11, 0, 240, 0) 304 | SetPedComponentVariation(GetPlayerPed(-1), 8, 0, 240, 0) 305 | SetPedComponentVariation(GetPlayerPed(-1), 11, 6, 1, 0) 306 | end 307 | SetModelAsNoLongerNeeded(model) 308 | else 309 | end 310 | end) 311 | 312 | RegisterNetEvent("clothes:spawn") 313 | AddEventHandler("clothes:spawn", function(data) 314 | player_data = data 315 | local model = player_data.model 316 | if IsModelInCdimage(model) and IsModelValid(model) then 317 | RequestModel(model) 318 | while not HasModelLoaded(model) do 319 | Citizen.Wait(0) 320 | end 321 | SetPlayerModel(PlayerId(), model) 322 | if skin ~= "mp_f_freemode_01" and skin ~= "mp_m_freemode_01" then 323 | SetPedRandomComponentVariation(GetPlayerPed(-1), true) 324 | else 325 | SetPedComponentVariation(GetPlayerPed(-1), 11, 0, 240, 0) 326 | SetPedComponentVariation(GetPlayerPed(-1), 8, 0, 240, 0) 327 | SetPedComponentVariation(GetPlayerPed(-1), 11, 6, 1, 0) 328 | end 329 | SetModelAsNoLongerNeeded(model) 330 | if not player_data.new then 331 | TriggerEvent("clothes:setComponents") 332 | else 333 | TriggerServerEvent("clothes:loaded") 334 | end 335 | end 336 | end) 337 | 338 | AddEventHandler("clothes:setComponents", function() 339 | if GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_m_freemode_01") or GetEntityModel(GetPlayerPed(-1)) == GetHashKey("mp_f_freemode_01") then 340 | for i = 0, 11 do 341 | if i == 0 then 342 | SetPedHeadBlendData(GetPlayerPed(-1), player_data.clothing.drawables[i+1], player_data.clothing.drawables[i+1], 0, player_data.clothing.drawables[i+1], player_data.clothing.drawables[i+1], 0, 0.5, 0.5, 0.0, false) 343 | elseif i == 2 then 344 | SetPedComponentVariation(GetPlayerPed(-1), i, player_data.clothing.drawables[i+1], 0, 1) 345 | SetPedHairColor(GetPlayerPed(-1), player_data.clothing.textures[i+1], player_data.clothing.textures[i+1]) 346 | else 347 | SetPedComponentVariation(GetPlayerPed(-1), i, player_data.clothing.drawables[i+1], player_data.clothing.textures[i+1], player_data.clothing.palette[i+1]) 348 | end 349 | end 350 | for i = 0, 7 do 351 | SetPedPropIndex(GetPlayerPed(-1), i, player_data.props.drawables[i+1], player_data.props.textures[i+1], false) 352 | end 353 | for i = 0, 12 do 354 | SetPedHeadOverlay(GetPlayerPed(-1), i, player_data.overlays.drawables[i+1], player_data.overlays.opacity[i+1]) 355 | SetPedHeadOverlayColor(GetPlayerPed(-1), i, player_data.overlays.colours[i+1].colourType, player_data.overlays.colours[i+1].colour, player_data.overlays.colours[i+1].colour) 356 | end 357 | else 358 | for i = 0, 11 do 359 | SetPedComponentVariation(GetPlayerPed(-1), i, player_data.clothing.drawables[i+1], player_data.clothing.textures[i+1], player_data.clothing.palette[i+1]) 360 | end 361 | for i = 0, 7 do 362 | SetPedPropIndex(GetPlayerPed(-1), i, player_data.props.drawables[i+1], player_data.props.textures[i+1], false) 363 | end 364 | end 365 | TriggerServerEvent("clothes:loaded") 366 | end) 367 | 368 | AddEventHandler("playerSpawned", function() 369 | if firstSpawn then 370 | firstSpawn = false 371 | TriggerServerEvent("clothes:firstspawn") 372 | else 373 | TriggerServerEvent("clothes:spawn") 374 | end 375 | end) 376 | -------------------------------------------------------------------------------- /clothing/gui.lua: -------------------------------------------------------------------------------- 1 | GUI = {} 2 | Menu = {} 3 | 4 | Menus = {} 5 | 6 | --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- 7 | --==============================================================================================-- 8 | -- Settings -- 9 | --==============================================================================================-- 10 | --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- 11 | GUI.maxVisOptions = 10 ------------------------ Max options to show on the menu -- 12 | GUI.titleText = {255, 255, 255, 255, 1} ------- Color of title text -- 13 | GUI.titleRect = {0, 82, 165, 255} ------------- Color of rectangle [title] -- 14 | GUI.optionText = {255, 255, 255, 255, 6} ------ Color of option text -- 15 | GUI.optionRect = {40, 40, 40, 190} ------------ Color of option rectangles -- 16 | GUI.scroller = {0, 128, 255, 255} ----------- Color of active option -- 17 | titleTextSize = {0.85, 0.80} ------------ {p1, Size} -- 18 | titleRectSize = {0.16, 0.085} ----------- {Width, Height} -- 19 | optionTextSize = {0.5, 0.5} ------------- {p1, Size} -- 20 | optionRectSize = {0.16, 0.035} ---------- {Width, Height} -- 21 | menuX = 0.75 ----------------------------- X position of the menu -- 22 | menuXOption = 0.075 --------------------- X postiion of Menu.Option text -- 23 | menuXOtherOption = 0.050 ---------------- X position of Bools, Arrays etc text -- 24 | menuYModify = 0.3000 -------------------- Default: 0.1174 ------ Top bar -- 25 | menuYOptionDiv = 8.56 ------------------ Default: 3.56 ------ Distance between buttons -- 26 | menuYOptionAdd = 0.36 ------------------ Default: 0.142 ------ Move buttons up and down -- 27 | --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- 28 | --==============================================================================================-- 29 | -- Settings -- 30 | --==============================================================================================-- 31 | --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- 32 | 33 | local menuOpen = false 34 | prevMenu = nil 35 | curMenu = nil 36 | selectPressed = false 37 | leftPressed = false 38 | rightPressed = false 39 | currentOption = 1 40 | local optionCount = 0 41 | 42 | function tablelength(T) 43 | local count = 0 44 | for _ in pairs(T) do count = count + 1 end 45 | return count 46 | end 47 | 48 | function Menu.IsOpen() 49 | return menuOpen == true 50 | end 51 | 52 | function Menu.SetupMenu(menu, title) 53 | Menus[menu] = {} 54 | Menus[menu].title = title 55 | Menus[menu].optionCount = 0 56 | Menus[menu].options = {} 57 | Menus[menu].previous = nil 58 | --currentOption = 1 59 | end 60 | 61 | function Menu.addOption(menu, option) 62 | if not (Menus[menu].title == nil) then 63 | Menus[menu].optionCount = Menus[menu].optionCount + 1 64 | Menus[menu].options[Menus[menu].optionCount] = option 65 | end 66 | end 67 | 68 | function Menu.Switch(prevmenu, menu) 69 | curMenu = menu 70 | prevMenu = prevmenu 71 | if Menus[menu] then 72 | if Menus[menu].optionCount then 73 | if Menus[menu].optionCount < currentOption then 74 | currentOption = Menus[menu].optionCount 75 | if currentOption == 0 then 76 | currentOption = 1 77 | end 78 | end 79 | end 80 | end 81 | if prevmenu ~= nil and menu ~= "" then 82 | Menus[menu].previous = prevmenu 83 | end 84 | end 85 | 86 | function Menu.DisplayCurMenu() 87 | if not (curMenu == "") then 88 | menuOpen = true 89 | Menu.Title(Menus[curMenu].title) 90 | for k,v in pairs(Menus[curMenu].options) do 91 | v() 92 | end 93 | Menu.updateSelection() 94 | end 95 | end 96 | 97 | function GUI.Text(text, color, position, size, center) 98 | SetTextCentre(center) 99 | SetTextColour(color[1], color[2], color[3], color[4]) 100 | SetTextFont(color[5]) 101 | SetTextScale(size[1], size[2]) 102 | SetTextEntry("STRING") 103 | AddTextComponentString(text) 104 | DrawText(position[1], position[2]) 105 | end 106 | 107 | function GUI.Rect(color, position, size) 108 | DrawRect(position[1], position[2], size[1], size[2], color[1], color[2], color[3], color[4]) 109 | end 110 | 111 | function Menu.Title(title) 112 | GUI.Text(title, GUI.titleText, {menuX, menuYModify - 0.02241}, titleTextSize, true) 113 | GUI.Rect(GUI.titleRect, {menuX, menuYModify}, titleRectSize) 114 | Menu.PageCounter() 115 | end 116 | 117 | function Menu.PageCounter() 118 | GUI.Text(currentOption.."/"..Menus[curMenu].optionCount, GUI.optionText, {menuX + menuXOption - 0.02, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, false) 119 | GUI.Rect(GUI.optionRect, { menuX, (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify) }, optionRectSize) 120 | RequestStreamedTextureDict("commonmenu", true) 121 | DrawSprite("commonmenu", "shop_arrows_upanddown", menuX, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify + 0.015), 0.03, 0.03, 0.0, 255, 255, 255, 255) 122 | GUI.Rect(GUI.titleRect, { menuX, (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify + 0.015) }, {optionRectSize[1], optionRectSize[2] - 0.03}) 123 | end 124 | 125 | function Menu.Option(option) 126 | optionCount = optionCount + 1 127 | 128 | local thisOption = nil 129 | if(currentOption == optionCount) then 130 | thisOption = true 131 | else 132 | thisOption = false 133 | end 134 | 135 | if(currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then 136 | GUI.Text(option, GUI.optionText, {menuX - menuXOption, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, false) 137 | GUI.Rect(GUI.optionRect, { menuX, (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify) }, optionRectSize) 138 | if(thisOption) then 139 | GUI.Rect(GUI.scroller, { menuX, (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify) }, optionRectSize) 140 | end 141 | elseif (optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then 142 | GUI.Text(option, GUI.optionText, {menuX - menuXOption, ((menuYOptionAdd - 0.018) + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify)}, optionTextSize, false) 143 | GUI.Rect(GUI.optionRect, { menuX, (menuYOptionAdd + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify) }, optionRectSize) 144 | if(thisOption) then 145 | GUI.Rect(GUI.scroller, { menuX, (menuYOptionAdd + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify) }, optionRectSize) 146 | end 147 | end 148 | 149 | if (optionCount == currentOption and selectPressed) then 150 | return true 151 | end 152 | 153 | return false 154 | end 155 | 156 | function Menu.changeMenu(option, menu) 157 | if (Menu.Option(option)) then 158 | Menu.Switch(curMenu, menu) 159 | end 160 | 161 | if(currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then 162 | GUI.Text(">>", GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, true) 163 | elseif(optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then 164 | GUI.Text(">>", GUI.optionText, { menuX + 0.068, ((menuYOptionAdd - 0.018) + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify)}, optionTextSize, true) 165 | end 166 | 167 | if (optionCount == currentOption and selectPressed) then 168 | return true 169 | end 170 | 171 | return false 172 | end 173 | 174 | function Menu.Bool(option, bool, option2, option3, cb) 175 | Menu.Option(option) 176 | 177 | if(currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then 178 | if(bool) then 179 | GUI.Text(option2, GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, true) 180 | else 181 | GUI.Text(option3, GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, true) 182 | end 183 | elseif(optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then 184 | if(bool) then 185 | GUI.Text(option2, GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify)}, optionTextSize, true) 186 | else 187 | GUI.Text(option3, GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify)}, optionTextSize, true) 188 | end 189 | end 190 | 191 | if (optionCount == currentOption and selectPressed) then 192 | cb(not bool) 193 | return true 194 | end 195 | 196 | return false 197 | end 198 | 199 | function Menu.Int(option, int, min, max, cb) 200 | Menu.Option(option); 201 | 202 | if (optionCount == currentOption) then 203 | if (leftPressed) then 204 | if(int > min) then int = int - 1 else int = max end-- : _int = max; 205 | end 206 | if (rightPressed) then 207 | if(int < max) then int = int + 1 else int = min end 208 | end 209 | end 210 | 211 | if (currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then 212 | GUI.Text(tostring(int), GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, true) 213 | elseif (optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then 214 | GUI.Text(tostring(int), GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify)}, optionTextSize, true) 215 | end 216 | 217 | if (optionCount == currentOption and selectPressed) then cb(position) return true 218 | elseif (optionCount == currentOption and leftPressed) then cb(position) 219 | elseif (optionCount == currentOption and rightPressed) then cb(position) end 220 | 221 | return false 222 | end 223 | 224 | function Menu.StringArray(option, array, position, cb) 225 | 226 | Menu.Option(option); 227 | 228 | if (optionCount == currentOption) then 229 | local max = tablelength(array) 230 | local min = 1 231 | if (leftPressed) then 232 | if(position > min) then position = position - 1 else position = max end 233 | end 234 | if (rightPressed) then 235 | if(position < max) then position = position + 1 else position = min end 236 | end 237 | end 238 | 239 | if (currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then 240 | GUI.Text(array[position], GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, true) 241 | elseif (optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then 242 | GUI.Text(array[position], GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify)}, optionTextSize, true) 243 | end 244 | 245 | if (optionCount == currentOption and selectPressed) then cb(position) return true 246 | elseif (optionCount == currentOption and leftPressed) then cb(position) 247 | elseif (optionCount == currentOption and rightPressed) then cb(position) end 248 | 249 | return false 250 | end 251 | 252 | function Menu.ScrollBarStringSelect(array, min, cb) 253 | 254 | local currentPosition = min -- Scroller Position 255 | local maxPosition = tablelength(array) 256 | 257 | Menu.Option(array[currentPosition+1]) 258 | local bar = { 259 | x = menuX, -- X Coordinate of both boxes 260 | y = (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify), -- Y Coordinate of both boxes 261 | height = optionRectSize[2]/1.5, -- Height of both boxes 262 | width = {background_box = optionRectSize[1], scroller = optionRectSize[1]/5}, -- Width?? 263 | } 264 | 265 | if (optionCount == currentOption) then 266 | if (leftPressed) then 267 | if currentPosition > 0 then currentPosition = currentPosition-1 elseif currentPosition == 0 then currentPosition = maxPosition-1 else currentPosition = min end 268 | end 269 | if (rightPressed) then -- right 270 | if currentPosition < maxPosition-1 then currentPosition = currentPosition+1 elseif currentPosition == maxPosition-1 then currentPosition = 0 else currentPosition = maxPosition-1 end 271 | end 272 | end 273 | 274 | if(currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then 275 | bar.y = (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify) 276 | DrawRect(bar.x, bar.y, bar.width.background_box, bar.height, GUI.optionRect[1], GUI.optionRect[2], GUI.optionRect[3], GUI.optionRect[4]) -- Background 277 | local new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) + (((bar.width.background_box - bar.width.scroller) / (maxPosition-1)) * currentPosition) 278 | if new_x < (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MIN 279 | if new_x > (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MAX 280 | DrawRect(new_x,bar.y,bar.width.scroller,bar.height, GUI.scroller[1], GUI.scroller[2]-36, GUI.scroller[3]-72, GUI.scroller[4]) -- Scroller 281 | elseif (optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then 282 | bar.y = (menuYOptionAdd + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify) 283 | DrawRect(bar.x, bar.y, bar.width.background_box, bar.height, GUI.optionRect[1], GUI.optionRect[2], GUI.optionRect[3], GUI.optionRect[4]) -- Background 284 | local new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) + (((bar.width.background_box - bar.width.scroller) / (maxPosition-1)) * currentPosition) 285 | if new_x < (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MIN 286 | if new_x > (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MAX 287 | DrawRect(new_x,bar.y,bar.width.scroller,bar.height, GUI.scroller[1], GUI.scroller[2]-36, GUI.scroller[3]-72, GUI.scroller[4]) -- Scroller 288 | end 289 | 290 | if (optionCount == currentOption and selectPressed) then cb(currentPosition) return true 291 | elseif (optionCount == currentOption and leftPressed) then cb(currentPosition) return false 292 | elseif (optionCount == currentOption and rightPressed) then cb(currentPosition) return false end 293 | return false 294 | end 295 | 296 | function Menu.ScrollBarString(array, min, cb) 297 | 298 | local currentPosition = min -- Scroller Position 299 | local maxPosition = tablelength(array) 300 | 301 | Menu.Option(array[currentPosition+1]) 302 | local bar = { 303 | x = menuX, -- X Coordinate of both boxes 304 | y = (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify), -- Y Coordinate of both boxes 305 | height = optionRectSize[2]/1.5, -- Height of both boxes 306 | width = {background_box = optionRectSize[1], scroller = optionRectSize[1]/5}, -- Width?? 307 | } 308 | 309 | if (optionCount == currentOption) then 310 | if (leftPressed) then 311 | if currentPosition > 0 then currentPosition = currentPosition-1 elseif currentPosition == 0 then currentPosition = maxPosition-1 else currentPosition = min end 312 | end 313 | if (rightPressed) then -- right 314 | if currentPosition < maxPosition-1 then currentPosition = currentPosition+1 elseif currentPosition == maxPosition-1 then currentPosition = 0 else currentPosition = maxPosition-1 end 315 | end 316 | end 317 | 318 | if(currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then 319 | bar.y = (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify) 320 | DrawRect(bar.x, bar.y, bar.width.background_box, bar.height, GUI.optionRect[1], GUI.optionRect[2], GUI.optionRect[3], GUI.optionRect[4]) -- Background 321 | local new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) + (((bar.width.background_box - bar.width.scroller) / (maxPosition-1)) * currentPosition) 322 | if new_x < (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MIN 323 | if new_x > (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MAX 324 | DrawRect(new_x,bar.y,bar.width.scroller,bar.height, GUI.scroller[1], GUI.scroller[2]-36, GUI.scroller[3]-72, GUI.scroller[4]) -- Scroller 325 | elseif (optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then 326 | bar.y = (menuYOptionAdd + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify) 327 | DrawRect(bar.x, bar.y, bar.width.background_box, bar.height, GUI.optionRect[1], GUI.optionRect[2], GUI.optionRect[3], GUI.optionRect[4]) -- Background 328 | local new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) + (((bar.width.background_box - bar.width.scroller) / (maxPosition-1)) * currentPosition) 329 | if new_x < (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MIN 330 | if new_x > (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MAX 331 | DrawRect(new_x,bar.y,bar.width.scroller,bar.height, GUI.scroller[1], GUI.scroller[2]-36, GUI.scroller[3]-72, GUI.scroller[4]) -- Scroller 332 | end 333 | 334 | if (optionCount == currentOption and leftPressed) then cb(currentPosition) return true 335 | elseif (optionCount == currentOption and rightPressed) then cb(currentPosition) return true end 336 | return false 337 | end 338 | 339 | function Menu.ScrollBarInt(option, min, max, cb) 340 | 341 | Menu.Option(option) 342 | local bar = { 343 | x = menuX, -- X Coordinate of both boxes 344 | y = (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify), -- Y Coordinate of both boxes 345 | height = optionRectSize[2]/1.5, -- Height of both boxes 346 | width = {background_box = optionRectSize[1], scroller = optionRectSize[1]/5}, -- Width?? 347 | } 348 | local currentPosition = min -- Scroller Position 349 | local maxPosition = max 350 | 351 | if (optionCount == currentOption) then 352 | if (leftPressed) then 353 | if currentPosition > 0 then currentPosition = currentPosition-1 elseif currentPosition == 0 then currentPosition = maxPosition-1 else currentPosition = min end 354 | end 355 | if (rightPressed) then -- right 356 | if currentPosition < maxPosition-1 then currentPosition = currentPosition+1 elseif currentPosition == maxPosition-1 then currentPosition = 0 else currentPosition = maxPosition-1 end 357 | end 358 | end 359 | 360 | if(currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then 361 | bar.y = (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify) 362 | DrawRect(bar.x, bar.y, bar.width.background_box, bar.height, GUI.optionRect[1], GUI.optionRect[2], GUI.optionRect[3], GUI.optionRect[4]) -- Background 363 | local new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) + (((bar.width.background_box - bar.width.scroller) / (maxPosition-1)) * currentPosition) 364 | if new_x < (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MIN 365 | if new_x > (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MAX 366 | DrawRect(new_x,bar.y,bar.width.scroller,bar.height, GUI.scroller[1], GUI.scroller[2]-36, GUI.scroller[3]-72, GUI.scroller[4]) -- Scroller 367 | elseif (optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then 368 | bar.y = (menuYOptionAdd + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify) 369 | DrawRect(bar.x, bar.y, bar.width.background_box, bar.height, GUI.optionRect[1], GUI.optionRect[2], GUI.optionRect[3], GUI.optionRect[4]) -- Background 370 | local new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) + (((bar.width.background_box - bar.width.scroller) / (maxPosition-1)) * currentPosition) 371 | if new_x < (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MIN 372 | if new_x > (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MAX 373 | DrawRect(new_x,bar.y,bar.width.scroller,bar.height, GUI.scroller[1], GUI.scroller[2]-36, GUI.scroller[3]-72, GUI.scroller[4]) -- Scroller 374 | end 375 | 376 | if (optionCount == currentOption and leftPressed) then cb(currentPosition) return true 377 | elseif (optionCount == currentOption and rightPressed) then cb(currentPosition) return true end 378 | return false 379 | end 380 | 381 | function Menu.updateSelection() 382 | selectPressed = false; 383 | leftPressed = false; 384 | rightPressed = false; 385 | 386 | if IsControlJustPressed(1, 173) then 387 | if(currentOption < optionCount) then 388 | currentOption = currentOption + 1 389 | else 390 | currentOption = 1 391 | end 392 | elseif IsControlJustPressed(1, 172) then 393 | if(currentOption > 1) then 394 | currentOption = currentOption - 1 395 | else 396 | currentOption = optionCount 397 | end 398 | elseif IsControlJustPressed(1, 174) then 399 | leftPressed = true 400 | elseif IsControlJustPressed(1, 175) then 401 | rightPressed = true 402 | elseif IsControlJustPressed(1, 176) then 403 | selectPressed = true 404 | elseif IsControlJustPressed(1, 177) then 405 | if (prevMenu == nil) then 406 | Menu.Switch(nil, "") 407 | menuOpen = false 408 | if clothing_menu then 409 | save() 410 | clothing_menu = false 411 | end 412 | currentOption = 1 413 | end 414 | if not (prevMenu == nil) then 415 | if not Menus[prevMenu].previous == nil then 416 | currentOption = 1 417 | Menu.Switch(nil, prevMenu) 418 | Citizen.Trace("IS NOT NIL BUT NIL? "..prevMenu) 419 | else 420 | if Menus[prevMenu].optionCount < currentOption then 421 | currentOption = Menus[prevMenu].optionCount 422 | end 423 | Menu.Switch(Menus[prevMenu].previous, prevMenu) 424 | end 425 | end 426 | end 427 | optionCount = 0 428 | end --------------------------------------------------------------------------------