Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.17 KB | None | 0 0
  1. --[[
  2. Resource: Pudding
  3. Developers: Yolos
  4. You have no right to use this code without my permission.
  5. ]]
  6.  
  7.  
  8.  
  9. mojeW,mojeH = 1280, 1024
  10. sW,sH = guiGetScreenSize()
  11. width, height = (sW/mojeW), (sH/mojeH)
  12.  
  13.  
  14.  
  15. GUIEditor = {
  16. gridlist = {},
  17. progressbar = {},
  18. button = {},
  19. window = {}
  20. }
  21.  
  22. function przecinek(liczba)
  23. local format = liczba
  24. while true do
  25. format, k = string.gsub(format, "^(-?%d+)(%d%d%d)", '%1,%2')
  26. if ( k==0 ) then
  27. break
  28. end
  29. end
  30. return format
  31. end
  32.  
  33. local cenaCzesci={
  34.  
  35. [1025]=5000,
  36. [1073]=2000,
  37. [1074]=8000,
  38. [1075]=2000,
  39. [1076]=2200,
  40. [1077]=1000,
  41. [1078]=5000,
  42. [1079]=2200,
  43. [1080]=3600,
  44. [1081]=2000,
  45. [1082]=5000,
  46. [1083]=6700,
  47. [1084]=1000,
  48. [1085]=3000,
  49. [1096]=3000,
  50. [1097]=7000,
  51. [1098]=3000,
  52. -- Stereo
  53. [1086]=1200,
  54. -- Spoilery
  55. [1000]=4000,
  56. [1001]=4400,
  57. [1002]=6300,
  58. [1003]=5000,
  59. [1014]=5600,
  60. [1015]=4000,
  61. [1016]=3700,
  62. [1023]=8700,
  63. [1049]=4200,
  64. [1050]=4700,
  65. [1058]=6200,
  66. [1060]=6000,
  67. [1138]=2500,
  68. [1139]=2500,
  69. [1146]=2500,
  70. [1147]=2500,
  71. [1158]=3100,
  72. [1162]=3250,
  73. [1163]=3700,
  74. [1164]=1500,
  75. -- Progi
  76. [1036]=5500,
  77. [1039]=1200,
  78. [1040]=1180,
  79. [1041]=1230,
  80. [1007]=5000,
  81. [1017]=5000,
  82. [1026]=3300,
  83. [1027]=4000,
  84. [1030]=1150,
  85. [1031]=1230,
  86. [1042]=3000,
  87. [1047]=4890,
  88. [1048]=4730,
  89. [1051]=1200,
  90. [1052]=1180,
  91. [1056]=4000,
  92. [1057]=1000,
  93. [1062]=3000,
  94. [1063]=2250,
  95. [1069]=4800,
  96. [1070]=4500,
  97. [1071]=2650,
  98. [1072]=4750,
  99. [1090]=5750,
  100. [1093]=5700,
  101. [1094]=4500,
  102. [1095]=4000,
  103. [1099]=3000,
  104. [1101]=3000,
  105. [1102]=2700,
  106. [1106]=3000,
  107. [1107]=4000,
  108. [1108]=4000,
  109. [1118]=4700,
  110. [1119]=4700,
  111. [1120]=4700,
  112. [1121]=4700,
  113. [1122]=5700,
  114. [1124]=5700,
  115. [1133]=4000,
  116. [1134]=3000,
  117. [1137]=3000,
  118.  
  119. -- Bullbar . . ? [przod]
  120. [1100]=6750,
  121. [1115]=6750,
  122. [1116]=6750,
  123. [1123]=6750,
  124. [1125]=6000,
  125. -- Bullbar . . ? [tył]
  126. [1109]=4900,
  127. [1110]=4200,
  128. -- Front Sign [figurka itd z przodu]
  129. [1111]=4650,
  130. [1112]=4650,
  131. -- Hydraulika
  132. [1087]=10000,
  133. -- Wydechy
  134. [1034]=1190,
  135. [1037]=1200,
  136. [1044]=1180,
  137. [1046]=1200,
  138. [1018]=1170,
  139. [1019]=1190,
  140. [1020]=2000,
  141. [1021]=1800,
  142. [1022]=1800,
  143. [1028]=1900,
  144. [1029]=2000,
  145. [1043]=1500,
  146. [1044]=1000,
  147. [1045]=1500,
  148. [1059]=1500,
  149. [1064]=1200,
  150. [1065]=1300,
  151. [1066]=1500,
  152. [1089]=2000,
  153. [1092]=1750,
  154. [1104]=1650,
  155. [1105]=1450,
  156. [1113]=1200,
  157. [1114]=1750,
  158. [1126]=1000,
  159. [1127]=1100,
  160. [1129]=1000,
  161. [1132]=1500,
  162. [1135]=1000,
  163. [1136]=1500,
  164.  
  165. -- Zderzaki [tylni]
  166. [1149]=2400,
  167. [1148]=2500,
  168. [1150]=2300,
  169. [1151]=2350,
  170. [1154]=2300,
  171. [1156]=2300,
  172. [1159]=2350,
  173. [1161]=2360,
  174. [1167]=2300,
  175. [1168]=2250,
  176. [1175]=2250,
  177. [1177]=2250,
  178. [1178]=2290,
  179. [1180]=2310,
  180. [1183]=2270,
  181. [1184]=2300,
  182. [1186]=2300,
  183. [1187]=2260,
  184. [1192]=2200,
  185. [1193]=2200,
  186. -- Zderzaki [pzrzód]
  187. [1171]=2350,
  188. [1172]=2500,
  189. [1140]=2350,
  190. [1141]=2500,
  191. [1117]=2500,
  192. [1152]=2300,
  193. [1153]=2350,
  194. [1155]=2300,
  195. [1153]=2300,
  196. [1157]=2300,
  197. [1160]=2400,
  198. [1165]=2400,
  199. [1166]=2300,
  200. [1169]=2300,
  201. [1170]=2350,
  202. [1173]=2350,
  203. [1174]=2250,
  204. [1176]=2250,
  205. [1179]=2350,
  206. [1181]=2250,
  207. [1182]=2230,
  208. [1185]=2300,
  209. [1188]=2320,
  210. [1189]=2290,
  211. [1190]=2250,
  212. [1191]=2210,
  213. -- Wloty [góra]
  214. [1035]=2300,
  215. [1038]=2350,
  216. [1006]=2196,
  217. [1032]=2300,
  218. [1033]=2350,
  219. [1053]=2350,
  220. [1054]=2300,
  221. [1055]=2200,
  222. [1061]=2200,
  223. [1068]=2325,
  224. [1067]=2275,
  225. [1088]=2230,
  226. [1091]=2300,
  227. [1103]=2150,
  228. [1128]=3500, -- DACH DO BLADE
  229. [1130]=3500, -- DACH DO SAVANNA
  230. [1131]=3500, -- DACH DO SAVANNA
  231. -- Wloty [przód]
  232. [1004]=2140,
  233. [1005]=2160,
  234. [1011]=2140,
  235. [1012]=2160,
  236. [1142]=2120,
  237. [1143]=2120,
  238. [1144]=2100,
  239. [1145]=2100,
  240. -- Dodatkowe lampy
  241. [1013]=4100,
  242. [1024]=4800,
  243. }
  244.  
  245. local nazwaCzesci={
  246. [1025]="Offroad",
  247. [1073]="Shadow",
  248. [1074]="Mega",
  249. [1075]="Rimshine",
  250. [1076]="Wires",
  251. [1077]="Classic",
  252. [1078]="Twist",
  253. [1079]="Cutter",
  254. [1080]="Switch",
  255. [1081]="Grove",
  256. [1082]="Import",
  257. [1083]="Dolar",
  258. [1084]="Trance",
  259. [1085]="Atomic",
  260. [1096]="Ahab",
  261. [1097]="Virtual",
  262. [1098]="Access",
  263. -- Stereo
  264. [1086]="Stereo",
  265. -- Spoilery
  266. [1000]="Pro",
  267. [1001]="Win",
  268. [1002]="Drag",
  269. [1003]="Alpha",
  270. [1014]="Champ",
  271. [1015]="Race",
  272. [1016]="Worix",
  273. [1023]="Furry",
  274. [1049]="Alien",
  275. [1050]="X-Flow",
  276. [1058]="Alien",
  277. [1060]="X-Flow",
  278. [1138]="Alien Wentyl",
  279. [1139]="X-Flow Prog",
  280. [1146]="Alien wydech",
  281. [1147]="Alien Prog",
  282. [1158]="X-Flow",
  283. [1162]="Alien",
  284. [1163]="X-Flow",
  285. [1164]="Alien",
  286. -- Progi
  287. [1036]="Alien",
  288. [1039]="X-Flow",
  289. [1040]="Alien",
  290. [1041]="X-Flow",
  291. [1007]="Czysty",
  292. [1017]="Czysty",
  293. [1026]="Alien",
  294. [1027]="Alien",
  295. [1030]="X-Flow",
  296. [1031]="X-Flow",
  297. [1042]="Chrome",
  298. [1047]="Alien",
  299. [1048]="X-Flow",
  300. [1051]="Alien",
  301. [1052]="X-Flow",
  302. [1056]="Alien",
  303. [1057]="X-Flow",
  304. [1062]="Alien",
  305. [1063]="X-Flow",
  306. [1069]="Alien",
  307. [1070]="X-Flow",
  308. [1071]="Alien",
  309. [1072]="X-Flow",
  310. [1090]="Alien",
  311. [1093]="X-Flow",
  312. [1094]="Alien",
  313. [1095]="X-Flow",
  314. [1099]="Chrome",
  315. [1101]="Chrome Flames",
  316. [1102]="Chrome Strip",
  317. [1106]="Chrome Arches",
  318. [1107]="Chrome Strip",
  319. [1108]="Chrome Strip",
  320. [1118]="Chrome Trim",
  321. [1119]="Wheel Covers",
  322. [1120]="Chrome Trim",
  323. [1121]="Wheelcovers",
  324. [1122]="Chrome Flames",
  325. [1124]="Chrome Arches",
  326. [1133]="Chrome Strip",
  327. [1134]="Chrome Strip",
  328. [1137]="Chrome Strip",
  329.  
  330. -- Bullbar . . ? [przod]
  331. [1100]="Chrome Grill",
  332. [1115]="Chrome",
  333. [1116]="Slamin",
  334. [1123]="Chrome",
  335. [1125]="Chrome Lights",
  336. -- Bullbar . . ? [tył]
  337. [1109]="Chrome",
  338. [1110]="Slamin",
  339. -- Front Sign [figurka itd z przodu]
  340. [1111]="Figurka",
  341. [1112]="Figurka",
  342. -- Hydraulika
  343. [1087]="Hydraulika",
  344. -- Wydechy
  345. [1034]="Alien",
  346. [1037]="X-Flow",
  347. [1044]="Chrome",
  348. [1046]="Alien",
  349. [1018]="Upswept",
  350. [1019]="Twin",
  351. [1020]="Large",
  352. [1021]="Medium",
  353. [1022]="Small",
  354. [1028]="Alien",
  355. [1029]="X-Flow",
  356. [1043]="Slamin",
  357. [1044]="Chrome",
  358. [1045]="X-Flow",
  359. [1059]="X-Flow",
  360. [1064]="Alien",
  361. [1065]="Alien",
  362. [1066]="X-Flow",
  363. [1089]="X-Flow",
  364. [1092]="Alien",
  365. [1104]="Chrome",
  366. [1105]="Slamin",
  367. [1113]="Chrome",
  368. [1114]="Slamin",
  369. [1126]="Chrome",
  370. [1127]="Slamin",
  371. [1129]="Chrome",
  372. [1132]="Slamin",
  373. [1135]="Slamin",
  374. [1136]="Chrome",
  375.  
  376. -- Zderzaki [tylni]
  377. [1149]="Alien",
  378. [1148]="X-Flow",
  379. [1150]="Alien",
  380. [1151]="X-Flow",
  381. [1154]="Alien",
  382. [1156]="X-Flow",
  383. [1159]="Alien",
  384. [1161]="X-Flow",
  385. [1167]="X-Flow",
  386. [1168]="Alien",
  387. [1175]="Slamin",
  388. [1177]="Slamin",
  389. [1178]="Slamin",
  390. [1180]="Chrome",
  391. [1183]="Slamin",
  392. [1184]="Chrome",
  393. [1186]="Slamin",
  394. [1187]="Chrome",
  395. [1192]="Chrome",
  396. [1193]="Slamin",
  397. -- Zderzaki [pzrzód]
  398. [1171]="Alien",
  399. [1172]="X-Flow",
  400. [1140]="X-Flow",
  401. [1141]="Alien",
  402. [1117]="Chrome",
  403. [1152]="X-Flow",
  404. [1153]="Alien",
  405. [1155]="Alien",
  406. [1157]="X-Flow",
  407. [1160]="Alien",
  408. -- Wloty [góra]
  409. [1128]="Dach", -- DACH DO BLADE
  410. [1130]="Dach", -- DACH DO SAVANNA
  411. [1131]="Dach", -- DACH DO SAVANNA
  412. -- Wloty [przód]
  413. -- Dodatkowe lampy
  414. [1013]="Lampa",
  415. [1024]="Lampa",
  416.  
  417. }
  418.  
  419.  
  420. local wykluczoneCzesci={
  421.  
  422. }
  423. local idSlotow={
  424. ["Hood"]=0,
  425. ["Vent"]=1,
  426. ["Spoiler"]=2,
  427. ["Sideskirt"]=3,
  428. ["Front Bullbars"]=4,
  429. ["Rear Bullbars"]=5,
  430. ["Headlights"]=6,
  431. ["Roof"]=7,
  432. ["Nitro"]=8,
  433. ["Hydraulics"]=9,
  434. ["Stereo"]=10,
  435. ["Unknown"]=11,
  436. ["Wheels"]=12,
  437. ["Exhaust"]=13,
  438. ["Front Bumper"]=14,
  439. ["Rear Bumper"]=15,
  440. ["Misc"]=16,
  441. }
  442.  
  443.  
  444.  
  445.  
  446.  
  447. addEvent("pokazPanelTuningu", true)
  448. addEventHandler("pokazPanelTuningu", localPlayer, function(veh)
  449. if not isElement(GUIEditor.window[1]) then
  450. if getElementData(veh, "vehicle:spawn") then
  451. setElementFrozen(veh, false)
  452. showCursor(true)
  453. veh1 = veh
  454. setElementData(localPlayer, "tune:car", veh)
  455. local screenW, screenH = guiGetScreenSize()
  456. GUIEditor.window[1] = guiCreateWindow((screenW - 888) / 2, (screenH - 546) / 2, 888*width, 546*height, "---=== Tuningowanie pojazdu ===---", false)
  457. guiWindowSetSizable(GUIEditor.window[1], false)
  458. GUIEditor.button[1] = guiCreateButton(445*width, 484*height, 233*width, 52*height, "TUNINGUJ\nDEMONTUJ", false, GUIEditor.window[1])
  459. guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
  460. GUIEditor.button[2] = guiCreateButton(212*width, 484*height, 233*width, 52*height, "ZAMKNIJ OKNO", false, GUIEditor.window[1])
  461. guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")
  462. GUIEditor.gridlist[1] = guiCreateGridList(31*width, 41*height, 827*width, 390*height, false, GUIEditor.window[1])
  463. guiGridListAddColumn(GUIEditor.gridlist[1], "ID CZESCI", 0.15)
  464. guiGridListAddColumn(GUIEditor.gridlist[1], "TYP", 0.15)
  465. guiGridListAddColumn(GUIEditor.gridlist[1], "AKCJA", 0.15)
  466. guiGridListAddColumn(GUIEditor.gridlist[1], "KOSZT CZESCI", 0.15)
  467. guiGridListAddColumn(GUIEditor.gridlist[1], "NAZWA Czesci", 0.15)
  468. -- a=0
  469. for i=0,16 do
  470. if getVehicleUpgradeOnSlot(veh, i) ~= 0 then
  471. local a = guiGridListAddRow(GUIEditor.gridlist[1])
  472. guiGridListSetItemText(GUIEditor.gridlist[1], a, 1, tostring(getVehicleUpgradeOnSlot(veh, i)), false, false)
  473. guiGridListSetItemText(GUIEditor.gridlist[1], a, 2, tostring(getVehicleUpgradeSlotName(getVehicleUpgradeOnSlot(veh, i))), false, false)
  474. guiGridListSetItemText(GUIEditor.gridlist[1], a, 3, "demtuning", false, false)
  475. if cenaCzesci[getVehicleUpgradeOnSlot(veh,i)] then
  476. guiGridListSetItemText(GUIEditor.gridlist[1], a, 4, tostring(tonumber(cenaCzesci[getVehicleUpgradeOnSlot(veh,i)]*9/10)) , false, false)
  477. else
  478. guiGridListSetItemText(GUIEditor.gridlist[1], a, 4, "--" , false, false)
  479. end
  480. if nazwaCzesci[getVehicleUpgradeOnSlot(veh,i)] then
  481. guiGridListSetItemText(GUIEditor.gridlist[1], a, 5, tostring(nazwaCzesci[getVehicleUpgradeOnSlot(veh,i)]), false, false)
  482. else
  483. guiGridListSetItemText(GUIEditor.gridlist[1], a, 5, "PuddinG" , false, false)
  484. end
  485. -- a=a+1
  486. else
  487. for i2,v2 in ipairs(getVehicleCompatibleUpgrades(veh, i)) do
  488. if cenaCzesci[v2] then
  489. if not wykluczoneCzesci[v2] then
  490. if v2 == 1164 then
  491. if getElementModel(veh) == 558 then
  492. local a=guiGridListAddRow(GUIEditor.gridlist[1])
  493. guiGridListSetItemText(GUIEditor.gridlist[1], a, 1, tostring(v2), false, false)
  494. guiGridListSetItemText(GUIEditor.gridlist[1], a, 2, tostring(getVehicleUpgradeSlotName(v2)), false, false)
  495. guiGridListSetItemText(GUIEditor.gridlist[1], a, 3, "tuning", false, false)
  496. guiGridListSetItemText(GUIEditor.gridlist[1], a, 4, tostring(przecinek(cenaCzesci[v2])), false, false)
  497. if nazwaCzesci[v2] then
  498. guiGridListSetItemText(GUIEditor.gridlist[1], a, 5, tostring(nazwaCzesci[v2]), false, false)
  499. else
  500. guiGridListSetItemText(GUIEditor.gridlist[1], a, 5, "PuddinG" , false, false)
  501. end
  502. end
  503. else
  504. local a=guiGridListAddRow(GUIEditor.gridlist[1])
  505. guiGridListSetItemText(GUIEditor.gridlist[1], a, 1, tostring(v2), false, false)
  506. guiGridListSetItemText(GUIEditor.gridlist[1], a, 2, tostring(getVehicleUpgradeSlotName(v2)), false, false)
  507. guiGridListSetItemText(GUIEditor.gridlist[1], a, 3, "tuning", false, false)
  508. guiGridListSetItemText(GUIEditor.gridlist[1], a, 4, tostring(przecinek(cenaCzesci[v2])), false, false)
  509. if nazwaCzesci[v2] then
  510. guiGridListSetItemText(GUIEditor.gridlist[1], a, 5, tostring(nazwaCzesci[v2]), false, false)
  511. else
  512. guiGridListSetItemText(GUIEditor.gridlist[1], a, 5, "PuddinG" , false, false)
  513. end
  514. -- a=a+1
  515. end
  516. end
  517. end
  518. end
  519. end
  520. end
  521.  
  522.  
  523. GUIEditor.progressbar[1] = guiCreateProgressBar(129*width, 436*height, 631*width, 38*height, false, GUIEditor.window[1])
  524. guiProgressBarSetProgress(GUIEditor.progressbar[1], 0)
  525. end
  526. else
  527. setElementData(localPlayer, "tune:car",nil)
  528. end
  529.  
  530. end)
  531.  
  532.  
  533. addEvent("ukryjPanelTuningu",true)
  534. addEventHandler("ukryjPanelTuningu", localPlayer, function()
  535. if GUIEditor.window[1] and isElement(GUIEditor.window[1]) then
  536. destroyElement(GUIEditor.window[1])
  537. setElementData(localPlayer, "tune:car",nil)
  538. showCursor(false)
  539. end
  540. end)
  541.  
  542. time=5000
  543.  
  544. function onClientGUIClick()
  545. if GUIEditor.button[2] and isElement(GUIEditor.button[2]) and source == GUIEditor.button[2] then
  546. if GUIEditor.window[1] and isElement(GUIEditor.window[1]) then
  547. destroyElement(GUIEditor.window[1])
  548. showCursor(false)
  549. end
  550. elseif GUIEditor.button[1] and isElement(GUIEditor.button[1]) and source == GUIEditor.button[1] then
  551.  
  552. if GUIEditor.progressbar[1] and isElement(GUIEditor.progressbar[1]) and GUIEditor.gridlist[1] and isElement(GUIEditor.gridlist[1]) then
  553. if guiProgressBarGetProgress(GUIEditor.progressbar[1]) == 0 or guiProgressBarGetProgress(GUIEditor.progressbar[1]) == 100 then
  554. b=0
  555. local x,y = guiGridListGetSelectedItem(GUIEditor.gridlist[1])
  556. if y == 1 then
  557. removeEventHandler("onClientGUIClick",resourceRoot, onClientGUIClick)
  558.  
  559. setTimer(function()
  560. b=b+1
  561. if GUIEditor.progressbar[1] and isElement(GUIEditor.progressbar[1]) then
  562. guiProgressBarSetProgress(GUIEditor.progressbar[1], b)
  563. end
  564. end,time/100,100)
  565.  
  566. setTimer(function()
  567. addEventHandler("onClientGUIClick",resourceRoot, onClientGUIClick)
  568. local text1 = guiGridListGetItemText(GUIEditor.gridlist[1], x, 1) -- ID
  569. local text2 = guiGridListGetItemText(GUIEditor.gridlist[1], x, 2) -- TYP
  570. local text3 = guiGridListGetItemText(GUIEditor.gridlist[1], x, 3) -- AKCJA
  571. local text4 = guiGridListGetItemText(GUIEditor.gridlist[1], x, 4) -- CENA
  572. local text5 = guiGridListGetItemText(GUIEditor.gridlist[1], x, 5) -- nazwa
  573. if text1 and tonumber(text1) and text4 and tonumber(text4) and text3 and tostring(text3) then
  574. -- if not wykluczoneCzesci[tonumber(text1)] then
  575. if cenaCzesci[tonumber(text1)] then
  576. if veh1 and isElement(veh1) and getElementType(veh1) == "vehicle" then
  577. triggerServerEvent("montazElementu", root, veh1, text3, text1, text4, text5)
  578. end
  579. end
  580. end
  581. -- end
  582. end,time*1.14,1)
  583. end
  584. end
  585. end
  586. end
  587. end
  588.  
  589. addEventHandler("onClientGUIClick",resourceRoot, onClientGUIClick)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement