Heist83 Posted June 12, 2015 Share Posted June 12, 2015 Hi guys, I guess I'm hitting the best of my understanding and I'd need some help to finish this code. I know it's messy and kind of buggy atm but it's not far from a cool release. A good coder could reduce that by 1/4th at least... Features : 24 fuel station + 4 los santos custom + 8 other Los santos places turned into working garages where you can repair, repaint & upgrade your car against money (press E to buy, space to skip, editable). A mecanic ped is spawned when you're in the area, he will get to your car when in a garage & will peform mecanic mimics. Freepaint is given to you at the end of operations if you're not happy with the color. Random safety message displays when you leave a garage. Bugs : Timings are not well set. Ped animations are not working. Message display flickers (didn't have that bug in previous version but I didn't backup, silly me). Sometime ped won't despawn. Sometime money from another function is set to the actual thing you buy. Maybe others. Credits goes to AlexanderBlade for the Hook, Headscript for the Lua plugin, Szabo & Foul_Play for some code. local garageservice = {}local buyKey = Keys.Elocal skipKey = Keys.Spacelocal invincible_option = on --on/off--fuel station garageslocal location01 = {-2097.0908203125, -322.20083618164, 13.168636322021} -- Del Perro Freeway gas station (5)local location02 = {-2555.1474609375, 2334.4899902344, 33.077980041504} -- Lago Zancudo gas station (8)local location03 = {-1798.1348876953, 801.46899414063, 138.65121459961} -- Richman Glenn gas station (14)local location04 = {621.08526611328, 269.427734375, 103.08938598633} -- Fenwell Place gas station (17)local location05 = {819.12731933594, -1027.4898681641, 26.40432357781} -- Mesa gas station (4)local location06 = {1178.4267578125, -330.6076965332, 69.316551208496} -- Mirror Park gas station (22)local location07 = {1206.4202880859, 2661.4738769531, 37.899780273438} -- Route 68 gas station1 (6)local location08 = {266.59411621094, 2607.189453125, 44.854248046875} -- Route 68 gas station2 (12)local location09 = {52.539699554443, 2776.5612792969, 58.048824310303} -- Grand senora desert gas station (13)local location10 = {179.74716186523, 6603.2211914063, 31.868186950684} -- Paleto Bay gas station1 (9)local location11 = {-87.930686950684, 6415.8818359375, 31.640464782715} -- Paleto Bay gas station2 (20)local location12 = {1784.4497070313, 3332.1848144531, 41.317028045654} -- Trevor's Flywheel's garage fuel station (10)local location13 = {2679.9294433594, 3265.3486328125, 55.409393310547} -- Senora freeway gas station1 (7)local location14 = {1700.1348876953, 6417.1645507813, 32.76403427124} -- Senora freeway gas station2 (11)local location15 = {2573.90551755781, 362.04565429688, 108.46881103516} -- Tataviam freeway gas station (18)local location16 = {2535.2922363281, 2586.6567382813, 37.944828033447} -- TRex's Dinner little fuel station (23)local location17 = {1691.4418945313, 4929.3354492188, 42.231700897217} -- Grapeseed gas station (21)local location18 = {-69.783767700195, -1760.6328125, 29.53404045105} -- Davis gas station1 (2)local location19 = {265.12033081055, -1259.8956298828, 29.142913818359} -- Strawberry gas station (3)local location20 = {1204.9368896484, -1400.0958251953, 35.38553237915} -- El Burro Heights gas station (15)local location21 = {-527.01434326172, -1214.8778076172, 18.184833526611} -- Calais Avenue gas station (16)local location22 = {-724.14434814453, -937.56872558594, 19.034730911255} -- Vespucci gas station (1)local location23 = {-1431.4719238281, -276.52560424805, 46.389354705811} -- Morningwood gas station (19)local location24 = {172.36779785156, -1559.044921875, 29.246412277222} -- Davis gas station2 (24?)--los santos customslocal location25 = {-1135.2581797109, -1991.8515625, 13.167869567871} -- Airport Los Santos customslocal location26 = {713.0537109375, -1083.6721191406, 22.35346031189} -- Mesa Los Santos customslocal location27 = {-360.6435546875, -117.68118286133, 38.696392059326} -- Rockford Hills Los Santos customslocal location28 = {1206.4202880859, 2661.4738769531, 37.899780273438} -- Route 68 Los Santos customs--otherslocal location29 = {-1612.4801025391, -817.59857177734, 10.055460929871} -- Del Perro Beach warehouselocal location30 = {-723.77600097656, -937.30236816406, 19.034730911255} -- Little Seoul Car washlocal location31 = {5.2287168502808, -1409.8778076172, 29.278898239136} -- Car wash Innocence blvdlocal location32 = {-673.75732421875, -2382.6948242188, 13.820778846741} -- Airport garage 1337local location33 = {537.51385498047, -183.07482910156, 54.425807952881} -- Hawick Japan import garagelocal location34 = {-209.15835571289, 6212.3129882813, 31.489358901978} -- Paleto Bay Helmut Auto importlocal location35 = {-23.290191650391, -1083.2113037109, 26.631351470947} -- Simeon automotive garagelocal location36 = {-228.43504333496, -1083.3444824219, 22.89426612854} -- Vapid garage--priceslocal repairprice = {500,2000,8000}local repairprice1 = 500local repairprice2 = 2000local repairprice3 = 8000local repaintprice = 500local upgradeprice = 80000local invincibleprice = 250000local paymentvalue = 0local car_colors = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100","101","102","103","104","105","106","107","108","109","110","111","112","113","114","115","116","117","118","119","120","121","122","123","124","125","126","127","128","129","130","131","132","133","134","135","136","137","138","139","140","141","142","143","144","145","146","147","148","149","150","151","152","153","154","155","156","157","158","159","160"}local mecanics_models = {"S_M_Y_XMech_01", "S_M_Y_XMech_02", "A_M_Y_methhead_01", "S_M_M_AmmuCountry", "S_M_M_AutoShop_02", "CS_Clay", "IG_Cletus", "S_M_Y_DWService_02", "S_M_M_Gaffer_01","CSB_Ramp_hic", "A_M_M_Hillbilly_01", "S_M_M_Janitor", "HC_Driver", "CS_Josef", "S_M_M_LatHandy_01", "CS_JoeMinuteMan", "CS_Old_Man1A","CS_Old_Man2", "CS_Omega", "S_M_Y_PestCont_01", "S_M_Y_Pilot_01", "S_M_M_Pilot_02", "MP_M_ShopKeep_01", "CS_SiemonYetarian", "U_M_Y_Tattoo_01", "CS_Terry", "S_M_M_GenTransport"} --"3387290987 crew member hash"--messageslocal wait_msg = {"Park your car here to use our services"}local repair_msg1 = {"Press E to repair (500$) or SPACE to skip"} local repair_msg2 = {"Press E to repair (2.000$) or SPACE to skip"} local repair_msg3 = {"Press E to repair (5.000$) or SPACE to skip"} local repaint_msg = {"Press E to repaint (500$) or SPACE to skip"} local upgrade_msg = {"Press E to upgrade (80.000$) or SPACE to skip"}local invincible_msg = {"Press E to buy invincible cheat (250.000$) or SPACE to skip"}local freepaint_msg = {"Not satisfied with the color ? Press E to get a new one for free. Else, just leave."}local nocash_msg = {"Please come back with more cash", "Money often costs too much", "No money... You should go back single", "You look broke"}local cya_msg = {"Have a nice day", "Come back anytime", "Stay safe", "Thanks for choosing us", "Remember, safety first" ,"Better a thousand times careful than once dead", "Safety is a cheap and effective insurance policy", "Prepare and prevent, don't repair and repent", "Accidents hurt, safety doesn't", "Better lose one minute in life... than lose life in a minute", "Drive like your kids live here"}--triggerslocal nearradius = 90local atradius = 20local location = 0local playervehloc = 0local playerloc = 0local vehspeed = 0local repaired = falselocal repainted = falselocal upgraded = falselocal invincibled = falselocal serviceused = falselocal playeratgarage = falselocal playerinzone = falselocal servicetick = 0local timer1 = 0local timer2 = 0local timer3 = 0local timer_reached = 0local waittime1 = 60local waittime2 = 20local playerveh = 0local garageservicePed_loaded = 0local getPedtoveh = falselocal animrequest = falselocal repairanim = falselocal repaintanim = falselocal upgradeanim = falselocal sound_welcome = 0local sound_goodbye = 0local texttimer = 0local texttoshow = ""local textwaitshowed = 0local textrepairshowed = 0local textrepaintshowed = 0local textupgradeshowed = 0local textinvincibleshowed = 0local textfreepaintshowed = 0local textnocashshowed = 0local textcyashowed = 0local debugtextshowed = 0local debugtickmsg = 0function garageservice.init() unloadgarageservicePed() paymentvalue = 0 location = 0 playervehloc = 0 playerloc = 0 vehspeed = 0 repaired = false repainted = false upgraded = false invincibled = false serviceused = false playeratgarage = false playerinzone = false servicetick = 0 timer1 = 0 timer2 = 0 timer3 = 0 timer_reached = 0 waittime1 = 60 waittime2 = 20 playerveh = 0 garageservicePed_loaded = 0 getPedtoveh = false repairanim = 0 repaintanim = 0 upgradeanim = 0 sound_welcome = 0 sound_goodbye = 0 texttimer = 0 texttoshow = "" textwaitshowed = 0 textrepairshowed = 0 textrepaintshowed = 0 textupgradeshowed = 0 textinvincibleshowed = 0 textfreepaintshowed = 0 textnocashshowed = 0 textcyashowed = 0 endfunction showtext(str) texttoshow = strendlocal function drawtext() UI.SET_TEXT_FONT(0) UI.SET_TEXT_SCALE(0.4, 0.5) UI.SET_TEXT_COLOUR(255, 255, 255, 255) -- white UI.SET_TEXT_WRAP(0, 1) UI.SET_TEXT_CENTRE(true) UI.SET_TEXT_DROPSHADOW(15, 15, 0, 0, 0) UI.SET_TEXT_EDGE(5, 0, 0, 0, 255) UI._SET_TEXT_ENTRY("STRING") UI._ADD_TEXT_COMPONENT_STRING(texttoshow) UI._DRAW_TEXT(0.5, 0.1) texttimer = texttimer-1 --print(texttimer)end--main tickfunction garageservice.tick() local playerPed = PLAYER.PLAYER_PED_ID() local player = PLAYER.GET_PLAYER_PED(playerPed) local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed) if (playerExists == true) then playerloc = ENTITY.GET_ENTITY_COORDS(playerPed, true) local playerinveh = PED.IS_PED_IN_ANY_VEHICLE(playerPed, true) --print("player exists") if (playerinveh) then local dist01 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location01[1], location01[2], location01[3], true) local dist02 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location02[1], location02[2], location02[3], true) local dist03 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location03[1], location03[2], location03[3], true) local dist04 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location04[1], location04[2], location04[3], true) local dist05 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location05[1], location05[2], location05[3], true) local dist06 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location06[1], location06[2], location06[3], true) local dist07 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location07[1], location07[2], location07[3], true) local dist08 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location08[1], location08[2], location08[3], true) local dist09 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location09[1], location09[2], location09[3], true) local dist10 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location10[1], location10[2], location10[3], true) local dist11 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location11[1], location11[2], location11[3], true) local dist12 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location12[1], location12[2], location12[3], true) local dist13 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location13[1], location13[2], location13[3], true) local dist14 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location14[1], location14[2], location14[3], true) local dist15 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location15[1], location15[2], location15[3], true) local dist16 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location16[1], location16[2], location16[3], true) local dist17 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location17[1], location17[2], location17[3], true) local dist18 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location18[1], location18[2], location18[3], true) local dist19 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location19[1], location19[2], location19[3], true) local dist20 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location20[1], location20[2], location20[3], true) local dist21 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location21[1], location21[2], location21[3], true) local dist22 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location22[1], location22[2], location22[3], true) local dist23 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location23[1], location23[2], location23[3], true) local dist24 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location24[1], location24[2], location24[3], true) local dist25 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location25[1], location25[2], location25[3], true) local dist26 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location26[1], location26[2], location26[3], true) local dist27 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location27[1], location27[2], location27[3], true) local dist28 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location28[1], location28[2], location28[3], true) local dist29 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location29[1], location29[2], location29[3], true) local dist30 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location30[1], location30[2], location30[3], true) local dist31 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location31[1], location31[2], location31[3], true) local dist32 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location32[1], location32[2], location32[3], true) local dist33 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location33[1], location33[2], location33[3], true) local dist34 = GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerloc.x, playerloc.y, playerloc.z, location34[1], location34[2], location34[3], true) playerveh = PED.GET_VEHICLE_PED_IS_IN(playerPed, false) playervehloc = ENTITY.GET_ENTITY_COORDS(playerveh, true) playerloc = playervehloc vehspeed = ENTITY.GET_ENTITY_SPEED(playerveh) if (texttimer > 0) then drawtext() end --location 01 if (dist01 < nearradius) then location = location01 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist01 > atradius) then playeratgarage = false end if (dist01 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 02 if (dist02 < nearradius) then location = location02 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist02 > atradius) then playeratgarage = false end if (dist02 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 03 if (dist03 < nearradius) then location = location03 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist03 > atradius) then playeratgarage = false end if (dist03 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 04 if (dist04 < nearradius) then location = location04 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist04 > atradius) then playeratgarage = false end if (dist04 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 05 if (dist05 < nearradius) then location = location05 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist05 > atradius) then playeratgarage = false end if (dist05 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 06 if (dist06 < nearradius) then location = location06 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist06 > atradius) then playeratgarage = false end if (dist06 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 07 if (dist07 < nearradius) then location = location07 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist07 > atradius) then playeratgarage = false end if (dist07 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 08 if (dist08 < nearradius) then location = location08 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist08 > atradius) then playeratgarage = false end if (dist08 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 09 if (dist09 < nearradius) then location = location09 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist09 > atradius) then playeratgarage = false end if (dist09 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 10 if (dist10 < nearradius) then location = location10 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist10 > atradius) then playeratgarage = false end if (dist10 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 11 if (dist11 < nearradius) then location = location11 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist11 > atradius) then playeratgarage = false end if (dist11 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 12 if (dist12 < nearradius) then location = location12 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist12 > atradius) then playeratgarage = false end if (dist12 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 13 if (dist13 < nearradius) then location = location13 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist13 > atradius) then playeratgarage = false end if (dist13 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 14 if (dist14 < nearradius) then location = location14 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist14 > atradius) then playeratgarage = false end if (dist14 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 15 if (dist15 < nearradius) then location = location15 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist15 > atradius) then playeratgarage = false end if (dist15 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 16 if (dist16 < nearradius) then location = location16 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist16 > atradius) then playeratgarage = false end if (dist16 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 17 if (dist17 < nearradius) then location = location17 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist17 > atradius) then playeratgarage = false end if (dist17 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 18 if (dist18 < nearradius) then location = location18 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist18 > atradius) then playeratgarage = false end if (dist18 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 19 if (dist19 < nearradius) then location = location19 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist19 > atradius) then playeratgarage = false end if (dist19 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 20 if (dist20 < nearradius) then location = location20 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist20 > atradius) then playeratgarage = false end if (dist20 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 21 if (dist21 < nearradius) then location = location21 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist21 > atradius) then playeratgarage = false end if (dist21 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 22 if (dist22 < nearradius) then location = location22 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist22 > atradius) then playeratgarage = false end if (dist22 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 23 if (dist23 < nearradius) then location = location23 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist23 > atradius) then playeratgarage = false end if (dist23 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 24 if (dist24 < nearradius) then location = location24 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist24 > atradius) then playeratgarage = false end if (dist24 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 25 if (dist25 < nearradius) then location = location25 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist25 > atradius) then playeratgarage = false end if (dist25 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 26 if (dist26 < nearradius) then location = location26 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist26 > atradius) then playeratgarage = false end if (dist26 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 27 if (dist27 < nearradius) then location = location27 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist27 > atradius) then playeratgarage = false end if (dist27 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 28 if (dist28 < nearradius) then location = location28 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist28 > atradius) then playeratgarage = false end if (dist28 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 29 if (dist29 < nearradius) then location = location29 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist29 > atradius) then playeratgarage = false end if (dist29 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 30 if (dist30 < nearradius) then location = location30 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist30 > atradius) then playeratgarage = false end if (dist30 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 31 if (dist31 < nearradius) then location = location31 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist31 > atradius) then playeratgarage = false end if (dist31 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 32 if (dist32 < nearradius) then location = location32 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist32 > atradius) then playeratgarage = false end if (dist32 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 33 if (dist33 < nearradius) then location = location33 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist33 > atradius) then playeratgarage = false end if (dist33 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end --location 34 if (dist34 < nearradius) then location = location34 playerinzone = true if (garageservicePed_loaded == 0) then loadgarageservicePed() end if (dist34 > atradius) then playeratgarage = false end if (dist34 < atradius) then playeratgarage = true if ((vehspeed == 0) and (timer1_reached == 0)) then timer1 = timer1 + 1 if (timer1 == waittime1) then timer1 = 0 timer1_reached = 1 servicetick = 1 end end end end -- end of locations if (vehspeed > 0) then timer1 = 0 timer1_reached = 0 waittime1 = 60 if (playeratgarage == true) then getpedtoloc() end end if (playeratgarage == false) then timer1 = 0 timer3 = 0 timer1_reached = 0 waittime1 = 60 getPedtoveh = false repaired = false repainted = false upgraded = false invincibled = false servicetick = 0 animrequest = false getPedtoveh = false repairanim = false repaintanim = false upgradeanim = false if (garageservicePed_loaded == 1) then --ai anim salute player end if ((serviceused == true) and (textcyashowed == 0)) then texttimer = 120 showtext(cya_msg[math.random(#cya_msg)]) textcyashowed = 1 end end if (playerinzone == false) then location = 0 texttimer = 0 sound_welcome = 0 textcyashowed = 0 serviceused = false if (garageservicePed_loaded == 1) then unloadgarageservicePed() textwaitshowed = 0 textrepairshowed = 0 textrepaintshowed = 0 textupgradeshowed = 0 textinvincibleshowed = 0 textfreepaintshowed = 0 textnocashshowed = 0 end end if (playeratgarage == true) then UI.DISPLAY_CASH(true) if (textwaitshowed == 0) then textwaitshowed = 1 texttimer = 120 showtext(wait_msg[1]) animsalute() --print("Press E to get a free paint job - Space to skip") end if (vehspeed == 0) then if (getPedtoveh == false) then getpedtocar() getPedtoveh = true end if ((repairanim == false) and (animrequest == true)) then animrepair() repairanim = true end --[[if (repaintanim == false) then animrepair() repaintanim = true end if (upgradeanim == false) then animrepair() upgradeanim = true end]] end end if (servicetick == 1) then garageservices() end if ((dist01 > nearradius) and (dist02 > nearradius) and (dist03 > nearradius) and (dist04 > nearradius) and (dist05 > nearradius) and (dist06 > nearradius) and (dist07 > nearradius) and (dist08 > nearradius) and (dist09 > nearradius) and (dist10 > nearradius) and (dist11 > nearradius) and (dist12 > nearradius) and (dist13 > nearradius) and (dist14 > nearradius) and (dist15 > nearradius) and (dist16 > nearradius) and (dist17 > nearradius) and (dist18 > nearradius) and (dist19 > nearradius) and (dist20 > nearradius) and (dist21 > nearradius) and (dist22 > nearradius) and (dist23 > nearradius) and (dist24 > nearradius) and (dist25 > nearradius) and (dist26 > nearradius) and (dist27 > nearradius) and (dist28 > nearradius) and (dist29 > nearradius) and (dist30 > nearradius) and (dist31 > nearradius) and (dist32 > nearradius) and (dist33 > nearradius) and (dist34 > nearradius)) then playerinzone = false end -- end of player in veh end -- end of player exist end -- end of tick end function getpedtocar()AI.TASK_GO_STRAIGHT_TO_COORD(mecanicPed, playerloc.x, playerloc.y, playerloc.z, 1, -1, 0, 0.5)--AI.TASK_GO_STRAIGHT_TO_COORD(Ped ped, float x, float y, float z, float speed, int timeout, float targetHeading, float distanceToSlide)endfunction getpedtoloc()AI.TASK_GO_STRAIGHT_TO_COORD(mecanicPed, location[1], location[2], location[3], 1, -1, 0, 0.5)--AI.TASK_GO_STRAIGHT_TO_COORD(Ped ped, float x, float y, float z, float speed, int timeout, float targetHeading, float distanceToSlide)endfunction animrepair()STREAMING.REQUEST_ANIM_DICT("[email protected][email protected]@idle_b") -- idle_aAI.TASK_PLAY_ANIM(mecanicPed, "[email protected][email protected]@idle_b", "idle_b", 8.0, -1.5, -1,2, 0.445, false,false,false)endfunction animsalute()STREAMING.REQUEST_ANIM_DICT("[email protected][email protected]") -- idle_bAI.TASK_PLAY_ANIM(mecanicPed, "[email protected][email protected]", "salute", 8.0, -1.5, -1,2, 0.445, false,false,false)end--main functionfunction garageservices() if (repaired == false) then repair() end if ((repaired == true) and (repainted == false)) then timer2 = timer2 + 1 if (timer2 >= waittime2) then timer2 = 0 repaint() end end if ((repaired == true) and (repainted == true) and (upgraded == false)) then timer2 = timer2 + 1 if (timer2 >= waittime2) then timer2 = 0 upgrade() end end if ((invincible_option == on) and (repaired == true) and (repainted == true) and (upgraded == true) and (invincibled == false)) then timer2 = timer2 + 1 if (timer2 >= waittime2) then timer2 = 0 invincible() end end if ((invincible_option == off) and (repaired == true) and (repainted == true) and (upgraded == true)) then timer2 = timer2 + 1 if (timer2 >= waittime1) then timer2 = 0 freepaint() end end if ((invincible_option == on) and (repaired == true) and (repainted == true) and (upgraded == true) and (invincibled == true)) then timer2 = timer2 + 1 if (timer2 >= waittime1) then timer2 = 0 freepaint() end endend--repair functionfunction repair() moneyhash = GAMEPLAY.GET_HASH_KEY("SP0_TOTAL_CASH") if (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_one"))) then moneyhash = GAMEPLAY.GET_HASH_KEY("SP1_TOTAL_CASH") elseif (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_two"))) then moneyhash = GAMEPLAY.GET_HASH_KEY("SP2_TOTAL_CASH") end local playerPed = PLAYER.PLAYER_PED_ID() local playerveh = PED.GET_VEHICLE_PED_IS_IN(playerPed, false) local bool, playermoney = STATS.STAT_GET_INT(moneyhash, 0, -1) local healthveh = ENTITY.GET_ENTITY_HEALTH(playerveh) if (healthveh == 1000) then paymentvalue = 0 repaired = true --print("skipped") end if ((healthveh >= 850) and (healthveh < 1000)) then if (playermoney < repairprice[1]) then paymentvalue = 0 repaired = true -- skipped texttimer = 0 waittime1 = 10 --print("not enough money, repair skipped") end if (playermoney > repairprice[1]) then paymentvalue = repairprice[1] if (textrepairshowed == 0) then textrepairshowed = 1 texttimer = 400 showtext(repair_msg1[1]) animrequest = true print("Press E to repair (500$) - Space to skip") end if (get_key_pressed(buyKey)) then local repairpay = playermoney - repairprice[1] VEHICLE.SET_VEHICLE_FIXED(playerveh) playerpays() repaired = true serviceused = true texttimer = 0 servicetick = 0 timer2 = 0 timer1 = 0 timer1_reached = 0 waittime1 = 10 textrepairshowed = 0 print("car repaired") --play sound : polishing sound end if (get_key_pressed(skipKey)) then repaired = true -- skipped texttimer = 0 servicetick = 0 timer1_reached = 0 waittime1 = 10 --print("skip repair") end end end if ((healthveh < 850) and (healthveh > 500)) then if (playermoney < repairprice2) then paymentvalue = 0 repaired = true -- skipped texttimer = 0 waittime1 = 10 --print("not enough money, repair skipped") end if (playermoney > repairprice[2]) then paymentvalue = repairprice[2] if (textrepairshowed == 0) then textrepairshowed = 1 texttimer = 400 showtext(repair_msg2[1]) animrequest = true print("Press E to repair (2000$) - Space to skip") end if (get_key_pressed(buyKey)) then local repairpay = playermoney - repairprice[2] VEHICLE.SET_VEHICLE_FIXED(playerveh) playerpays() repaired = true serviceused = true texttimer = 0 servicetick = 0 timer2 = 0 timer1 = 0 timer1_reached = 0 waittime1 = 10 textrepairshowed = 0 --print("car repaired") --play sound : light hammer + polishing sound end if (get_key_pressed(skipKey)) then repaired = true -- skipped texttimer = 0 servicetick = 0 timer1_reached = 0 waittime1 = 10 --print("skip repair") end end end if (healthveh <= 500) then if (playermoney < repairprice3) then paymentvalue = 0 repaired = true -- skipped texttimer = 0 waittime1 = 10 --print("not enough money, repair skipped") end if (playermoney > repairprice[3]) then paymentvalue = repairprice[3] if (textrepairshowed == 0) then textrepairshowed = 1 texttimer = 400 showtext(repair_msg3[1]) animrequest = true print("Press E to repair (8000$) - Space to skip") end if (get_key_pressed(buyKey)) then local repairpay = playermoney - repairprice[3] VEHICLE.SET_VEHICLE_FIXED(playerveh) playerpays() repaired = true serviceused = true texttimer = 0 servicetick = 0 timer2 = 0 timer1 = 0 timer1_reached = 0 waittime1 = 10 textrepairshowed = 0 print("car repaired") --play sound : heavy hammer + polishing sound end if (get_key_pressed(skipKey)) then repaired = true -- skipped texttimer = 0 timer1_reached = 0 waittime1 = 10 --print("skip repair") end end end timer2 = 0end--repaint functionfunction repaint() moneyhash = GAMEPLAY.GET_HASH_KEY("SP0_TOTAL_CASH") if (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_one"))) then moneyhash = GAMEPLAY.GET_HASH_KEY("SP1_TOTAL_CASH") elseif (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_two"))) then moneyhash = GAMEPLAY.GET_HASH_KEY("SP2_TOTAL_CASH") end local playerPed = PLAYER.PLAYER_PED_ID() local playerveh = PED.GET_VEHICLE_PED_IS_IN(playerPed, false) local bool, playermoney = STATS.STAT_GET_INT(moneyhash, 0, -1) local stars = PLAYER.GET_PLAYER_WANTED_LEVEL(playerPed) local rdm_color_pick = math.random(#car_colors) local secondary_color = rdm_color_pick if (playermoney < repaintprice) then paymentvalue = 0 repainted = true -- skipped texttimer = 0 waittime1 = 10 --print("not enough money, repaint skipped") end if (playermoney > repaintprice) then paymentvalue = repaintprice if (textrepaintshowed == 0) then textrepaintshowed = 1 texttimer = 400 showtext(repaint_msg[1]) animrequest = true print("Press E to buy paintjob (500$) - Space to skip") end if (get_key_pressed(buyKey)) then VEHICLE.SET_VEHICLE_COLOURS(playerveh, rdm_color_pick, secondary_color) playerpays() repainted = true serviceused = true texttimer = 0 servicetick = 0 timer2 = 0 timer1 = 0 timer1_reached = 0 waittime1 = 10 textrepaintshowed = 0 print("car repainted") -- play sound : spray paint if (stars > 0) then PLAYER.SET_PLAYER_WANTED_LEVEL(player, 0, false) PLAYER.SET_PLAYER_WANTED_LEVEL_NOW(playerID, false) end end if (get_key_pressed(skipKey)) then repainted = true -- skipped texttimer = 0 timer1_reached = 0 waittime1 = 10 --print("skip repaint") end end timer2 = 0end-- upgrade functionfunction upgrade() moneyhash = GAMEPLAY.GET_HASH_KEY("SP0_TOTAL_CASH") if (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_one"))) then moneyhash = GAMEPLAY.GET_HASH_KEY("SP1_TOTAL_CASH") elseif (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_two"))) then moneyhash = GAMEPLAY.GET_HASH_KEY("SP2_TOTAL_CASH") end local playerPed = PLAYER.PLAYER_PED_ID() local playerveh = PED.GET_VEHICLE_PED_IS_IN(playerPed, false) local bool, playermoney = STATS.STAT_GET_INT(moneyhash, 0, -1) --find a way to autoskip when car is already modified or pay only non present tuning parts if (playermoney < upgradeprice) then paymentvalue = 0 upgraded = true -- skipped texttimer = 0 waittime1 = 10 --print("not enough money, upgrades skipped") end if (playermoney > upgradeprice) then paymentvalue = upgradeprice if (textupgradeshowed == 0) then textupgradeshowed = 1 texttimer = 400 showtext(upgrade_msg[1]) animrequest = true print("Press E to buy upgrades (80000$) - Space to skip") end if (get_key_pressed(buyKey)) then VEHICLE.TOGGLE_VEHICLE_MOD(playerveh, 18, true) VEHICLE.SET_VEHICLE_WHEEL_TYPE(playerveh, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,7)) VEHICLE.SET_VEHICLE_WINDOW_TINT(playerveh, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,6)) VEHICLE.SET_VEHICLE_MOD(playerveh, 0, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 1, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 2, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 3, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 4, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 5, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 6, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 7, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 8, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 9, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 10, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,2), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 11, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,4), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 12, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,3), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 13, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,3), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 14, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,15), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 15, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,4), false) VEHICLE.SET_VEHICLE_MOD(playerveh, 23, GAMEPLAY.GET_RANDOM_INT_IN_RANGE(0,20), true) VEHICLE.SET_VEHICLE_TYRES_CAN_BURST(playerveh, false) VEHICLE.SET_VEHICLE_WHEELS_CAN_BREAK(playerveh, false) playerpays() upgraded = true serviceused = true texttimer = 0 servicetick = 0 timer2 = 0 timer1 = 0 timer1_reached = 0 waittime1 = 10 textupgradeshowed = 0 print("car upgraded") --play sound : pneumatic screwdriver end if (get_key_pressed(skipKey)) then upgraded = true -- skipped texttimer = 0 timer1_reached = 0 waittime1 = 10 --print("skip upgrades") end end timer2 = 0end--invincible functionfunction invincible() moneyhash = GAMEPLAY.GET_HASH_KEY("SP0_TOTAL_CASH") if (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_one"))) then moneyhash = GAMEPLAY.GET_HASH_KEY("SP1_TOTAL_CASH") elseif (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_two"))) then moneyhash = GAMEPLAY.GET_HASH_KEY("SP2_TOTAL_CASH") end local playerPed = PLAYER.PLAYER_PED_ID() local playerveh = PED.GET_VEHICLE_PED_IS_IN(playerPed, false) local bool, playermoney = STATS.STAT_GET_INT(moneyhash, 0, -1) if (playermoney < invincibleprice) then paymentvalue = 0 invincibled = true -- skipped texttimer = 0 waittime1 = 10 --print("skipped") end if (playermoney > invincibleprice) then paymentvalue = invincibleprice if (textinvincibleshowed == 0) then textinvincibleshowed = 1 texttimer = 400 showtext(invincible_msg[1]) animrequest = true print("Press E to buy invincible cheat (250000$) - Space to skip") end if (get_key_pressed(buyKey)) then ENTITY.SET_ENTITY_INVINCIBLE(playerveh, true) VEHICLE.SET_VEHICLE_CAN_BREAK(playerveh, false) VEHICLE.SET_VEHICLE_ENGINE_CAN_DEGRADE(playerveh, false) VEHICLE.SET_VEHICLE_CAN_BE_VISIBLY_DAMAGED(playerveh, false) VEHICLE.SET_VEHICLE_TYRES_CAN_BURST(playerveh, false) VEHICLE.SET_VEHICLE_WHEELS_CAN_BREAK(playerveh, false) playerpays() invincibled = true serviceused = true texttimer = 0 servicetick = 0 timer2 = 0 timer1 = 0 timer1_reached = 0 waittime1 = 10 textinvincibleshowed = 0 print("car invincible") -- play sound : metallic shield sound end if (get_key_pressed(skipKey)) then invincibled = true -- skipped texttimer = 0 timer1_reached = 0 waittime1 = 10 --print("skip invincible cheat") end end timer2 = 0endfunction freepaint() local playerPed = PLAYER.PLAYER_PED_ID() local playerveh = PED.GET_VEHICLE_PED_IS_IN(playerPed, false) local stars = PLAYER.GET_PLAYER_WANTED_LEVEL(playerPed) local rdm_color_pick = math.random(#car_colors) local secondary_color = rdm_color_pick paymentvalue = 0 if (textfreepaintshowed == 0) then textfreepaintshowed = 1 texttimer = 400 showtext(freepaint_msg[1]) animrequest = true print("Press E to get a free paint job - Space to skip") end if (get_key_pressed(buyKey)) then VEHICLE.SET_VEHICLE_COLOURS(playerveh, rdm_color_pick, secondary_color) UI.DISPLAY_CASH(true) playerpays() repainted = true serviceused = true texttimer = 0 servicetick = 0 timer2 = 0 timer1 = 0 timer1_reached = 0 waittime1 = 6 textfreepaintshowed = 0 print("car repainted") --play sound : spray paint if (stars > 0) then PLAYER.SET_PLAYER_WANTED_LEVEL(player, 0, false) PLAYER.SET_PLAYER_WANTED_LEVEL_NOW(playerID, false) end end if (get_key_pressed(skipKey)) then repainted = true -- skipped texttimer = 0 waittime1 = 10 --print("skip free paint job") end timer2 = 0endfunction playerpays() moneyhash = GAMEPLAY.GET_HASH_KEY("SP0_TOTAL_CASH") if (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_one"))) then moneyhash = GAMEPLAY.GET_HASH_KEY("SP1_TOTAL_CASH") elseif (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_two"))) then moneyhash = GAMEPLAY.GET_HASH_KEY("SP2_TOTAL_CASH") end local bool, curval = STATS.STAT_GET_INT(moneyhash, 0, -1) STATS.STAT_SET_INT(moneyhash, curval-paymentvalue, true)endfunction loadgarageservicePed() local rndModel = mecanics_models[math.random(#mecanics_models)] local modelhash = GAMEPLAY.GET_HASH_KEY(rndModel) mecanicPed = PED.CREATE_PED(26, modelhash, location[1], location[2], location[3],1,false,true) if (not STREAMING.HAS_MODEL_LOADED(modelhash)) then STREAMING.REQUEST_MODEL(modelhash) while (true) do if (STREAMING.HAS_MODEL_LOADED(modelhash)) then break end wait(5) end mecanicPed = PED.CREATE_PED(26, modelhash, location[1], location[2], location[3],1,false,true) garageservicePed_loaded = 1 --print("Garage ped loaded") endendfunction unloadgarageservicePed() if (mecanicPed ~= nil) then PED.DELETE_PED(mecanicPed) garageservicePed_loaded = 0 --print("Garage ped unloaded") endendfunction garageservice.unload() unloadgarageservicePed()endreturn garageservice--[[ Things that may be usefull laterai :AI.OPEN_SEQUENCE_TASK(Object *taskSequence)AI.CLOSE_SEQUENCE_TASK(Object taskSequence)AI.TASK_GO_STRAIGHT_TO_COORD_RELATIVE_TO_ENTITY(Any p0, Any p1, float p2, float p3, float p4, float p5, Any p6)AI.TASK_STAND_STILL(Any p0, Any p1)animations : [email protected][email protected] [email protected][email protected]@idle_a [email protected] [email protected] welding_enter_dockworkerAI.SET_ANIM_LOOPED(Any p0, BOOL p1, Any p2, BOOL p3)AI.STOP_ANIM_TASK(Any p0, Any *p1, Any *p2, float p3)sounds :AUDIO._PLAY_AMBIENT_SPEECH1(PLAYER.PLAYER_PED_ID(), "HOOKER_DECLINED_TREVOR", "SPEECH_PARAMS_FORCE_SHOUTED_CLEAR", 1)"GENERIC_HI", "SPEECH_PARAMS_FORCE""GENERIC_THANKS", "SPEECH_PARAMS_FORCE_SHOUTED_CRITICAL"]] I'm counting on you guys to give me a little push, feel free to give any though about improving my mess Thanks in advance. Ps: it took me 2 weeks to write this Link to comment Share on other sites More sharing options...
ISOFX Posted June 12, 2015 Share Posted June 12, 2015 I think your message flickers because you didnt put end i think, but anyway this should work for LUA: Use the code below instead of local wait_msg = {"Park your car here to use our services"} (NOT TESTED) UI._SET_NOTIFICATION_TEXT_ENTRY("STRING")UI._ADD_TEXT_COMPONENT_STRING("Park your car here to use our services")UI._DRAW_NOTIFICATION(false, true)endendend Link to comment Share on other sites More sharing options...
Heist83 Posted June 13, 2015 Author Share Posted June 13, 2015 (edited) I just tested, didn't touch anything (apart installing the new hook) and it doesn't flickers anymore. But now text timers doesn't seem to work, it only shows up the text 1s. Thanks for your suggestion IsoFx but (you may correct me if I'm wrong) since "--messages" are just stored vars and not part of a function, they don't need any end, do they ? (I'm also using Notepad++, usually it shows me whenever I forget an end) I may try the natives you suggested, maybe I'll get better results. I'll also put this get money natives in a side function instead of repeating it, to release some space : moneyhash = GAMEPLAY.GET_HASH_KEY("SP0_TOTAL_CASH") if (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_one"))) then moneyhash = GAMEPLAY.GET_HASH_KEY("SP1_TOTAL_CASH") elseif (PED.IS_PED_MODEL(PLAYER.PLAYER_PED_ID(), GAMEPLAY.GET_HASH_KEY("player_two"))) then moneyhash = GAMEPLAY.GET_HASH_KEY("SP2_TOTAL_CASH") end Edit: can't edit first post Bugs : Action timings & text timings are not well set. Ped animations are not working. Message display flickers (didn't have that bug in previous version but I didn't backup, silly me). Sometime ped won't despawn. Sometime money from another function is set to the actual thing you buy. Player wanted level won't be set to 0 if car is repainted. If your car is fully upgraded and if you get out of the area and back to the garage with that car, you'll pay again the full upgrades (same with invincible, you can skip though). If in a garage and accelerate and park again, things can get messy, you may be able to buy invincible option before the upgrade, freepaint before invincible, etc... Locations 35 & 36 won't work, silly me has forgotten to add these in the tick ^^ Maybe others. Any tests and feedback will be greatly appreciated. Any other suggestion to improve / reduce space / clean up code is welcome. Edited June 13, 2015 by Heist83 Link to comment Share on other sites More sharing options...
Foul_Play Posted June 13, 2015 Share Posted June 13, 2015 Can you give me the latest version that you have please? I'll be cleaning it up. Link to comment Share on other sites More sharing options...
Heist83 Posted June 13, 2015 Author Share Posted June 13, 2015 (edited) https://mega.co.nz/#!TZ9GWAIR!yBxK9dwYhOEFn1momMSL6ZDxhw0EakMSZu0GbwZBJ0E Not much has changed tho, I just added 2 forgotten locations and made the money function aside. Thank you so much for all your kindness, I hope it will not delay your guard script update ! Edited June 13, 2015 by Heist83 Link to comment Share on other sites More sharing options...
Heist83 Posted June 16, 2015 Author Share Posted June 16, 2015 (edited) Not much feedback. I got text to work with adding "local" in front of showtext function. I'm trying to set up functions that gets vehicle mods & if veh is invincible so you don't pay twice for those. Mod function : function isvehmodified() local playerPed = PLAYER.PLAYER_PED_ID() local playerveh = PED.GET_VEHICLE_PED_IS_IN(playerPed, false) local vehmod11 = VEHICLE.GET_VEHICLE_MOD(playerveh, 11) -- engine mod -1/3 local vehmod12 = VEHICLE.GET_VEHICLE_MOD(playerveh, 12) -- brakes mod -1/2 local vehmod13 = VEHICLE.GET_VEHICLE_MOD(playerveh, 13) -- trans mod -1/2 local vehmod15 = VEHICLE.GET_VEHICLE_MOD(playerveh, 15) -- susp mod -1/3 local vehmod16 = VEHICLE.GET_VEHICLE_MOD(playerveh, 16) -- armor mod -1/4 local vehmod18 = VEHICLE.IS_TOGGLE_MOD_ON(playerveh, 18) -- is there a turbo false/true getvehmods = 1 vehfullymoded = false if (vehmod11 == 3) then upgrade11 = true end if (vehmod12 == 2) then upgrade12 = true end if (vehmod13 == 2) then upgrade13 = true end if (vehmod15 == 3) then upgrade15 = true end if (vehmod16 == 4) then upgrade16 = true end if (vehmod18) then upgrade18 = true end if (vehmod11 < 3) then upgrade11 = false end if (vehmod12 < 2) then upgrade12 = false end if (vehmod13 < 2) then upgrade13 = false end if (vehmod15 < 3) then upgrade15 = false end if (vehmod16 < 4) then upgrade16 = false end if (not vehmod18) then upgrade18 = false end if ((upgrade11 == true) and (upgrade12 == true) and (upgrade13 == true) and (upgrade15 == true) and (upgrade16 == true) and (upgrade18 == true)) then vehfullymoded = true upgraded = true endend It's new price system : local upgrade11engineprice = 10000local upgrade12brakesprice = 11300local upgrade13transprice = 13000local upgrade15suspprice = 2000local upgrade16armorprice = 18000local upgrade18turboprice = 8000 function setvehupgradeprice() upgradeprice = 0 upgradepriceset = 1 if (upgrade11 == false) then upgradeprice = upgradeprice+upgrade11engineprice end if (upgrade12 == false) then upgradeprice = upgradeprice+upgrade12brakesprice end if (upgrade13 == false) then upgradeprice = upgradeprice+upgrade13transprice end if (upgrade15 == false) then upgradeprice = upgradeprice+upgrade15suspprice end if (upgrade16 == false) then upgradeprice = upgradeprice+upgrade16armorprice end if (upgrade18 == false) then upgradeprice = upgradeprice+upgrade18turboprice endend (fully moded cars get upgradeprice = 0, stock cars gets upgradeprice = 62300, seems to work but needs to test with half moded veh) The tricky one, "is vehicle invincible". As I didn't find such native, I'm trying to put a damage point to entity's health and verify if that point got registered or not : function isvehinvincible() local playerPed = PLAYER.PLAYER_PED_ID() local playerveh = PED.GET_VEHICLE_PED_IS_IN(playerPed, false) local healthveh1 = ENTITY.GET_ENTITY_HEALTH(playerveh) local healthveh2 = ENTITY.GET_ENTITY_HEALTH(playerveh) -- check if better results with engine damage if (healthveh1 > 1) then if (invincibletest == 0) then healthveh1 = ENTITY.GET_ENTITY_HEALTH(playerveh) invincibletest = 1 end if (invincibletest == 1) then ENTITY.SET_ENTITY_HEALTH(playerveh, healthveh2-1) invincibletest = 2 end if (invincibletest == 2) then healthveh2 = ENTITY.GET_ENTITY_HEALTH(playerveh) if (healthveh2 == healthveh1) then vehinvincible = 1 invincibled = true invincibletest = 3 end if (healthveh2 ~= healthveh1) then ENTITY.SET_ENTITY_HEALTH(playerveh, healthveh2+1) vehinvincible = 0 invincibled = false invincibletest = 3 end end end end Function is called in the main tick if invincibletest < 3. Of course it doesn't work yet... Do you know of any other / better way to achieve this ? I'd need some help to make blips work : function addgarageblips() if (garageblipsadded == false) then local garageblip = UI.ADD_BLIP_FOR_COORD(location01[1], location01[2], location01[3]) local garageblipsprite = UI.SET_BLIP_SPRITE(garageblip, 125) -- wrench sprite local garageblipsize = UI.SET_BLIP_SCALE(garageblip, 0.7) --local garageblipcolor = SET_BLIP_COLOUR(garageblip, 3) -- 0: white, 1: red, 2: green, 3: blue, Default (Function not used): yellow garageblipsadded = true endendfunction showgarageblips() --local garageblipshow = SET_BLIP_ALPHA(garageblip, 1) garageblipshidden = falseendfunction hidegarageblips() --local garagebliphide = SET_BLIP_ALPHA(garageblip, 0) garageblipshidden = trueend blipcolor, blipshow & bliphide returns garageblip is nil. I also have troubles with text to show vars : local repairprice = {500,2000,8000}local repaintprice = 500local upgradeprice = 0local invincibleprice = 250000local pricetostring = {tostring(repairprice[1]),tostring(repairprice[2]),tostring(repairprice[3]),tostring(repaintprice),tostring(upgradeprice),tostring(invincibleprice)} local upgrade_msg = {"Press E to upgrade (",pricetostring[5],"$) or SPACE to skip"} showtext(upgrade_msg[1],upgrade_msg[2],upgrade_msg[3]) Only shows : Press E to upgrade ( What's wrong ? Any feedbach & ideas would also be gladly apreciated Edited June 17, 2015 by Heist83 Link to comment Share on other sites More sharing options...
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