diff --git a/client/clothing.lua b/client/clothing.lua index 1b8d8f3..ff6b043 100644 --- a/client/clothing.lua +++ b/client/clothing.lua @@ -1,774 +1,244 @@ -local variations = { - jackets = {male = {}, female = {}}, - hair = {male = {}, female = {}}, - bags = {male = {}, female = {}}, - visor = {male = {}, female = {}}, - gloves = { - male = { - [16] = 4, - [17] = 4, - [18] = 4, - [19] = 0, - [20] = 1, - [21] = 2, - [22] = 4, - [23] = 5, - [24] = 6, - [25] = 8, - [26] = 11, - [27] = 12, - [28] = 14, - [29] = 15, - [30] = 0, - [31] = 1, - [32] = 2, - [33] = 4, - [34] = 5, - [35] = 6, - [36] = 8, - [37] = 11, - [38] = 12, - [39] = 14, - [40] = 15, - [41] = 0, - [42] = 1, - [43] = 2, - [44] = 4, - [45] = 5, - [46] = 6, - [47] = 8, - [48] = 11, - [49] = 12, - [50] = 14, - [51] = 15, - [52] = 0, - [53] = 1, - [54] = 2, - [55] = 4, - [56] = 5, - [57] = 6, - [58] = 8, - [59] = 11, - [60] = 12, - [61] = 14, - [62] = 15, - [63] = 0, - [64] = 1, - [65] = 2, - [66] = 4, - [67] = 5, - [68] = 6, - [69] = 8, - [70] = 11, - [71] = 12, - [72] = 14, - [73] = 15, - [74] = 0, - [75] = 1, - [76] = 2, - [77] = 4, - [78] = 5, - [79] = 6, - [80] = 8, - [81] = 11, - [82] = 12, - [83] = 14, - [84] = 15, - [85] = 0, - [86] = 1, - [87] = 2, - [88] = 4, - [89] = 5, - [90] = 6, - [91] = 8, - [92] = 11, - [93] = 12, - [94] = 14, - [95] = 15, - [96] = 4, - [97] = 4, - [98] = 4, - [99] = 0, - [100] = 1, - [101] = 2, - [102] = 4, - [103] = 5, - [104] = 6, - [105] = 8, - [106] = 11, - [107] = 12, - [108] = 14, - [109] = 15, - [110] = 4, - [111] = 4, - [115] = 112, - [116] = 112, - [117] = 112, - [118] = 112, - [119] = 112, - [120] = 112, - [121] = 112, - [122] = 113, - [123] = 113, - [124] = 113, - [125] = 113, - [126] = 113, - [127] = 113, - [128] = 113, - [129] = 114, - [130] = 114, - [131] = 114, - [132] = 114, - [133] = 114, - [134] = 114, - [135] = 114, - [136] = 15, - [137] = 15, - [138] = 0, - [139] = 1, - [140] = 2, - [141] = 4, - [142] = 5, - [143] = 6, - [144] = 8, - [145] = 11, - [146] = 12, - [147] = 14, - [148] = 112, - [149] = 113, - [150] = 114, - [151] = 0, - [152] = 1, - [153] = 2, - [154] = 4, - [155] = 5, - [156] = 6, - [157] = 8, - [158] = 11, - [159] = 12, - [160] = 14, - [161] = 112, - [162] = 113, - [163] = 114, - [165] = 4, - [166] = 4, - [167] = 4, - [168] = 4, - [170] = 15, - [171] = 0, - [172] = 1, - [173] = 2, - [174] = 4, - [175] = 5, - [176] = 6, - [177] = 8, - [178] = 11, - [179] = 12, - [180] = 14, - [181] = 112, - [182] = 113, - [183] = 114, - [185] = 184, - [186] = 184, - [187] = 184, - [188] = 184, - [189] = 185, - [190] = 184, - [191] = 184, - [192] = 184, - [193] = 184, - [194] = 184, - }, - female = { - [16] = 11, - [17] = 3, - [18] = 3, - [19] = 3, - [20] = 0, - [21] = 1, - [22] = 2, - [23] = 3, - [24] = 4, - [25] = 5, - [26] = 6, - [27] = 7, - [28] = 9, - [29] = 11, - [30] = 12, - [31] = 14, - [32] = 15, - [33] = 0, - [34] = 1, - [35] = 2, - [36] = 3, - [37] = 4, - [38] = 5, - [39] = 6, - [40] = 7, - [41] = 9, - [42] = 11, - [43] = 12, - [44] = 14, - [45] = 15, - [46] = 0, - [47] = 1, - [48] = 2, - [49] = 3, - [50] = 4, - [51] = 5, - [52] = 6, - [53] = 7, - [54] = 9, - [55] = 11, - [56] = 12, - [57] = 14, - [58] = 15, - [59] = 0, - [60] = 1, - [61] = 2, - [62] = 3, - [63] = 4, - [64] = 5, - [65] = 6, - [66] = 7, - [67] = 9, - [68] = 11, - [69] = 12, - [70] = 14, - [71] = 15, - [72] = 0, - [73] = 1, - [74] = 2, - [75] = 3, - [76] = 4, - [77] = 5, - [78] = 6, - [79] = 7, - [80] = 9, - [81] = 11, - [82] = 12, - [83] = 14, - [84] = 15, - [85] = 0, - [86] = 1, - [87] = 2, - [88] = 3, - [89] = 4, - [90] = 5, - [91] = 6, - [92] = 7, - [93] = 9, - [94] = 11, - [95] = 12, - [96] = 14, - [97] = 15, - [98] = 0, - [99] = 1, - [100] = 2, - [101] = 3, - [102] = 4, - [103] = 5, - [104] = 6, - [105] = 7, - [106] = 9, - [107] = 11, - [108] = 12, - [109] = 14, - [110] = 15, - [111] = 3, - [112] = 3, - [113] = 3, - [114] = 0, - [115] = 1, - [116] = 2, - [117] = 3, - [118] = 4, - [119] = 5, - [120] = 6, - [121] = 7, - [122] = 9, - [123] = 11, - [124] = 12, - [125] = 14, - [126] = 15, - [127] = 3, - [128] = 3, - [132] = 129, - [133] = 129, - [134] = 129, - [135] = 129, - [136] = 129, - [137] = 129, - [138] = 129, - [139] = 130, - [140] = 130, - [141] = 130, - [142] = 130, - [143] = 130, - [144] = 130, - [145] = 130, - [146] = 131, - [147] = 131, - [148] = 131, - [149] = 131, - [150] = 131, - [151] = 131, - [152] = 131, - [154] = 153, - [155] = 153, - [156] = 153, - [157] = 153, - [158] = 153, - [159] = 153, - [160] = 153, - [162] = 161, - [163] = 161, - [164] = 161, - [165] = 161, - [166] = 161, - [167] = 161, - [168] = 161, - [169] = 15, - [170] = 15, - [171] = 0, - [172] = 1, - [173] = 2, - [174] = 3, - [175] = 4, - [176] = 5, - [177] = 6, - [178] = 7, - [179] = 9, - [180] = 11, - [181] = 12, - [182] = 14, - [183] = 129, - [184] = 130, - [185] = 131, - [186] = 153, - [187] = 0, - [188] = 1, - [189] = 2, - [190] = 3, - [191] = 4, - [192] = 5, - [193] = 6, - [194] = 7, - [195] = 9, - [196] = 11, - [197] = 12, - [198] = 14, - [199] = 129, - [200] = 130, - [201] = 131, - [202] = 153, - [203] = 161, - [204] = 161, - [206] = 3, - [207] = 3, - [208] = 3, - [209] = 3, - [211] = 15, - [212] = 0, - [213] = 1, - [214] = 2, - [215] = 3, - [216] = 4, - [217] = 5, - [218] = 6, - [219] = 7, - [220] = 9, - [221] = 11, - [222] = 12, - [223] = 14, - [224] = 129, - [225] = 130, - [226] = 131, - [227] = 153, - [228] = 161, - [230] = 229, - [231] = 229, - [232] = 229, - [233] = 229, - [234] = 229, - [235] = 229, - [236] = 229, - [237] = 229, - [238] = 229, - [239] = 229, - } - } -} +local clothes = { + ["top"] = { + shirt_index = nil, + shirt_texture = nil, + jacket_index = nil, + jacket_texture = nil, + gloves_index = nil, + gloves_texture = nil, + }, + ["pants"] = { + index = nil, + texture = nil + }, -local function addNewVariation(which, gender, one, two, single) - local where = variations[which][gender] - if not single then - where[one] = two - where[two] = one - else - where[one] = two - end -end + ["shoes"] = { + index = nil, + texture = nil + }, + ["neck"] = { + index = nil, + texture = nil + }, + ["mask"] = { + index = nil, + texture = nil + }, + ["vest"] = { + index = nil, + texture = nil + }, + ["bag"] = { + index = nil, + texture = nil + }, + --PROPS + ["ear"] = { + index = nil, + texture = nil + }, + ["helmet"] = { + index = nil, + texture = nil + }, -CreateThread(function() - -- male visor/Hat variations - addNewVariation("visor", "male", 9, 10) - addNewVariation("visor", "male", 18, 67) - addNewVariation("visor", "male", 82, 67) - addNewVariation("visor", "male", 44, 45) - addNewVariation("visor", "male", 50, 68) - addNewVariation("visor", "male", 51, 69) - addNewVariation("visor", "male", 52, 70) - addNewVariation("visor", "male", 53, 71) - addNewVariation("visor", "male", 62, 72) - addNewVariation("visor", "male", 65, 66) - addNewVariation("visor", "male", 73, 74) - addNewVariation("visor", "male", 76, 77) - addNewVariation("visor", "male", 79, 78) - addNewVariation("visor", "male", 80, 81) - addNewVariation("visor", "male", 91, 92) - addNewVariation("visor", "male", 104, 105) - addNewVariation("visor", "male", 109, 110) - addNewVariation("visor", "male", 116, 117) - addNewVariation("visor", "male", 118, 119) - addNewVariation("visor", "male", 123, 124) - addNewVariation("visor", "male", 125, 126) - addNewVariation("visor", "male", 127, 128) - addNewVariation("visor", "male", 130, 131) - addNewVariation("visor", "male", 135, 136) - addNewVariation("visor", "male", 137, 138) - addNewVariation("visor", "male", 139, 140) - addNewVariation("visor", "male", 142, 143) - addNewVariation("visor", "male", 147, 148) - addNewVariation("visor", "male", 151, 152) - addNewVariation("visor", "male", 127, 128) - addNewVariation("visor", "male", 130, 131) - -- female visor/Hat variations - addNewVariation("visor", "female", 43, 44) - addNewVariation("visor", "female", 49, 67) - addNewVariation("visor", "female", 64, 65) - addNewVariation("visor", "female", 65, 64) - addNewVariation("visor", "female", 51, 69) - addNewVariation("visor", "female", 50, 68) - addNewVariation("visor", "female", 52, 70) - addNewVariation("visor", "female", 62, 71) - addNewVariation("visor", "female", 72, 73) - addNewVariation("visor", "female", 75, 76) - addNewVariation("visor", "female", 78, 77) - addNewVariation("visor", "female", 79, 80) - addNewVariation("visor", "female", 18, 66) - addNewVariation("visor", "female", 66, 81) - addNewVariation("visor", "female", 81, 66) - addNewVariation("visor", "female", 86, 84) - addNewVariation("visor", "female", 90, 91) - addNewVariation("visor", "female", 103, 104) - addNewVariation("visor", "female", 108, 109) - addNewVariation("visor", "female", 115, 116) - addNewVariation("visor", "female", 117, 118) - addNewVariation("visor", "female", 122, 123) - addNewVariation("visor", "female", 124, 125) - addNewVariation("visor", "female", 126, 127) - addNewVariation("visor", "female", 129, 130) - addNewVariation("visor", "female", 134, 135) - addNewVariation("visor", "female", 136, 137) - addNewVariation("visor", "female", 138, 139) - addNewVariation("visor", "female", 141, 142) - addNewVariation("visor", "female", 146, 147) - addNewVariation("visor", "female", 150, 151) - -- male bags - addNewVariation("bags", "male", 45, 44) - addNewVariation("bags", "male", 41, 40) - addNewVariation("bags", "male", 82, 81) - addNewVariation("bags", "male", 86, 85) - -- female bags - addNewVariation("bags", "female", 45, 44) - addNewVariation("bags", "female", 41, 40) - addNewVariation("bags", "female", 82, 81) - addNewVariation("bags", "female", 86, 85) - -- male hair - addNewVariation("hair", "male", 7, 15, true) - addNewVariation("hair", "male", 43, 15, true) - addNewVariation("hair", "male", 9, 43, true) - addNewVariation("hair", "male", 11, 43, true) - addNewVariation("hair", "male", 15, 43, true) - addNewVariation("hair", "male", 16, 43, true) - addNewVariation("hair", "male", 17, 43, true) - addNewVariation("hair", "male", 20, 43, true) - addNewVariation("hair", "male", 22, 43, true) - addNewVariation("hair", "male", 45, 43, true) - addNewVariation("hair", "male", 47, 43, true) - addNewVariation("hair", "male", 49, 43, true) - addNewVariation("hair", "male", 51, 43, true) - addNewVariation("hair", "male", 52, 43, true) - addNewVariation("hair", "male", 53, 43, true) - addNewVariation("hair", "male", 56, 43, true) - addNewVariation("hair", "male", 58, 43, true) - -- female hair - addNewVariation("hair", "female", 1, 49, true) - addNewVariation("hair", "female", 2, 49, true) - addNewVariation("hair", "female", 7, 49, true) - addNewVariation("hair", "female", 9, 49, true) - addNewVariation("hair", "female", 10, 49, true) - addNewVariation("hair", "female", 11, 48, true) - addNewVariation("hair", "female", 14, 53, true) - addNewVariation("hair", "female", 15, 42, true) - addNewVariation("hair", "female", 21, 42, true) - addNewVariation("hair", "female", 23, 42, true) - addNewVariation("hair", "female", 31, 53, true) - addNewVariation("hair", "female", 39, 49, true) - addNewVariation("hair", "female", 40, 49, true) - addNewVariation("hair", "female", 42, 53, true) - addNewVariation("hair", "female", 45, 49, true) - addNewVariation("hair", "female", 48, 49, true) - addNewVariation("hair", "female", 49, 48, true) - addNewVariation("hair", "female", 52, 53, true) - addNewVariation("hair", "female", 53, 42, true) - addNewVariation("hair", "female", 54, 55, true) - addNewVariation("hair", "female", 59, 42, true) - addNewVariation("hair", "female", 59, 54, true) - addNewVariation("hair", "female", 68, 53, true) - addNewVariation("hair", "female", 76, 48, true) - -- male Top/Jacket variations - addNewVariation("jackets", "male", 29, 30) - addNewVariation("jackets", "male", 31, 32) - addNewVariation("jackets", "male", 42, 43) - addNewVariation("jackets", "male", 59, 60) - addNewVariation("jackets", "male", 68, 69) - addNewVariation("jackets", "male", 74, 75) - addNewVariation("jackets", "male", 87, 88) - addNewVariation("jackets", "male", 93, 94) - addNewVariation("jackets", "male", 99, 100) - addNewVariation("jackets", "male", 101, 102) - addNewVariation("jackets", "male", 103, 104) - addNewVariation("jackets", "male", 126, 127) - addNewVariation("jackets", "male", 129, 130) - addNewVariation("jackets", "male", 131, 132) - addNewVariation("jackets", "male", 184, 185) - addNewVariation("jackets", "male", 188, 189) - addNewVariation("jackets", "male", 194, 195) - addNewVariation("jackets", "male", 196, 197) - addNewVariation("jackets", "male", 198, 199) - addNewVariation("jackets", "male", 200, 203) - addNewVariation("jackets", "male", 202, 205) - addNewVariation("jackets", "male", 206, 207) - addNewVariation("jackets", "male", 209, 212) - addNewVariation("jackets", "male", 210, 211) - addNewVariation("jackets", "male", 217, 218) - addNewVariation("jackets", "male", 229, 230) - addNewVariation("jackets", "male", 232, 233) - addNewVariation("jackets", "male", 235, 236) - addNewVariation("jackets", "male", 241, 242) - addNewVariation("jackets", "male", 251, 253) - addNewVariation("jackets", "male", 256, 261) - addNewVariation("jackets", "male", 262, 263) - addNewVariation("jackets", "male", 265, 266) - addNewVariation("jackets", "male", 267, 268) - addNewVariation("jackets", "male", 279, 280) - addNewVariation("jackets", "male", 292, 293) - addNewVariation("jackets", "male", 294, 295) - addNewVariation("jackets", "male", 296, 297) - addNewVariation("jackets", "male", 300, 303) - addNewVariation("jackets", "male", 301, 302) - addNewVariation("jackets", "male", 305, 306) - addNewVariation("jackets", "male", 311, 312) - addNewVariation("jackets", "male", 300, 303) - addNewVariation("jackets", "male", 301, 302) - addNewVariation("jackets", "male", 305, 306) - addNewVariation("jackets", "male", 311, 312) - addNewVariation("jackets", "male", 314, 315) - addNewVariation("jackets", "male", 316, 317) - addNewVariation("jackets", "male", 318, 319) - addNewVariation("jackets", "male", 321, 322) - addNewVariation("jackets", "male", 330, 331) - addNewVariation("jackets", "male", 336, 337) - addNewVariation("jackets", "male", 339, 126) - addNewVariation("jackets", "male", 340, 341) - addNewVariation("jackets", "male", 343, 344) - addNewVariation("jackets", "male", 346, 234) - addNewVariation("jackets", "male", 347, 260) - addNewVariation("jackets", "male", 348, 349) - addNewVariation("jackets", "male", 352, 353) - addNewVariation("jackets", "male", 354, 355) - addNewVariation("jackets", "male", 359, 360) - -- female Top/Jacket variations - addNewVariation("jackets", "female", 53, 52) - addNewVariation("jackets", "female", 57, 58) - addNewVariation("jackets", "female", 62, 63) - addNewVariation("jackets", "female", 84, 85) - addNewVariation("jackets", "female", 90, 91) - addNewVariation("jackets", "female", 92, 93) - addNewVariation("jackets", "female", 94, 95) - addNewVariation("jackets", "female", 117, 118) - addNewVariation("jackets", "female", 120, 121) - addNewVariation("jackets", "female", 128, 129) - addNewVariation("jackets", "female", 187, 186) - addNewVariation("jackets", "female", 190, 191) - addNewVariation("jackets", "female", 196, 197) - addNewVariation("jackets", "female", 198, 199) - addNewVariation("jackets", "female", 200, 201) - addNewVariation("jackets", "female", 202, 205) - addNewVariation("jackets", "female", 204, 207) - addNewVariation("jackets", "female", 210, 211) - addNewVariation("jackets", "female", 213, 216) - addNewVariation("jackets", "female", 214, 215) - addNewVariation("jackets", "female", 225, 226) - addNewVariation("jackets", "female", 227, 228) - addNewVariation("jackets", "female", 239, 240) - addNewVariation("jackets", "female", 242, 243) - addNewVariation("jackets", "female", 244, 364) - addNewVariation("jackets", "female", 245, 246) - addNewVariation("jackets", "female", 249, 250) - addNewVariation("jackets", "female", 259, 261) - addNewVariation("jackets", "female", 265, 270) - addNewVariation("jackets", "female", 271, 272) - addNewVariation("jackets", "female", 274, 275) - addNewVariation("jackets", "female", 276, 277) - addNewVariation("jackets", "female", 280, 281) - addNewVariation("jackets", "female", 292, 293) - addNewVariation("jackets", "female", 305, 306) - addNewVariation("jackets", "female", 307, 308) - addNewVariation("jackets", "female", 311, 314) - addNewVariation("jackets", "female", 312, 313) - addNewVariation("jackets", "female", 316, 317) - addNewVariation("jackets", "female", 325, 326) - addNewVariation("jackets", "female", 327, 328) - addNewVariation("jackets", "female", 329, 330) - addNewVariation("jackets", "female", 332, 333) - addNewVariation("jackets", "female", 339, 340) - addNewVariation("jackets", "female", 345, 346) - addNewVariation("jackets", "female", 351, 352) - addNewVariation("jackets", "female", 354, 121) - addNewVariation("jackets", "female", 355, 356) - addNewVariation("jackets", "female", 357, 359) - addNewVariation("jackets", "female", 358, 360) - addNewVariation("jackets", "female", 362, 363) - addNewVariation("jackets", "female", 366, 367) - addNewVariation("jackets", "female", 365, 269) - addNewVariation("jackets", "female", 370, 371) - addNewVariation("jackets", "female", 372, 373) - addNewVariation("jackets", "female", 378, 379) -end) + ["glasses"] = { + index = nil, + texture = nil + }, -local drawables = { - ["Top"] = { - Drawable = 11, - Table = variations.jackets, - Emote = {Dict = "missmic4", Anim = "michael_tux_fidget", Move = 51, Dur = 1500} - }, - ["gloves"] = { - Drawable = 3, - Table = variations.gloves, - Remember = true, - Emote = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200} - }, - ["Shoes"] = { - Drawable = 6, - Table = {Standalone = true, male = 34, female = 35}, - Emote = {Dict = "random@domestic", Anim = "pickup_low", Move = 0, Dur = 1200} - }, - ["Neck"] = { - Drawable = 7, - Table = {Standalone = true, male = 0, female = 0 }, - Emote = {Dict = "clothingtie", Anim = "try_tie_positive_a", Move = 51, Dur = 2100} - }, - ["Vest"] = { - Drawable = 9, - Table = {Standalone = true, male = 0, female = 0 }, - Emote = {Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200} - }, - ["Bag"] = { - Drawable = 5, - Table = variations.bags, - Emote = {Dict = "anim@heists@ornate_bank@grab_cash", Anim = "intro", Move = 51, Dur = 1600} - }, - ["Mask"] = { - Drawable = 1, - Table = {Standalone = true, male = 0, female = 0 }, - Emote = {Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 800} - }, - ["hair"] = { - Drawable = 2, - Table = variations.hair, - Remember = true, - Emote = {Dict = "clothingtie", Anim = "check_out_a", Move = 51, Dur = 2000} - }, + ["watch"] = { + index = nil, + texture = nil + }, + ["bracelet"] = { + index = nil, + texture = nil + }, } -local Extras = { - ["Shirt"] = { - Drawable = 11, - Table = { - Standalone = true, male = 252, female = 74, - Extra = { - {Drawable = 8, Id = 15, Tex = 0, Name = "Extra Undershirt"}, - {Drawable = 3, Id = 15, Tex = 0, Name = "Extra Gloves"}, - {Drawable = 10, Id = 0, Tex = 0, Name = "Extra Decals"}, - } - }, - Emote = {Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200} - }, - ["Pants"] = { - Drawable = 4, - Table = {Standalone = true, male = 61, female = 14}, - Emote = {Dict = "re@construction", Anim = "out_of_breath", Move = 51, Dur = 1300} - }, - ["Bagoff"] = { - Drawable = 5, - Table = {Standalone = true, male = 0, female = 0}, - Emote = {Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200} - }, -} +local emotes = { + ["top"] = { + on = {Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200}, + off = {Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200} + }, + ["pants"] = { + on = {Dict = "re@construction", Anim = "out_of_breath", Move = 51, Dur = 1300}, + off = {Dict = "re@construction", Anim = "out_of_breath", Move = 51, Dur = 1300} + }, + ["shoes"] = { + on = {Dict = "random@domestic", Anim = "pickup_low", Move = 0, Dur = 1200}, + off = {Dict = "random@domestic", Anim = "pickup_low", Move = 0, Dur = 1200} + }, + ["neck"] = { + on = {Dict = "clothingtie", Anim = "try_tie_positive_a", Move = 51, Dur = 2100}, + off = {Dict = "clothingtie", Anim = "try_tie_positive_a", Move = 51, Dur = 2100} + }, + ["mask"] = { + on = {Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 800}, + off = {Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 800} + }, + ["vest"] = { + on = {Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200}, + off = {Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200} + }, + ["bag"] = { + on = {Dict = "anim@heists@ornate_bank@grab_cash", Anim = "intro", Move = 51, Dur = 1600}, + off = {Dict = "anim@heists@ornate_bank@grab_cash", Anim = "intro", Move = 51, Dur = 1600} + }, + --PROPS + ["helmet"] = { + on = {Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 600}, + off = {Dict = "missheist_agency2ahelmet", Anim = "take_off_helmet_stand", Move = 51, Dur = 1200} + }, + ["ear"] = { + on = {Dict = "mp_cp_stolen_tut", Anim = "b_think", Move = 51, Dur = 900}, + off = {Dict = "mp_cp_stolen_tut", Anim = "b_think", Move = 51, Dur = 900} + }, + ["watch"] = { + on = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200}, + off = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200} + }, + ["bracelet"] = { + on = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200}, + off = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200} + }, + ["glasses"] = { + on = {Dict = "clothingspecs", Anim = "take_off", Move = 51, Dur = 1400}, + off = {Dict = "clothingspecs", Anim = "take_off", Move = 51, Dur = 1400} + }, -local Props = { - ["visor"] = { - Prop = 0, - Variants = variations.visor, - Emote = { - On = {Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 600}, - Off = {Dict = "missheist_agency2ahelmet", Anim = "take_off_helmet_stand", Move = 51, Dur = 1200} - } - }, - ["Hat"] = { - Prop = 0, - Emote = { - On = {Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 600}, - Off = {Dict = "missheist_agency2ahelmet", Anim = "take_off_helmet_stand", Move = 51, Dur = 1200} - } - }, - ["Glasses"] = { - Prop = 1, - Emote = { - On = {Dict = "clothingspecs", Anim = "take_off", Move = 51, Dur = 1400}, - Off = {Dict = "clothingspecs", Anim = "take_off", Move = 51, Dur = 1400} - } - }, - ["Ear"] = { - Prop = 2, - Emote = { - On = {Dict = "mp_cp_stolen_tut", Anim = "b_think", Move = 51, Dur = 900}, - Off = {Dict = "mp_cp_stolen_tut", Anim = "b_think", Move = 51, Dur = 900} - } - }, - ["Watch"] = { - Prop = 6, - Emote = { - On = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200}, - Off = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200} - } - }, - ["Bracelet"] = { - Prop = 7, - Emote = { - On = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200}, - Off = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200} - } - }, } -LastEquipped = {} -Cooldown = false +local function IsMpPed(ped) + local male = `mp_m_freemode_01` local female = `mp_f_freemode_01` + local CurrentModel = GetEntityModel(ped) + if CurrentModel == male then return "male" elseif CurrentModel == female then return "female" else return false end +end + +local function IsPedNaked(target, type) + local Gender = IsMpPed(target) + local top = { + ["shirt"] = { + model = GetPedDrawableVariation(target, 8) == Config.ClothingNaked[Gender]["shirt"].model, + variant = GetPedTextureVariation(target, 8) == Config.ClothingNaked[Gender]["shirt"].variant, + }, + ["jacket"] = { + model = GetPedDrawableVariation(target, 11) == Config.ClothingNaked[Gender]["jacket"].model, + variant = GetPedTextureVariation(target, 11) == Config.ClothingNaked[Gender]["jacket"].variant, + }, + ["gloves"] = { + model = GetPedDrawableVariation(target, 3) == Config.ClothingNaked[Gender]["gloves"].model, + variant = GetPedTextureVariation(target, 3) == Config.ClothingNaked[Gender]["gloves"].variant, + }, + } + local pants = { + model = GetPedDrawableVariation(target, 4) == Config.ClothingNaked[Gender]["pants"].model, + variant = GetPedTextureVariation(target, 4) == Config.ClothingNaked[Gender]["pants"].variant, + } + local shoes = { + model = GetPedDrawableVariation(target, 6) == Config.ClothingNaked[Gender]["shoes"].model, + variant = GetPedTextureVariation(target, 6) == Config.ClothingNaked[Gender]["shoes"].variant, + } + local neck = { + model = GetPedDrawableVariation(target, 7) == Config.ClothingNaked[Gender]["neck"].model, + variant = GetPedTextureVariation(target, 7) == Config.ClothingNaked[Gender]["neck"].variant, + } + local helmet = { + model = GetPedPropIndex(target, 0) == Config.ClothingNaked[Gender]["helmet"].model, + variant = GetPedPropTextureIndex(target, 0) == Config.ClothingNaked[Gender]["helmet"].variant, + } + local ear = { + model = GetPedPropIndex(target, 2) == Config.ClothingNaked[Gender]["ear"].model, + variant = GetPedPropTextureIndex(target, 2) == Config.ClothingNaked[Gender]["ear"].variant, + } + local watch = { + model = GetPedPropIndex(target, 6) == Config.ClothingNaked[Gender]["watch"].model, + variant = GetPedPropTextureIndex(target, 6) == Config.ClothingNaked[Gender]["watch"].variant, + } + local bracelet = { + model = GetPedPropIndex(target, 7) == Config.ClothingNaked[Gender]["bracelet"].model, + variant = GetPedPropTextureIndex(target, 7) == Config.ClothingNaked[Gender]["bracelet"].variant, + } + local glasses = { + model = GetPedPropIndex(target, 1) == Config.ClothingNaked[Gender]["glasses"].model, + variant = GetPedPropTextureIndex(target, 1) == Config.ClothingNaked[Gender]["glasses"].variant, + } + local mask = { + model = GetPedDrawableVariation(target, 1) == Config.ClothingNaked[Gender]["mask"].model, + variant = GetPedTextureVariation(target, 1) == Config.ClothingNaked[Gender]["mask"].variant, + } + local vest = { + model = GetPedDrawableVariation(target, 9) == Config.ClothingNaked[Gender]["vest"].model, + variant = GetPedTextureVariation(target, 9) == Config.ClothingNaked[Gender]["vest"].variant, + } + local bag = { + model = GetPedDrawableVariation(target, 5) == Config.ClothingNaked[Gender]["bag"].model, + variant = GetPedTextureVariation(target, 5) == Config.ClothingNaked[Gender]["bag"].variant, + } + if type == "top" then + if top["shirt"].model and top["shirt"].variant and top["jacket"].model and top["jacket"].variant and top["gloves"].model and top["gloves"].variant then + return true + end + elseif type == "pants" then + if pants.model and pants.variant then + return true + end + elseif type == "shoes" then + if shoes.model and shoes.variant then + return true + end + elseif type == "neck" then + if neck.model and neck.variant then + return true + end + elseif type == "mask" then + if mask.model and mask.variant then + return true + end + elseif type == "vest" then + if vest.model and vest.variant then + return true + end + elseif type == "bag" then + if bag.model and bag.variant then + return true + end + --PROPS + elseif type == "ear" then + if ear.model and ear.variant then + return true + end + elseif type == "helmet" then + if helmet.model and helmet.variant then + return true + end + elseif type == "watch" then + if watch.model and watch.variant then + return true + end + elseif type == "bracelet" then + if bracelet.model and bracelet.variant then + return true + end + elseif type == "glasses" then + if glasses.model and glasses.variant then + return true + end + end + + return false +end + +exports('IsPedNaked', IsPedNaked); -local function PlayToggleEmote(e, cb) +local function IncurCooldown(ms) + CreateThread(function() + Cooldown = true Wait(ms) Cooldown = false + end) +end + +local function PlayToggleEmote(e) local Ped = PlayerPedId() while not HasAnimDictLoaded(e.Dict) do RequestAnimDict(e.Dict) Wait(100) end if IsPedInAnyVehicle(Ped) then e.Move = 51 end @@ -776,198 +246,426 @@ local function PlayToggleEmote(e, cb) local Pause = e.Dur-500 if Pause < 500 then Pause = 500 end IncurCooldown(Pause) Wait(Pause) -- Lets wait for the emote to play for a bit then do the callback. - cb() end -function ResetClothing(anim) - if type(anim) == "table" then - anim = true - end - local Ped = PlayerPedId() - local e = drawables.Top.Emote - if anim then TaskPlayAnim(Ped, e.Dict, e.Anim, 3.0, 3.0, 3000, e.Move, 0, false, false, false) end - for _, v in pairs(LastEquipped) do - if v then - if v.Drawable then SetPedComponentVariation(Ped, v.Id, v.Drawable, v.Texture, 0) - elseif v.Prop then ClearPedProp(Ped, v.Id) SetPedPropIndex(Ped, v.Id, v.Prop, v.Texture, true) end - end +local function TakeOffClothing(data) + local ped = PlayerPedId() + local which = data + local Gender = IsMpPed(ped) + local info = {} + if type(data) == "table" then + which = tostring(data.id) end - LastEquipped = {} -end -RegisterNetEvent('qb-radialmenu:ResetClothing', ResetClothing) + if PlayerData.metadata['isdead'] then return end + if IsPedNaked(ped, which) then return end + PlayToggleEmote(emotes[which].off) + if which == "top" then -function ToggleClothing(whic, extra) - local which = whic - if type(whic) == "table" then - which = tostring(whic.id) - end - Wait(50) + clothes["top"].shirt_index = GetPedDrawableVariation(ped, 8) + clothes["top"].shirt_texture = GetPedTextureVariation(ped, 8) + clothes["top"].jacket_index = GetPedDrawableVariation(ped, 11) + clothes["top"].jacket_texture = GetPedTextureVariation(ped, 11) + clothes["top"].gloves_index = GetPedDrawableVariation(ped, 3) + clothes["top"].gloves_texture = GetPedTextureVariation(ped, 3) - if which == "Shirt" or which == "Pants" or which == "Bagoff" then - extra = true - end - if Cooldown then return end - local Toggle = drawables[which] if extra then Toggle = Extras[which] end - local Ped = PlayerPedId() - local Cur = { -- Lets check what we are currently wearing. - Drawable = GetPedDrawableVariation(Ped, Toggle.Drawable), - Id = Toggle.Drawable, - Ped = Ped, - Texture = GetPedTextureVariation(Ped, Toggle.Drawable), - } - local Gender = IsMpPed(Ped) - if which ~= "Mask" then - if not Gender then Notify(Lang:t("info.wrong_ped")) return false end -- We cancel the command here if the person is not using a multiplayer model. - end - local Table = Toggle.Table[Gender] - if not Toggle.Table.Standalone then -- "Standalone" is for things that dont require a variant, like the shoes just need to be switched to a specific drawable. Looking back at this i should have planned ahead, but it all works so, meh! - for k,v in pairs(Table) do - if not Toggle.Remember then - if k == Cur.Drawable then - PlayToggleEmote(Toggle.Emote, function() SetPedComponentVariation(Ped, Toggle.Drawable, v, Cur.Texture, 0) end) return true - end - else - if not LastEquipped[which] then - if k == Cur.Drawable then - PlayToggleEmote(Toggle.Emote, function() LastEquipped[which] = Cur SetPedComponentVariation(Ped, Toggle.Drawable, v, Cur.Texture, 0) end) return true - end - else - local Last = LastEquipped[which] - PlayToggleEmote(Toggle.Emote, function() SetPedComponentVariation(Ped, Toggle.Drawable, Last.Drawable, Last.Texture, 0) LastEquipped[which] = false end) return true - end - end - end - Notify(Lang:t("info.no_variants")) return - else - if not LastEquipped[which] then - if Cur.Drawable ~= Table then - PlayToggleEmote(Toggle.Emote, function() - LastEquipped[which] = Cur - SetPedComponentVariation(Ped, Toggle.Drawable, Table, 0, 0) - if Toggle.Table.Extra then - local extraToggled = Toggle.Table.Extra - for _, v in pairs(extraToggled) do - local ExtraCur = {Drawable = GetPedDrawableVariation(Ped, v.Drawable), Texture = GetPedTextureVariation(Ped, v.Drawable), Id = v.Drawable} - SetPedComponentVariation(Ped, v.Drawable, v.Id, v.Tex, 0) - LastEquipped[v.Name] = ExtraCur - end - end - end) - return true - end - else - local Last = LastEquipped[which] - PlayToggleEmote(Toggle.Emote, function() - SetPedComponentVariation(Ped, Toggle.Drawable, Last.Drawable, Last.Texture, 0) - LastEquipped[which] = false - if Toggle.Table.Extra then - local extraToggled = Toggle.Table.Extra - for _, v in pairs(extraToggled) do - if LastEquipped[v.Name] then - Last = LastEquipped[v.Name] - SetPedComponentVariation(Ped, Last.Id, Last.Drawable, Last.Texture, 0) - LastEquipped[v.Name] = false - end - end - end - end) - return true - end - end - Notify(Lang:t("info.already_wearing")) return false -end -RegisterNetEvent('qb-radialmenu:ToggleClothing', ToggleClothing) -function ToggleProps(whic) - local which = whic - if type(whic) == "table" then - which = tostring(whic.id) - end - Wait(50) + SetPedComponentVariation(ped, 3, Config.ClothingNaked[Gender]["gloves"].model, Config.ClothingNaked[Gender]["gloves"].variant, 2) + SetPedComponentVariation(ped, 11, Config.ClothingNaked[Gender]["jacket"].model, Config.ClothingNaked[Gender]["jacket"].variant, 2) + SetPedComponentVariation(ped, 8, Config.ClothingNaked[Gender]["shirt"].model, Config.ClothingNaked[Gender]["shirt"].variant, 2) - if Cooldown then return end - local Prop = Props[which] - local Ped = PlayerPedId() - local Cur = { -- Lets get out currently equipped prop. - Id = Prop.Prop, - Ped = Ped, - Prop = GetPedPropIndex(Ped, Prop.Prop), - Texture = GetPedPropTextureIndex(Ped, Prop.Prop), - } - if not Prop.Variants then - if Cur.Prop ~= -1 then -- If we currently are wearing this prop, remove it and save the one we were wearing into the LastEquipped table. - PlayToggleEmote(Prop.Emote.Off, function() LastEquipped[which] = Cur ClearPedProp(Ped, Prop.Prop) end) return true - else - local Last = LastEquipped[which] -- Detect that we have already taken our prop off, lets put it back on. - if Last then - PlayToggleEmote(Prop.Emote.On, function() SetPedPropIndex(Ped, Prop.Prop, Last.Prop, Last.Texture, true) end) LastEquipped[which] = false return true - end - end - Notify(Lang:t("info.nothing_to_remove")) return false - else - local Gender = IsMpPed(Ped) - if not Gender then Notify(Lang:t("info.wrong_ped")) return false end -- We dont really allow for variants on ped models, Its possible, but im pretty sure 95% of ped models dont really have variants. - variations = Prop.Variants[Gender] - for k,v in pairs(variations) do - if Cur.Prop == k then - PlayToggleEmote(Prop.Emote.On, function() SetPedPropIndex(Ped, Prop.Prop, v, Cur.Texture, true) end) return true - end - end - Notify(Lang:t("info.no_variants")) return false - end -end + info = { + shirt_model = clothes["top"].shirt_index, + shirt_variant = clothes["top"].shirt_texture, + jacket_model = clothes["top"].jacket_index, + jacket_variant = clothes["top"].jacket_texture, + gloves_model = clothes["top"].gloves_index, + gloves_variant = clothes["top"].gloves_texture, + gender = Gender + } + elseif which == "pants" then + clothes["pants"].index = GetPedDrawableVariation(ped, 4) + clothes["pants"].texture = GetPedTextureVariation(ped, 4) -RegisterNetEvent('qb-radialmenu:ToggleProps', ToggleProps) + SetPedComponentVariation(ped, 4, Config.ClothingNaked[Gender]["pants"].model, Config.ClothingNaked[Gender]["pants"].variant, 2) -for k,v in pairs(Config.Commands) do - RegisterCommand(k, v.Func) - --log("Created /"..k.." ("..v.Desc..")") -- Useful for translation checking. - TriggerEvent("chat:addSuggestion", "/"..k, v.Desc) -end -if Config.ExtrasEnabled then - for k,v in pairs(Config.ExtraCommands) do - RegisterCommand(k, v.Func) - --log("Created /"..k.." ("..v.Desc..")") -- Useful for translation checking. - TriggerEvent("chat:addSuggestion", "/"..k, v.Desc) - end + info = { + model = clothes["pants"].index, + variant = clothes["pants"].texture, + gender = Gender + } + elseif which == "shoes" then + clothes["shoes"].index = GetPedDrawableVariation(ped, 6) + clothes["shoes"].texture = GetPedTextureVariation(ped, 6) + + SetPedComponentVariation(ped, 6, Config.ClothingNaked[Gender]["shoes"].model, Config.ClothingNaked[Gender]["shoes"].variant, 2) + + + info = { + model = clothes["shoes"].index, + variant = clothes["shoes"].texture, + gender = Gender + } + elseif which == "neck" then + clothes["neck"].index = GetPedDrawableVariation(ped, 7) + clothes["neck"].texture = GetPedTextureVariation(ped, 7) + + SetPedComponentVariation(ped, 7, Config.ClothingNaked[Gender]["neck"].model, Config.ClothingNaked[Gender]["neck"].variant, 2) + + + info = { + model = clothes["neck"].index, + variant = clothes["neck"].texture, + gender = Gender + } + elseif which == "mask" then + clothes["mask"].index = GetPedDrawableVariation(ped, 1) + clothes["mask"].texture = GetPedTextureVariation(ped, 1) + + SetPedComponentVariation(ped, 1, Config.ClothingNaked[Gender]["mask"].model, Config.ClothingNaked[Gender]["mask"].variant, 2) + + + info = { + model = clothes["mask"].index, + variant = clothes["mask"].texture, + gender = Gender + } + elseif which == "vest" then + clothes["vest"].index = GetPedDrawableVariation(ped, 9) + clothes["vest"].texture = GetPedTextureVariation(ped, 9) + + SetPedComponentVariation(ped, 9, Config.ClothingNaked[Gender]["vest"].model, Config.ClothingNaked[Gender]["vest"].variant, 2) + + + info = { + model = clothes["vest"].index, + variant = clothes["vest"].texture, + gender = Gender + } + elseif which == "bag" then + clothes["bag"].index = GetPedDrawableVariation(ped, 5) + clothes["bag"].texture = GetPedTextureVariation(ped, 5) + + SetPedComponentVariation(ped, 5, Config.ClothingNaked[Gender]["bag"].model, Config.ClothingNaked[Gender]["bag"].variant, 2) + + + info = { + model = clothes["bag"].index, + variant = clothes["bag"].texture, + gender = Gender + } + end + + TriggerServerEvent("qb-radialmenu:server:giveitem", which, 1, false, info) end -AddEventHandler('onResourceStop', function(resource) -- Mostly for development, restart the resource and it will put all the clothes back on. - if resource == GetCurrentResourceName() then - ResetClothing() +local function TakeOffProps(data) + local ped = PlayerPedId() + local which = data + local info = {} + if type(data) == "table" then + which = tostring(data.id) end -end) + if PlayerData.metadata['isdead'] then return end + if IsPedNaked(ped, which) then Notify(Lang:t("info.nothing_to_remove")) return end + PlayToggleEmote(emotes[which].off) + if which == "helmet" then + clothes["helmet"].index = GetPedPropIndex(ped, 0) + clothes["helmet"].texture = GetPedPropTextureIndex(ped, 0) + ClearPedProp(ped, 0) -function IncurCooldown(ms) - CreateThread(function() - Cooldown = true Wait(ms) Cooldown = false - end) -end + info = { + model = clothes["helmet"].index, + variant = clothes["helmet"].texture + } + elseif which == "ear" then + clothes["ear"].index = GetPedPropIndex(ped, 2) + clothes["ear"].texture = GetPedPropTextureIndex(ped, 2) + ClearPedProp(ped, 2) -function Notify(message, color) -- However you want your notifications to be shown, you can switch it up here. - QBCore.Functions.Notify(message, color) -end + info = { + model = clothes["ear"].index, + variant = clothes["ear"].texture + } + elseif which == "glasses" then + clothes["glasses"].index = GetPedPropIndex(ped, 1) + clothes["glasses"].texture = GetPedPropTextureIndex(ped, 1) + ClearPedProp(ped, 1) -function IsMpPed(ped) - local male = `mp_m_freemode_01` local female = `mp_f_freemode_01` - local CurrentModel = GetEntityModel(ped) - if CurrentModel == male then return "male" elseif CurrentModel == female then return "female" else return false end + info = { + model = clothes["glasses"].index, + variant = clothes["glasses"].texture + } + elseif which == "bracelet" then + clothes["bracelet"].index = GetPedPropIndex(ped, 7) + clothes["bracelet"].texture = GetPedPropTextureIndex(ped, 7) + ClearPedProp(ped, 7) + + info = { + model = clothes["bracelet"].index, + variant = clothes["bracelet"].texture + } + elseif which == "watch" then + clothes["watch"].index = GetPedPropIndex(ped, 6) + clothes["watch"].texture = GetPedPropTextureIndex(ped, 6) + ClearPedProp(ped, 6) + + info = { + model = clothes["watch"].index, + variant = clothes["watch"].texture + } + + end + TriggerServerEvent("qb-radialmenu:server:giveitem", which, 1, false, info) end -RegisterNetEvent('dpc:EquipLast', function() - local Ped = PlayerPedId() - for _, v in pairs(LastEquipped) do - if v then - if v.Drawable then SetPedComponentVariation(Ped, v.ID, v.Drawable, v.Texture, 0) - elseif v.Prop then ClearPedProp(Ped, v.ID) SetPedPropIndex(Ped, v.ID, v.Prop, v.Texture, true) end - end - end - LastEquipped = {} +RegisterNetEvent('qb-radialmenu:WearClothes', function(data, type) + local ped = PlayerPedId() + local naked = IsPedNaked(ped, type) + local Gender = IsMpPed(ped) + if data.info.gender ~= Gender then + Notify(Lang:t("info.wrong_gender")) + return + end + PlayToggleEmote(emotes[type].on) + if type == "top" then + + clothes["top"].shirt_index = GetPedDrawableVariation(ped, 8) + clothes["top"].shirt_texture = GetPedTextureVariation(ped, 8) + clothes["top"].jacket_index = GetPedDrawableVariation(ped, 11) + clothes["top"].jacket_texture = GetPedTextureVariation(ped, 11) + clothes["top"].gloves_index = GetPedDrawableVariation(ped, 3) + clothes["top"].gloves_texture = GetPedTextureVariation(ped, 3) + + if not naked then + local info = { + shirt_model = clothes["top"].shirt_index, + shirt_variant = clothes["top"].shirt_texture, + jacket_model = clothes["top"].jacket_index, + jacket_variant = clothes["top"].jacket_texture, + gloves_model = clothes["top"].gloves_index, + gloves_variant = clothes["top"].gloves_texture, + gender = Gender + } + + TriggerServerEvent("qb-radialmenu:server:giveitem", "top", 1, false, info) + end + clothes["top"].shirt_index = nil + clothes["top"].shirt_texture = nil + clothes["top"].jacket_model = nil + clothes["top"].jacket_variant = nil + clothes["top"].gloves_model = nil + clothes["top"].gloves_variant = nil + SetPedComponentVariation(ped, 3, data.info.gloves_model, data.info.gloves_variant, 2) + SetPedComponentVariation(ped, 8, data.info.shirt_model, data.info.shirt_variant, 2) + SetPedComponentVariation(ped, 11, data.info.jacket_model, data.info.jacket_variant, 2) + + elseif type == "pants" then + clothes["pants"].index = GetPedDrawableVariation(ped, 4) + clothes["pants"].texture = GetPedTextureVariation(ped, 4) + if not naked then + local info = { + model = clothes["pants"].index, + variant = clothes["pants"].texture, + gender = Gender + } + + TriggerServerEvent("qb-radialmenu:server:giveitem", "pants", 1, false, info) + end + clothes["pants"].index = nil + clothes["pants"].texture = nil + SetPedComponentVariation(ped, 4, data.info.model, data.info.variant, 2) + elseif type == "shoes" then + clothes["shoes"].index = GetPedDrawableVariation(ped, 6) + clothes["shoes"].texture = GetPedTextureVariation(ped, 6) + if not naked then + local info = { + model = clothes["shoes"].index, + variant = clothes["shoes"].texture, + gender = Gender + } + + TriggerServerEvent("qb-radialmenu:server:giveitem", "shoes", 1, false, info) + end + clothes["shoes"].index = nil + clothes["shoes"].texture = nil + SetPedComponentVariation(ped, 6, data.info.model, data.info.variant, 2) + elseif type == "neck" then + clothes["neck"].index = GetPedDrawableVariation(ped, 7) + clothes["neck"].texture = GetPedTextureVariation(ped, 7) + if not naked then + local info = { + model = clothes["neck"].index, + variant = clothes["neck"].texture, + gender = Gender + } + + TriggerServerEvent("qb-radialmenu:server:giveitem", "neck", 1, false, info) + end + clothes["neck"].index = nil + clothes["neck"].texture = nil + SetPedComponentVariation(ped, 7, data.info.model, data.info.variant, 2) + elseif type == "mask" then + clothes["mask"].index = GetPedDrawableVariation(ped, 1) + clothes["mask"].texture = GetPedTextureVariation(ped, 1) + if not naked then + local info = { + model = clothes["mask"].index, + variant = clothes["mask"].texture, + gender = Gender + } + + TriggerServerEvent("qb-radialmenu:server:giveitem", "mask", 1, false, info) + end + clothes["mask"].index = nil + clothes["mask"].texture = nil + SetPedComponentVariation(ped, 1, data.info.model, data.info.variant, 2) + elseif type == "vest" then + clothes["vest"].index = GetPedDrawableVariation(ped, 9) + clothes["vest"].texture = GetPedTextureVariation(ped, 9) + if not naked then + local info = { + model = clothes["vest"].index, + variant = clothes["vest"].texture, + gender = Gender + } + + TriggerServerEvent("qb-radialmenu:server:giveitem", "vest", 1, false, info) + end + clothes["vest"].index = nil + clothes["vest"].texture = nil + SetPedComponentVariation(ped, 9, data.info.model, data.info.variant, 2) + elseif type == "bag" then + clothes["bag"].index = GetPedDrawableVariation(ped, 5) + clothes["bag"].texture = GetPedTextureVariation(ped, 5) + if not naked then + local info = { + model = clothes["bag"].index, + variant = clothes["bag"].texture, + gender = Gender + } + + TriggerServerEvent("qb-radialmenu:server:giveitem", "bag", 1, false, info) + end + clothes["bag"].index = nil + clothes["bag"].texture = nil + SetPedComponentVariation(ped, 5, data.info.model, data.info.variant, 2) + end + TriggerServerEvent("qb-radialmenu:server:removeitem", data.name, 1, data.slot) end) -RegisterNetEvent('dpc:ResetClothing', function() - LastEquipped = {} +RegisterNetEvent('qb-radialmenu:WearProps', function(data, type) + local ped = PlayerPedId() + local naked = IsPedNaked(ped, type) + if type == "helmet" then + if not naked then + PlayToggleEmote(emotes["helmet"].off) + + clothes["helmet"].index = GetPedPropIndex(ped, 0) + clothes["helmet"].texture = GetPedPropTextureIndex(ped, 0) + ClearPedProp(ped, 0) + + local info = { + model = clothes["helmet"].index, + variant = clothes["helmet"].texture + } + + TriggerServerEvent("qb-radialmenu:server:giveitem", "helmet", 1, false, info) + end + PlayToggleEmote(emotes["helmet"].on) + SetPedPropIndex(ped, 0, data.info.model, data.info.variant, 2) + + clothes["helmet"].index = nil + clothes["helmet"].texture = nil + elseif type == "ear" then + if not naked then + PlayToggleEmote(emotes["ear"].off) + + clothes["ear"].index = GetPedPropIndex(ped, 2) + clothes["ear"].texture = GetPedPropTextureIndex(ped, 2) + ClearPedProp(ped, 2) + + local info = { + model = clothes["ear"].index, + variant = clothes["ear"].texture + } + + TriggerServerEvent("qb-radialmenu:server:giveitem", "ear", 1, false, info) + end + PlayToggleEmote(emotes["ear"].on) + SetPedPropIndex(ped, 2, data.info.model, data.info.variant, 2) + + clothes["ear"].index = nil + clothes["ear"].texture = nil + elseif type == "glasses" then + if not naked then + PlayToggleEmote(emotes["glasses"].off) + + clothes["glasses"].index = GetPedPropIndex(ped, 1) + clothes["glasses"].texture = GetPedPropTextureIndex(ped, 1) + ClearPedProp(ped, 1) + + local info = { + model = clothes["glasses"].index, + variant = clothes["glasses"].texture + } + + TriggerServerEvent("qb-radialmenu:server:giveitem", "glasses", 1, false, info) + end + PlayToggleEmote(emotes["glasses"].on) + SetPedPropIndex(ped, 1, data.info.model, data.info.variant, 2) + + clothes["glasses"].index = nil + clothes["glasses"].texture = nil + elseif type == "bracelet" then + if not naked then + PlayToggleEmote(emotes["bracelet"].off) + + clothes["bracelet"].index = GetPedPropIndex(ped, 7) + clothes["bracelet"].texture = GetPedPropTextureIndex(ped, 7) + ClearPedProp(ped, 7) + + local info = { + model = clothes["bracelet"].index, + variant = clothes["bracelet"].texture + } + + TriggerServerEvent("qb-radialmenu:server:giveitem", "bracelet", 1, false, info) + end + PlayToggleEmote(emotes["bracelet"].on) + SetPedPropIndex(ped, 7, data.info.model, data.info.variant, 2) + + clothes["bracelet"].index = nil + clothes["bracelet"].texture = nil + elseif type == "watch" then + if not naked then + PlayToggleEmote(emotes["watch"].off) + + clothes["watch"].index = GetPedPropIndex(ped, 6) + clothes["watch"].texture = GetPedPropTextureIndex(ped, 6) + ClearPedProp(ped, 6) + + local info = { + model = clothes["watch"].index, + variant = clothes["watch"].texture + } + + TriggerServerEvent("qb-radialmenu:server:giveitem", "watch", 1, false, info) + end + PlayToggleEmote(emotes["watch"].on) + SetPedPropIndex(ped, 6, data.info.model, data.info.variant, 2) + + clothes["watch"].index = nil + clothes["watch"].texture = nil + end + TriggerServerEvent("qb-radialmenu:server:removeitem", data.name, 1, data.slot) end) + +RegisterNetEvent('qb-radialmenu:TakeOffClothing', TakeOffClothing) +RegisterNetEvent('qb-radialmenu:TakeOffProps', TakeOffProps) + +function Notify(message, color) -- However you want your notifications to be shown, you can switch it up here. + QBCore.Functions.Notify(message, color) +end diff --git a/config.lua b/config.lua index 211e223..4ef1b71 100644 --- a/config.lua +++ b/config.lua @@ -5,6 +5,148 @@ Config.UseWhilstWalking = false -- use whilst walking Config.EnableExtraMenu = true Config.Fliptime = 15000 +Config.ClothingItems = { + clothes = { + "top", + "pants", + "shoes", + "neck", + "mask", + "vest", + "bag", + }, + props = { + "ear", + "helmet", + "glasses", + "bracelet", + "watch", + } +} + +Config.ClothingNaked = { + ["male"] = { + ["shirt"] = { + model = 15, + variant = 0, + }, + ["gloves"] = { + model = 15, + variant = 0, + }, + ["jacket"] = { + model = 15, + variant = 0, + }, + ["pants"] = { + model = 61, + variant = 0, + }, + ["shoes"] = { + model = 34, + variant = 0, + }, + ["neck"] = { + model = 0, + variant = 0, + }, + ["mask"] = { + model = 0, + variant = 0, + }, + ["vest"] = { + model = 0, + variant = 0, + }, + ["bag"] = { + model = 0, + variant = 0, + }, + --PROPS + ["ear"] = { + model = -1, + variant = -1, + }, + ["helmet"] = { + model = -1, + variant = -1, + }, + ["glasses"] = { + model = 0, + variant = -1, + }, + ["bracelet"] = { + model = -1, + variant = -1, + }, + + ["watch"] = { + model = -1, + variant = -1, + }, + }, + ["female"] = { + ["shirt"] = { + model = 15, + variant = 0, + }, + ["gloves"] = { + model = 15, + variant = 0, + }, + ["jacket"] = { + model = 15, + variant = 0, + }, + ["pants"] = { + model = 15, + variant = 0, + }, + ["shoes"] = { + model = 35, + variant = 0, + }, + ["neck"] = { + model = 0, + variant = 0, + }, + ["mask"] = { + model = 0, + variant = 0, + }, + ["vest"] = { + model = 0, + variant = 0, + }, + ["bag"] = { + model = 0, + variant = 0, + }, + --PROPS + ["ear"] = { + model = -1, + variant = -1, + }, + ["helmet"] = { + model = -1, + variant = -1, + }, + ["glasses"] = { + model = 5, + variant = 0, + }, + ["bracelet"] = { + model = -1, + variant = -1, + }, + + ["watch"] = { + model = -1, + variant = -1, + }, + } +} + Config.MenuItems = { [1] = { id = 'citizen', @@ -172,53 +314,39 @@ Config.MenuItems = { icon = 'shirt', items = { { - id = 'Hair', - title = 'Hair', - icon = 'user', - type = 'client', - event = 'qb-radialmenu:ToggleClothing', - shouldClose = true - }, { - id = 'Ear', + id = 'ear', title = 'Ear Piece', icon = 'ear-deaf', type = 'client', - event = 'qb-radialmenu:ToggleProps', + event = 'qb-radialmenu:TakeOffProps', shouldClose = true }, { - id = 'Neck', + id = 'neck', title = 'Neck', icon = 'user-tie', type = 'client', - event = 'qb-radialmenu:ToggleClothing', + event = 'qb-radialmenu:TakeOffClothing', shouldClose = true }, { - id = 'Top', + id = 'top', title = 'Top', icon = 'shirt', type = 'client', - event = 'qb-radialmenu:ToggleClothing', + event = 'qb-radialmenu:TakeOffClothing', shouldClose = true - }, { - id = 'Shirt', - title = 'Shirt', - icon = 'shirt', - type = 'client', - event = 'qb-radialmenu:ToggleClothing', - shouldClose = true - }, { - id = 'Pants', + }, { + id = 'pants', title = 'Pants', icon = 'user', type = 'client', - event = 'qb-radialmenu:ToggleClothing', + event = 'qb-radialmenu:TakeOffClothing', shouldClose = true }, { - id = 'Shoes', + id = 'shoes', title = 'Shoes', icon = 'shoe-prints', type = 'client', - event = 'qb-radialmenu:ToggleClothing', + event = 'qb-radialmenu:TakeOffClothing', shouldClose = true }, { id = 'meer', @@ -226,69 +354,55 @@ Config.MenuItems = { icon = 'plus', items = { { - id = 'Hat', - title = 'Hat', + id = 'helmet', + title = 'Helmet', icon = 'hat-cowboy-side', type = 'client', - event = 'qb-radialmenu:ToggleProps', + event = 'qb-radialmenu:TakeOffProps', shouldClose = true }, { - id = 'Glasses', + id = 'glasses', title = 'Glasses', icon = 'glasses', type = 'client', - event = 'qb-radialmenu:ToggleProps', + event = 'qb-radialmenu:TakeOffProps', shouldClose = true - }, { - id = 'Visor', - title = 'Visor', - icon = 'hat-cowboy-side', - type = 'client', - event = 'qb-radialmenu:ToggleProps', - shouldClose = true - }, { - id = 'Mask', + },{ + id = 'mask', title = 'Mask', icon = 'masks-theater', type = 'client', - event = 'qb-radialmenu:ToggleClothing', + event = 'qb-radialmenu:TakeOffClothing', shouldClose = true }, { - id = 'Vest', + id = 'vest', title = 'Vest', icon = 'vest', type = 'client', - event = 'qb-radialmenu:ToggleClothing', + event = 'qb-radialmenu:TakeOffClothing', shouldClose = true }, { - id = 'Bag', + id = 'bag', title = 'Bag', icon = 'bag-shopping', type = 'client', - event = 'qb-radialmenu:ToggleClothing', + event = 'qb-radialmenu:TakeOffClothing', shouldClose = true }, { - id = 'Bracelet', + id = 'bracelet', title = 'Bracelet', icon = 'user', type = 'client', - event = 'qb-radialmenu:ToggleProps', + event = 'qb-radialmenu:TakeOffProps', shouldClose = true }, { - id = 'Watch', + id = 'watch', title = 'Watch', icon = 'stopwatch', type = 'client', - event = 'qb-radialmenu:ToggleProps', + event = 'qb-radialmenu:TakeOffProps', shouldClose = true - }, { - id = 'Gloves', - title = 'Gloves', - icon = 'mitten', - type = 'client', - event = 'qb-radialmenu:ToggleClothing', - shouldClose = true - } + }, } } } @@ -732,168 +846,4 @@ Config.TrunkClasses = { [21] = {allowed = true, x = 0.0, y = -1.0, z = 0.25} -- Trains } -Config.ExtrasEnabled = true - -Config.Commands = { - ["top"] = { - Func = function() ToggleClothing("Top") end, - Sprite = "top", - Desc = "Take your shirt off/on", - Button = 1, - Name = "Torso" - }, - ["gloves"] = { - Func = function() ToggleClothing("gloves") end, - Sprite = "gloves", - Desc = "Take your gloves off/on", - Button = 2, - Name = "Gloves" - }, - ["visor"] = { - Func = function() ToggleProps("visor") end, - Sprite = "visor", - Desc = "Toggle hat variation", - Button = 3, - Name = "Visor" - }, - ["bag"] = { - Func = function() ToggleClothing("Bag") end, - Sprite = "bag", - Desc = "Opens or closes your bag", - Button = 8, - Name = "Bag" - }, - ["shoes"] = { - Func = function() ToggleClothing("Shoes") end, - Sprite = "shoes", - Desc = "Take your shoes off/on", - Button = 5, - Name = "Shoes" - }, - ["vest"] = { - Func = function() ToggleClothing("Vest") end, - Sprite = "vest", - Desc = "Take your vest off/on", - Button = 14, - Name = "Vest" - }, - ["hair"] = { - Func = function() ToggleClothing("hair") end, - Sprite = "hair", - Desc = "Put your hair up/down/in a bun/ponytail.", - Button = 7, - Name = "Hair" - }, - ["hat"] = { - Func = function() ToggleProps("Hat") end, - Sprite = "hat", - Desc = "Take your hat off/on", - Button = 4, - Name = "Hat" - }, - ["glasses"] = { - Func = function() ToggleProps("Glasses") end, - Sprite = "glasses", - Desc = "Take your glasses off/on", - Button = 9, - Name = "Glasses" - }, - ["ear"] = { - Func = function() ToggleProps("Ear") end, - Sprite = "ear", - Desc = "Take your ear accessory off/on", - Button = 10, - Name = "Ear" - }, - ["neck"] = { - Func = function() ToggleClothing("Neck") end, - Sprite = "neck", - Desc = "Take your neck accessory off/on", - Button = 11, - Name = "Neck" - }, - ["watch"] = { - Func = function() ToggleProps("Watch") end, - Sprite = "watch", - Desc = "Take your watch off/on", - Button = 12, - Name = "Watch", - Rotation = 5.0 - }, - ["bracelet"] = { - Func = function() ToggleProps("Bracelet") end, - Sprite = "bracelet", - Desc = "Take your bracelet off/on", - Button = 13, - Name = "Bracelet" - }, - ["mask"] = { - Func = function() ToggleClothing("Mask") end, - Sprite = "mask", - Desc = "Take your mask off/on", - Button = 6, - Name = "Mask" - } -} - -local bags = {[40] = true, [41] = true, [44] = true, [45] = true} - -Config.ExtraCommands = { - ["pants"] = { - Func = function() ToggleClothing("Pants", true) end, - Sprite = "pants", - Desc = "Take your pants off/on", - Name = "Pants", - OffsetX = -0.04, - OffsetY = 0.0 - }, - ["shirt"] = { - Func = function() ToggleClothing("Shirt", true) end, - Sprite = "shirt", - Desc = "Take your shirt off/on", - Name = "shirt", - OffsetX = 0.04, - OffsetY = 0.0 - }, - ["reset"] = { - Func = function() - if not ResetClothing(true) then - Notify('Nothing To Reset', 'error') - end - end, - Sprite = "reset", - Desc = "Revert everything back to normal", - Name = "reset", - OffsetX = 0.12, - OffsetY = 0.2, - Rotate = true - }, - ["bagoff"] = { - Func = function() ToggleClothing("Bagoff", true) end, - Sprite = "bagoff", - SpriteFunc = function() - local Bag = GetPedDrawableVariation(PlayerPedId(), 5) - local BagOff = LastEquipped["Bagoff"] - if LastEquipped["Bagoff"] then - if bags[BagOff.Drawable] then - return "bagoff" - else - return "paraoff" - end - end - if Bag ~= 0 then - if bags[Bag] then - return "bagoff" - else - return "paraoff" - end - else - return false - end - end, - Desc = "Take your bag off/on", - Name = "bagoff", - OffsetX = -0.12, - OffsetY = 0.2 - } -} +Config.ExtrasEnabled = true \ No newline at end of file diff --git a/fxmanifest.lua b/fxmanifest.lua index 4f46c79..250ea4f 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -22,6 +22,7 @@ client_scripts { server_scripts { 'server/trunk.lua', + 'server/clothing.lua', 'server/stretcher.lua' } diff --git a/locales/en.lua b/locales/en.lua index 757a986..0bd7532 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -28,6 +28,7 @@ local Translations = { info = { no_variants = "There don't seem to be any variants for this", wrong_ped = "This ped model does not allow for this option", + wrong_gender = "This clothe is not for your gender", nothing_to_remove = "You don't appear to have anything to remove", already_wearing = "You are already wearing that", switched_seats = "You are now on the %{seat}" diff --git a/server/clothing.lua b/server/clothing.lua new file mode 100644 index 0000000..ff16aa5 --- /dev/null +++ b/server/clothing.lua @@ -0,0 +1,34 @@ +RegisterNetEvent('qb-radialmenu:server:giveitem', function(item, amount, slot, info) + local Player = QBCore.Functions.GetPlayer(source) + + Player.Functions.AddItem(item, amount, slot, info) + TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items[item], "add") +end) + +RegisterNetEvent('qb-radialmenu:server:removeitem', function(item, amount, slot) + local Player = QBCore.Functions.GetPlayer(source) + + Player.Functions.RemoveItem(item, amount, slot) + TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items[item], "remove") +end) + + +for _, v in ipairs(Config.ClothingItems.clothes) do + QBCore.Functions.CreateUseableItem(v, function(source, item) + local Player = QBCore.Functions.GetPlayer(source) + + if not Player.Functions.GetItemByName(item.name) then return end + print(item.info.model) + TriggerClientEvent('qb-radialmenu:WearClothes', source, item, v) + end) +end + +for _, v in ipairs(Config.ClothingItems.props) do + QBCore.Functions.CreateUseableItem(v, function(source, item) + local Player = QBCore.Functions.GetPlayer(source) + + if not Player.Functions.GetItemByName(item.name) then return end + print(item.info.model) + TriggerClientEvent('qb-radialmenu:WearProps', source, item, v) + end) +end \ No newline at end of file diff --git a/server/trunk.lua b/server/trunk.lua index bf1ddd8..cb1075f 100644 --- a/server/trunk.lua +++ b/server/trunk.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() +QBCore = exports['qb-core']:GetCoreObject() local trunkBusy = {} RegisterNetEvent('qb-radialmenu:trunk:server:Door', function(open, plate, door)