├── 2Take1 Lua Loader.lua ├── From 2Take1Menu └── scripts │ ├── HeadBlend-Profiles.lua │ └── README.md ├── README.md └── lib └── 2take1 compat.lua /2Take1 Lua Loader.lua: -------------------------------------------------------------------------------- 1 | local stand = menu 2 | local util = _G["util"] 3 | local filesystem = _G["filesystem"] 4 | local config = require("2take1 compat") 5 | 6 | local og_g_keys = {} 7 | for k, v in pairs(_G) do 8 | og_g_keys[k] = true 9 | end 10 | 11 | local function init() 12 | stand.action(stand.my_root(), "Reset State", {}, "", function() 13 | util.dispatch_on_stop() 14 | util.stop_all_threads() 15 | util.create_thread(function() 16 | util.clear_commands_and_event_handlers() 17 | -- reset global vars to avoid scripts crying about already being loaded 18 | for k, v in pairs(_G) do 19 | if og_g_keys[k] == nil then 20 | _G[k] = nil 21 | end 22 | end 23 | -- reinit 24 | util.keep_running() 25 | init() 26 | end) 27 | end) 28 | 29 | local settings_list = stand.list(stand.my_root(), "Settings", {}, "") 30 | stand.toggle(settings_list, "Spoof 2Take1Menu Directory", {}, "Tries to redirect access to resources from the 2Take1Menu directory to the \"From 2Take1Menu\" folder.", function (value) 31 | config.spoof_2take1_install_dir = value 32 | end, true) 33 | 34 | local no_scripts = true 35 | local lua_list = stand.list(stand.my_root(), "Load Scripts", {}, "", function() 36 | if no_scripts then 37 | util.toast("Put luas made for 2Take1Menu into the %appdata%\\Stand\\From 2Take1Menu\\scripts folder, then hit \"Reset State\" to refresh.") 38 | end 39 | end) 40 | local dir = filesystem.stand_dir() .. "From 2Take1Menu\\" 41 | if not filesystem.is_dir(dir) then 42 | filesystem.mkdir(dir) 43 | end 44 | if not filesystem.is_regular_file(dir.."2Take1Menu.ini") then 45 | local f = io.open(dir.."2Take1Menu.ini", "w") 46 | f:write("[Keys]\nMenuRight=NUM6\nMenuSelect=NUM5\nMenuDown=NUM2\nMenu=NUM-\nMenuUp=NUM8\nMenuLeft=NUM4\nMenuBack=NUM0\nMenuTabPrev=NUM7\nMenuTabNext=NUM9") 47 | f:close() 48 | end 49 | dir = dir .. "scripts\\" 50 | if not filesystem.is_dir(dir) then 51 | filesystem.mkdir(dir) 52 | end 53 | local created_divider = false 54 | for i, path in ipairs(filesystem.list_files(dir)) do 55 | if filesystem.is_regular_file(path) then 56 | no_scripts = false 57 | path = string.sub(path, string.len(dir) + 1) 58 | stand.action(lua_list, path, {}, "", function() 59 | local og_toast = util.toast 60 | local silent_start = true 61 | util.toast = function(...) 62 | silent_start = false 63 | return og_toast(...) 64 | end 65 | 66 | local chunk, err = loadfile(dir .. path) 67 | local status 68 | if chunk then 69 | if not created_divider then 70 | created_divider = true 71 | stand.divider(stand.my_root(), "Script Features") 72 | end 73 | status, err = xpcall(chunk, function(e) 74 | util.toast(e) 75 | util.log(debug.traceback(e, 2)) 76 | end) 77 | if status then 78 | if silent_start then 79 | util.toast("Successfully loaded " .. path) 80 | end 81 | return 82 | end 83 | end 84 | util.toast(tostring(err or "no further error information"), TOAST_ALL) 85 | end) 86 | end 87 | end 88 | end 89 | init() 90 | -------------------------------------------------------------------------------- /From 2Take1Menu/scripts/HeadBlend-Profiles.lua: -------------------------------------------------------------------------------- 1 | --Made by GhostOne 2 | --v1.1.1 3 | 4 | if GhostsHeadBlendLoaded then 5 | menu.notify("Cancelling", "Head Blend LUA Already Loaded", 3, 255) 6 | return HANDLER_POP 7 | end 8 | if not menu.is_trusted_mode_enabled() then 9 | menu.notify("Trusted Mode is not enabled, stat Head Blends will not be an option.\nEnable Trusted Mode then execute the script again to edit stat Head Blends", "Head Blend Profiles", 6, 0xff0000) 10 | end 11 | 12 | -- Locals 13 | local HBstats = { 14 | int = { 15 | {"MESH_HEAD0", "shape_first"}, 16 | {"MESH_HEAD1", "shape_second"}, 17 | {"MESH_HEAD2", "shape_third"}, 18 | {"MESH_TEX0", "skin_first"}, 19 | {"MESH_TEX1", "skin_second"}, 20 | {"MESH_TEX2", "skin_third"}, 21 | {"HEADBLEND_DAD_BEARD", nil}, 22 | {"HEADBLEND_DAD_BEARD_TEX", nil}, 23 | {"HEADBLEND_DAD_EYEB", nil}, 24 | {"HEADBLEND_DAD_HAIR", nil}, 25 | {"HEADBLEND_DAD_HAIR_TEX", nil}, 26 | {"HEADBLEND_MUM_EYEB", nil}, 27 | {"HEADBLEND_MUM_HAIR", nil}, 28 | {"HEADBLEND_MUM_HAIR_TEX", nil}, 29 | {"HEADBLEND_MUM_MAKEUP", nil}, 30 | {"HEADBLEND_MUM_MAKEUP_TEX", nil}, 31 | {"HAIR_TINT", "HairColor"}, 32 | {"EYEBROW_TINT", nil}, 33 | {"FACIALHAIR_TINT", nil}, 34 | {"BLUSHER_TINT", nil}, 35 | {"LIPSTICK_TINT", nil}, 36 | {"OVERLAY_BODY_1_TINT", nil}, 37 | {"SEC_OVERLAY_BODY_1_TINT", nil}, 38 | {"SEC_HAIR_TINT", "HairHighlightColor"}, 39 | {"SEC_EYEBROW_TINT", "Eyebrows_color"}, 40 | {"SEC_FACIALHAIR_TINT", "FacialHair_color"}, 41 | {"SEC_BLUSHER_TINT", "Blush_color"}, 42 | {"SEC_LIPSTICK_TINT", "Lipstick_color"}, 43 | }, 44 | bool = { 45 | {"MESH_ISPARENT", nil} 46 | }, 47 | float = { 48 | {"MESH_HEADBLEND", "mix_shape"}, 49 | {"MESH_TEXBLEND", "mix_skin"}, 50 | {"MESH_VARBLEND", "mix_third"}, 51 | {"HEADBLEND_DOM", nil}, 52 | {"HEADBLEND_GEOM_BLEND", "mix_shape"}, 53 | {"HEADBLEND_OVER_BLEMISH_PC", "BodyBlemish_opactiy"}, 54 | {"HEADBLEND_OVERLAY_BASE_PC", "SunDamage_opactiy"}, 55 | {"HEADBLEND_OVERLAY_BEARD_PC", "FacialHair_opactiy"}, 56 | {"HEADBLEND_OVERLAY_BLUSHER", "Blush_opactiy"}, 57 | {"HEADBLEND_OVERLAY_DAMAGE_PC", "Complexion_opactiy"}, 58 | {"HEADBLEND_OVERLAY_EYEBRW_PC", "Eyebrows_opactiy"}, 59 | {"HEADBLEND_OVERLAY_MAKEUP_PC", "Makeup_opactiy"}, 60 | {"HEADBLEND_OVERLAY_WETHR_PC", "Age_opactiy"}, 61 | {"HEADBLEND_TEX_BLEND", "mix_skin"}, 62 | {"HEADBLEND_VAR_BLEND", nil}, 63 | {"HEADBLENDOVERLAYCUTS_PC", "Lipstick_opactiy"}, 64 | {"HEADBLENDOVERLAYMOLES_PC", "Freckles_opactiy"}, 65 | {"OVERLAY_BODY_2", nil}, 66 | {"OVERLAY_BODY_3", nil}, 67 | {"OVERLAY_BODY_1", nil}, 68 | {"FEATURE_0", "Nose_width"}, 69 | {"FEATURE_1", "Nose_height"}, 70 | {"FEATURE_2", "Nose_length"}, 71 | {"FEATURE_3", nil}, 72 | {"FEATURE_4", "Nose_tip"}, 73 | {"FEATURE_5", "Nose_bridge"}, 74 | {"FEATURE_6", "Brow_height"}, 75 | {"FEATURE_7", "Brow_width"}, 76 | {"FEATURE_8", "Cheekbone_height"}, 77 | {"FEATURE_9", "Cheekbone_width"}, 78 | {"FEATURE_10", "Cheeks_width"}, 79 | {"FEATURE_11", "Eyes"}, 80 | {"FEATURE_12", "Lips"}, 81 | {"FEATURE_13", "Jaw_width"}, 82 | {"FEATURE_14", "Jaw_height"}, 83 | {"FEATURE_15", "Chin_length"}, 84 | {"FEATURE_16", "Chin_position"}, 85 | {"FEATURE_17", "Chin_width"}, 86 | {"FEATURE_18", "Chin_shape"}, 87 | {"FEATURE_19", "Neck_width"}, 88 | {"FEATURE_20", "EyeColor"} 89 | } 90 | } 91 | 92 | local parent_id_to_name = { 93 | "Benjamin", 94 | "Daniel", 95 | "Joshua", 96 | "Noah", 97 | "Andrew", 98 | "Juan", 99 | "Alex", 100 | "Isaac", 101 | "Evan", 102 | "Ethan", 103 | "Vincent", 104 | "Angel", 105 | "Diego", 106 | "Adrian", 107 | "Gabriel", 108 | "Michael", 109 | "Santiago", 110 | "Kevin", 111 | "Louis", 112 | "Samuel", 113 | "Anthony", 114 | "Hannah", 115 | "Audrey", 116 | "Jasmine", 117 | "Giselle", 118 | "Amelia", 119 | "Isabella", 120 | "Zoe", 121 | "Ava", 122 | "Camila", 123 | "Violet", 124 | "Sophia", 125 | "Evelyn", 126 | "Nicole", 127 | "Ashley", 128 | "Grace", 129 | "Brianna", 130 | "Natalie", 131 | "Olivia", 132 | "Elizabeth", 133 | "Charlotte", 134 | "Emma", 135 | "Claude", 136 | "Niko", 137 | "John", 138 | "Misty" 139 | } 140 | 141 | local featTable = { 142 | "Parent", 143 | "savePreset", 144 | headblends = {} 145 | } 146 | local funcTable = {} 147 | 148 | local Options = {} 149 | Options[0] = {name = "Blemish", on = true} 150 | Options[1] = {name = "FacialHair", on = true} 151 | Options[2] = {name = "Eyebrows", on = true} 152 | Options[3] = {name = "Age", on = true} 153 | Options[4] = {name = "Makeup", on = true} 154 | Options[5] = {name = "Blush", on = true} 155 | Options[6] = {name = "Complexion", on = true} 156 | Options[7] = {name = "SunDamage", on = true} 157 | Options[8] = {name = "Lipstick", on = true} 158 | Options[9] = {name = "Freckles", on = true} 159 | Options[10] = {name = "Head Blend", on = true} 160 | Options[11] = {name = "BodyBlemish", on = true} 161 | Options[13] = {name = "EyeColor", on = true} 162 | Options[14] = {name = "HairHighlightColor", on = true} 163 | Options[15] = {name = "HairColor", on = true} 164 | Options[16] = {name = "Hair", on = true} 165 | 166 | 167 | local FaceFeatures = { 168 | "Nose_width", 169 | "Nose_height", 170 | "Nose_length", 171 | "Nose_bridge", 172 | "Nose_tip", 173 | "Nose_bridge", 174 | "Brow_height", 175 | "Brow_width", 176 | "Cheekbone_height", 177 | "Cheekbone_width", 178 | "Cheeks_width", 179 | "Eyes", 180 | "Lips", 181 | "Jaw_width", 182 | "Jaw_height", 183 | "Chin_length", 184 | "Chin_position", 185 | "Chin_width", 186 | "Chin_shape", 187 | "Neck_width" 188 | } 189 | local path = utils.get_appdata_path("PopstarDevs", "").."\\2Take1Menu\\scripts\\Head_Blends\\" 190 | local auto_apply 191 | 192 | -- Functions 193 | function funcTable.SaveData(pid, defaultName) 194 | local status, name = input.get("Name of preset", defaultName or "", 128, 0) 195 | while status == 1 do 196 | status, name = input.get("Name of preset", defaultName or "", 128, 0) 197 | system.wait(0) 198 | end 199 | if status == 2 then 200 | return HANDLER_POP 201 | end 202 | name = name:gsub("[<>:\"/\\|%?%*]", "") 203 | local pedID = player.get_player_ped(pid) 204 | local valTable = {} 205 | if Options[10].on then 206 | valTable = ped.get_ped_head_blend_data(pedID) 207 | for k, v in pairs(FaceFeatures) do 208 | valTable[v] = ped.get_ped_face_feature(pedID, k - 1) 209 | end 210 | end 211 | if valTable == nil then 212 | menu.notify("Head Blend isn't initialized, open Head Blend in menu tab to fix.", "Head Blend Profiles\nERROR", 5, 0x0000ff) 213 | return HANDLER_POP 214 | end 215 | if Options[16].on then 216 | valTable["Hair"] = ped.get_ped_drawable_variation(pedID, 2) 217 | end 218 | if Options[15].on then 219 | valTable["HairColor"] = ped.get_ped_hair_color(pedID) 220 | end 221 | if Options[14].on then 222 | valTable["HairHighlightColor"] = ped.get_ped_hair_highlight_color(pedID) 223 | end 224 | if Options[13].on then 225 | valTable["EyeColor"] = ped.get_ped_eye_color(pedID) 226 | end 227 | for k, v in pairs(Options) do 228 | if v.on and k ~= 10 and k <= 11 then 229 | valTable[v.name] = ped.get_ped_head_overlay_value(pedID, k) 230 | valTable[v.name.."_opactiy"] = ped.get_ped_head_overlay_opacity(pedID, k) 231 | valTable[v.name.."_color_type"] = ped.get_ped_head_overlay_color_type(pedID, k) 232 | valTable[v.name.."_color"] = ped.get_ped_head_overlay_color(pedID, k) 233 | valTable[v.name.."_highlight_color"] = ped.get_ped_head_overlay_highlight_color(pedID, k) 234 | end 235 | end 236 | funcTable.save_ini(name, path, valTable) 237 | funcTable.addpreset(name) 238 | end 239 | 240 | function funcTable.checkifpathexists() 241 | if not utils.dir_exists(path) then 242 | utils.make_dir(path) 243 | end 244 | end 245 | funcTable.checkifpathexists() 246 | 247 | function funcTable.apply_headblend(HBTable, pedID) 248 | if HBTable["shape_first"] then 249 | ped.set_ped_head_blend_data(pedID, HBTable["shape_first"], 250 | HBTable["shape_second"], 251 | HBTable["shape_third"], 252 | HBTable["skin_first"], 253 | HBTable["skin_second"], 254 | HBTable["skin_third"], 255 | HBTable["mix_shape"], 256 | HBTable["mix_skin"], 257 | HBTable["mix_third"] 258 | ) 259 | end 260 | 261 | if HBTable["HairColor"] or HBTable["HairHighlightColor"] then 262 | HBTable["HairHighlightColor"] = HBTable["HairHighlightColor"] or 0 263 | HBTable["HairColor"] = HBTable["HairColor"] or 0 264 | ped.set_ped_hair_colors(pedID, HBTable["HairColor"], HBTable["HairHighlightColor"]) 265 | end 266 | 267 | if HBTable["EyeColor"] then 268 | ped.set_ped_eye_color(pedID, HBTable["EyeColor"]) 269 | end 270 | 271 | if HBTable["Hair"] then 272 | ped.set_ped_component_variation(pedID, 2, HBTable["Hair"], 0, 0) 273 | end 274 | 275 | for k, v in pairs(Options) do 276 | if not k == 10 or k <= 11 then 277 | if not HBTable[v.name] then 278 | HBTable[v.name] = -1 279 | HBTable[v.name.."_opactiy"] = -1 280 | HBTable[v.name.."_color_type"] = -1 281 | HBTable[v.name.."_color"] = -1 282 | HBTable[v.name.."_highlight_color"] = -1 283 | end 284 | ped.set_ped_head_overlay(pedID, k, HBTable[v.name], HBTable[v.name.."_opactiy"]) 285 | ped.set_ped_head_overlay_color(pedID, k, HBTable[v.name.."_color_type"], HBTable[v.name.."_color"], HBTable[v.name.."_highlight_color"]) 286 | end 287 | end 288 | 289 | for k, v in pairs(FaceFeatures) do 290 | if HBTable[v] then 291 | ped.set_ped_face_feature(pedID, k - 1, HBTable[v]) 292 | end 293 | end 294 | end 295 | 296 | function funcTable.addpreset(HBName) 297 | if featTable.headblends[HBName] then 298 | return 299 | end 300 | 301 | local statPreset 302 | 303 | if menu.is_trusted_mode_enabled() then 304 | statPreset = menu.add_feature(HBName, "action_value_str", featTable["statParent"], function(f) 305 | local HBTable = funcTable.read_ini(HBName, path) 306 | if f.value == 0 then 307 | local prefix = "MP"..stats.stat_get_int(gameplay.get_hash_key("MPPLY_LAST_MP_CHAR"), 1).."_" 308 | for i = 1, 20 do 309 | for index, HB in pairs(HBstats["int"]) do 310 | if HBTable[HB[2]] then 311 | stats.stat_set_int(gameplay.get_hash_key(prefix..HB[1]), HBTable[HB[2]], true) 312 | end 313 | end 314 | -- for index, HB in pairs(HBstats["bool"]) do 315 | -- stats.stat_set_bool(gameplay.get_hash_key(prefix..HB[1]), HBTable[HB[2]], true) 316 | -- end 317 | for index, HB in pairs(HBstats["float"]) do 318 | if HBTable[HB[2]] then 319 | stats.stat_set_float(gameplay.get_hash_key(prefix..HB[1]), HBTable[HB[2]], true) 320 | end 321 | end 322 | system.wait(0) 323 | end 324 | elseif f.value == 1 then 325 | if HBTable["shape_first"] and HBTable["shape_second"] then 326 | menu.notify("Mom: "..parent_id_to_name[HBTable["shape_first"] + 1].." - "..HBTable["shape_first"].."\nDad: "..parent_id_to_name[HBTable["shape_second"] + 1].." - "..HBTable["shape_second"], "Head Blend Profiles") 327 | else 328 | menu.notify("There is no Head Blend data saved in this file.", "Head Blend Profiles") 329 | end 330 | end 331 | end) 332 | statPreset:set_str_data({"Apply", "Notify Parent Names"}) 333 | end 334 | 335 | featTable.headblends[HBName] = menu.add_feature(HBName, "action_value_str", featTable["Parent"], function(f) 336 | if f.value == 0 then 337 | funcTable.apply_headblend(funcTable.read_ini(HBName, path), player.get_player_ped(player.player_id())) 338 | end 339 | 340 | if f.value == 1 then 341 | --[[io.remove(path..HBName..".ini") 342 | menu.delete_feature(f.id) 343 | if statPreset then 344 | menu.delete_feature(statPreset.id) 345 | end--]] 346 | if f.name:match(" %[Auto Apply%]") then 347 | f.name = HBName 348 | auto_apply = nil 349 | else 350 | for k, v in pairs(featTable.headblends) do 351 | if v.name:match(" %[Auto Apply%]") then 352 | featTable.headblends[k].name = k 353 | end 354 | end 355 | f.name = HBName.." [Auto Apply]" 356 | auto_apply = funcTable.read_ini(HBName, path) 357 | end 358 | end 359 | end) 360 | featTable.headblends[HBName]:set_str_data({"Apply", "Auto Apply"}) 361 | end 362 | 363 | function funcTable.write_table(tableName, tableTW, file) 364 | file:write("["..tableName.."]\n") 365 | for k, v in pairs(tableTW) do 366 | if type(v) == "table" then 367 | funcTable.write_table(k, v, file) 368 | else 369 | file:write(k..":"..tostring(v).."\n") 370 | end 371 | end 372 | file:write("[%end%]\n") 373 | end 374 | 375 | function funcTable.save_ini(name, filePath, tableTW, notif) 376 | local file = io.open(filePath..name..".ini", "w+") 377 | 378 | for k, v in pairs(tableTW) do 379 | if type(v) ~= "table" and type(v) ~= "function" then 380 | print(k) 381 | file:write(k..":"..tostring(v).."\n") 382 | end 383 | end 384 | 385 | for k, v in pairs(tableTW) do 386 | if type(v) == "table" then 387 | funcTable.write_table(k, v, file) 388 | end 389 | end 390 | 391 | if notif then 392 | menu.notify("Saved Successfully", "Head Blend Profiles", 3, 0x00ff00) 393 | end 394 | 395 | file:flush() 396 | file:close() 397 | end 398 | 399 | function funcTable.read_table(tableRT, file) 400 | repeat 401 | local line = file:read("*l") 402 | if line:match("%[%%end%%%]") then 403 | return 404 | elseif line:match("%[.*%]") then 405 | if not tableRT[tonumber(line:match("%[(.*)%]")) or line:match("%[(.*)%]")] then 406 | tableRT[tonumber(line:match("%[(.*)%]")) or line:match("%[(.*)%]")] = {} 407 | end 408 | funcTable.read_table(tableRT[tonumber(line:match("%[(.*)%]")) or line:match("%[(.*)%]")], file) 409 | elseif line:match(":(.*)") == "true" or line:match(":(.*)") == "false" then 410 | tableRT[tonumber(line:match("(.*):")) or line:match("(.*):")] = line:match(":(.*)") == "true" 411 | else 412 | tableRT[tonumber(line:match("(.*):")) or line:match("(.*):")] = tonumber(line:match(":(.*)")) or line:match(":(.*)") 413 | end 414 | until not line 415 | end 416 | 417 | 418 | function funcTable.read_ini(name, filePath, tableRT) 419 | tableRT = tableRT or {} 420 | if not name:match("%.ini") then 421 | name = name..".ini" 422 | end 423 | local file = io.open(filePath..name, "r") 424 | if not file then return end 425 | 426 | repeat 427 | local line = file:read("*l") 428 | if not line then 429 | break 430 | end 431 | if line:match("(.*):") then 432 | if line:match(":(.*)") == "true" or line:match(":(.*)") == "false" then 433 | tableRT[tonumber(line:match("(.*):")) or line:match("(.*):")] = line:match(":(.*)") == "true" 434 | else 435 | tableRT[tonumber(line:match("(.*):")) or line:match("(.*):")] = tonumber(line:match(":(.*)")) or line:match(":(.*)") 436 | end 437 | elseif line:match("%[.*%]") then 438 | if not tableRT[tonumber(line:match("%[(.*)%]")) or line:match("%[(.*)%]")] then 439 | tableRT[tonumber(line:match("%[(.*)%]")) or line:match("%[(.*)%]")] = {} 440 | end 441 | funcTable.read_table(tableRT[tonumber(line:match("%[(.*)%]")) or line:match("%[(.*)%]")], file) 442 | end 443 | until not line 444 | 445 | file:close() 446 | 447 | return tableRT 448 | end 449 | 450 | local oldsetting = funcTable.read_ini("Options", path) 451 | if oldsetting then 452 | if type(oldsetting[1]) ~= "table" then 453 | funcTable.save_ini("Options", path, Options) 454 | menu.notify("Old settings overwritten.", "Head Blend Profiles", 3) 455 | end 456 | end 457 | oldsetting = nil 458 | 459 | funcTable.read_ini("Options", path, Options) 460 | 461 | -- Parents 462 | featTable["Parent"] = menu.add_feature("Head Blend Profiles", "parent", 0).id 463 | featTable["Options"] = menu.add_feature("Options", "parent", featTable["Parent"]).id 464 | if menu.is_trusted_mode_enabled() then 465 | featTable["statParent"] = menu.add_feature("Set Stats", "parent", featTable["Parent"]).id 466 | end 467 | 468 | 469 | -- Features 470 | menu.add_feature("Save Options", "action", featTable["Options"], function() 471 | funcTable.save_ini("Options", path, Options, true) 472 | end) 473 | 474 | 475 | featTable["savePreset"] = menu.add_feature("Save current Head Blend", "action", featTable["Parent"], function() 476 | if player.get_player_model(player.player_id()) == 0x9C9EFFD8 or player.get_player_model(player.player_id()) == 0x705E61F2 then 477 | funcTable.SaveData(player.player_id()) 478 | else 479 | menu.notify("Character isn't a freemode model.") 480 | end 481 | end) 482 | 483 | menu.add_player_feature("Yoink their Head Blend", "action", 0, function(f, pid) 484 | if player.get_player_model(player.player_id()) == 0x9C9EFFD8 or player.get_player_model(player.player_id()) == 0x705E61F2 then 485 | funcTable.SaveData(pid, player.get_player_name(pid)) 486 | else 487 | menu.notify("Character isn't a freemode model.") 488 | end 489 | end) 490 | 491 | for i, e in pairs(utils.get_all_files_in_directory(path, "ini")) do 492 | if e ~= "Options.ini" then 493 | funcTable.addpreset(e:match("^(.*)%.ini")) 494 | end 495 | end 496 | 497 | for k, v in pairs(Options) do 498 | menu.add_feature("Save "..v.name, "toggle", featTable["Options"], function(f) 499 | Options[k].on = f.on 500 | end).on = Options[k].on 501 | end 502 | 503 | -- Threads 504 | menu.create_thread(function() 505 | while true do 506 | if auto_apply then 507 | funcTable.apply_headblend(auto_apply, player.get_player_ped(player.player_id())) 508 | end 509 | system.wait(10000) 510 | end 511 | end, nil) 512 | 513 | GhostsHeadBlendLoaded = true -------------------------------------------------------------------------------- /From 2Take1Menu/scripts/README.md: -------------------------------------------------------------------------------- 1 | ## Where can I find more 2take1 lua scripts? 2 | - [2Take1 Script Archive](https://github.com/0x2XPx/2Take1-script-Archive) 3 | - [Github Search](https://github.com/search?q=2take1+lua) 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 2Take1Menu Lua Loader 2 | A Lua loader for Stand, designed to load 2Take1 Lua scripts. 3 | 4 | This is still a **work in progress** so any contributions are appreciated. 5 | 6 | ## Installation 7 | ### Installing the loader 8 | 1. [Download the loader](https://github.com/Murten101/lua_loader/archive/refs/heads/main.zip). 9 | 2. Extract the downloaded files. 10 | 3. Move the `lib` folder and the `2Take1 Lua Loader.lua` file into your `%appdata%\Stand\Lua Scripts` folder. 11 | 4. Optionally, move the `From 2Take1Menu` folder to the `%appdata%\Stand\` folder. 12 | - If you skip this step, the folder will be created automatically the first time you run the loader script. 13 | ### Installing & running 2Take1Menu scripts 14 | 1. Place any 2Take1Menu scripts (and their associated files, if any) into the `%appdata%\Stand\From 2Take1Menu\scripts` folder. 15 | - If the folder doesn't exist, either create it manually or run the script and it will create it for you. 16 | 2. Open Stand and navigate to `Stand > Lua Scripts > 2Take1 Lua Loader`. 17 | 3. Run the loader script. 18 | 4. Once the script is running, navigate to the `Load Scripts` submenu within the loader menu then select a script to load it. 19 | 5. After successfully loading a script, return to the `2Take1 Lua Loader` submenu. The 2Take1 script features will appear under the **Script Features** section. 20 | 6. If a script is added to the folder while the loader script is running, use the "Reset State" feature to reset the script so it can see the new additions. 21 | -------------------------------------------------------------------------------- /lib/2take1 compat.lua: -------------------------------------------------------------------------------- 1 | util.require_natives(1651208000) 2 | util.keep_running() 3 | 4 | local stand = menu 5 | 6 | package.path = package.path .. ";" .. filesystem.stand_dir() .. "From 2Take1Menu\\scripts\\?.lua" 7 | 8 | local config = { 9 | spoof_2take1_install_dir = true 10 | } 11 | 12 | HANDLER_CONTINUE = true 13 | HANDLER_POP = false 14 | 15 | local split = function (input, sep) 16 | local t={} 17 | for str in string.gmatch(input, "([^"..sep.."]+)") do 18 | table.insert(t, str) 19 | end 20 | return t 21 | end 22 | 23 | local function int_to_uint(int) 24 | if int >= 0 then 25 | return int 26 | end 27 | return (1 << 32) + int 28 | end 29 | 30 | function notif_not_imp() 31 | util.toast("function not yet implemented") 32 | util.log(debug.traceback("not implemented", 2)) 33 | return -1 34 | end 35 | 36 | local og_get_return_value_vector3 = native_invoker.get_return_value_vector3 37 | 38 | native_invoker.get_return_value_vector3 = function () 39 | local table = og_get_return_value_vector3() 40 | return v3(table.x, table.y, table.z) 41 | end 42 | 43 | function MenuKey() 44 | return { 45 | keys = {}, 46 | push_vk = function (self, key) 47 | self.keys[#self.keys+1] = key 48 | end, 49 | push_str = function (self, key) 50 | self.keys[#self.keys+1] = key 51 | end, 52 | pop = function (self) 53 | self.keys[#self.keys] = nil 54 | end, 55 | clear = function (self) 56 | self.keys = {} 57 | end, 58 | is_down = function (self) 59 | if #self.keys == 0 then return false end 60 | for _, key in ipairs(self.keys) do 61 | if not util.is_key_down(key) then 62 | return false 63 | end 64 | end 65 | return true 66 | end, 67 | is_down_stepped = function (self) 68 | if #self.keys == 0 then return false end 69 | for _, key in ipairs(self.keys) do 70 | if not util.is_key_down(key) then 71 | return false 72 | end 73 | end 74 | return true 75 | end 76 | } 77 | end 78 | 79 | local feature_type_ids = { -- The table values are stolen from kek's essentials.lua 80 | regular = { 81 | action = 1 << 9, 82 | toggle = 1 << 0, 83 | action_value_f = 1 << 1 | 1 << 7 | 1 << 9, 84 | value_f = 1 << 0 | 1 << 1 | 1 << 7, 85 | action_slider = 1 << 1 | 1 << 2 | 1 << 9, 86 | slider = 1 << 0 | 1 << 1 | 1 << 2, 87 | autoaction_value_str = 1 << 1 | 1 << 5 | 1 << 10, 88 | autoaction_slider = 1 << 1 | 1 << 2 | 1 << 1, 89 | action_value_i = 1 << 1 | 1 << 3 | 1 << 9, 90 | value_i = 1 << 0 | 1 << 1 | 1 << 3, 91 | autoaction_value_f = 1 << 1 | 1 << 7 | 1 << 1, 92 | autoaction_value_i = 1 << 1 | 1 << 3 | 1 << 1, 93 | action_value_str = 1 << 1 | 1 << 5 | 1 << 9, 94 | value_str = 1 << 0 | 1 << 1 | 1 << 5, 95 | parent = 1 << 11 96 | }, 97 | player = { 98 | action = 1 << 9 | 1 << 15, 99 | toggle = 1 << 0 | 1 << 15, 100 | action_value_f = 1 << 1 | 1 << 7 | 1 << 9 | 1 << 15, 101 | value_f = 1 << 0 | 1 << 1 | 1 << 7 | 1 << 15, 102 | action_slider = 1 << 1 | 1 << 2 | 1 << 9 | 1 << 15, 103 | slider = 1 << 0 | 1 << 1 | 1 << 2 | 1 << 15, 104 | autoaction_value_str = 1 << 1 | 1 << 5 | 1 << 10 | 1 << 15, 105 | autoaction_slider = 1 << 1 | 1 << 2 | 1 << 10 | 1 << 15, 106 | action_value_i = 1 << 1 | 1 << 3 | 1 << 9 | 1 << 15, 107 | value_i = 1 << 0 | 1 << 1 | 1 << 3 | 1 << 15, 108 | autoaction_value_f = 1 << 1 | 1 << 7 | 1 << 10 | 1 << 15, 109 | autoaction_value_i = 1 << 1 | 1 << 3 | 1 << 10 | 1 << 15, 110 | action_value_str = 1 << 1 | 1 << 5 | 1 << 9 | 1 << 15, 111 | value_str = 1 << 0 | 1 << 1 | 1 << 5 | 1 << 15, 112 | parent = 1 << 11 113 | } 114 | } 115 | 116 | vec3 = v3 117 | 118 | local v2_meta = { 119 | __div=function (self, other) 120 | if type(other) == "table" then 121 | return v2( self.x / other.x, 122 | self.y / other.y) 123 | elseif type(other) == "number" then 124 | return v2( self.x / other, 125 | self.y / other) 126 | end 127 | end, 128 | } 129 | 130 | v2 = function (x, y) 131 | local inst = {x = x, y = y} 132 | setmetatable(inst, v2_meta) 133 | return inst 134 | end 135 | 136 | local v3_meta = { 137 | __is_const = true, 138 | __sub=function (self, other) 139 | if type(other) == "table" then 140 | return v3( self.x - other.x, 141 | self.y - other.y, 142 | self.z - (other.z or 0)) 143 | elseif type(other) == "number" then 144 | return v3( self.x - other, 145 | self.y - other, 146 | self.z - other) 147 | end 148 | end, 149 | __add=function (self, other) 150 | if type(other) == "table" then 151 | return v3( self.x + other.x, 152 | self.y + other.y, 153 | self.z + (other.z or 0)) 154 | elseif type(other) == "number" then 155 | return v3( self.x + other, 156 | self.y + other, 157 | self.z + other) 158 | end 159 | end, 160 | __mul=function (self, other) 161 | if type(other) == "table" then 162 | return v3( self.x * other.x, 163 | self.y * other.y, 164 | self.z * (other.z or 0)) 165 | elseif type(other) == "number" then 166 | return v3( self.x * other, 167 | self.y * other, 168 | self.z * other) 169 | end 170 | end, 171 | __div=function (self, other) 172 | if type(other) == "table" then 173 | return v3( self.x / other.x, 174 | self.y / other.y, 175 | self.z / (other.z or 0)) 176 | elseif type(other) == "number" then 177 | return v3( self.x / other, 178 | self.y / other, 179 | self.z / other) 180 | end 181 | end, 182 | __eq=function (self, other) 183 | return self.x == other.x and self.y == other.y and self.z == other.z 184 | end, 185 | __lt=function (self, other) 186 | return self.x + self.y + self.z < other.x + other.y + other.z 187 | end, 188 | __le=function (self, other) 189 | return self.x + self.y + self.z <= other.x + other.y + other.z 190 | end, 191 | __tostring=function (self) 192 | return "x:"..self.x.." y:"..self.y.." z:"..self.z 193 | end, 194 | } 195 | 196 | v3 = function (x, y, z) 197 | x = x or 0.0 198 | y = y or 0.0 199 | z = z or 0.0 200 | local vec = 201 | { x = x, y = y or x, z = z or x, 202 | 203 | magnitude = function (self, other) 204 | local end_vec = other and (self - other) or self 205 | return math.sqrt(end_vec.x^2 + end_vec.y^2 + end_vec.z^2) 206 | end, 207 | transformRotToDir = function(self, deg_z, deg_x) 208 | local rad_z = deg_z * math.pi / 180; 209 | local rad_x = deg_x * math.pi / 180; 210 | local num = math.abs(math.cos(rad_x)); 211 | self.x = -math.sin(rad_z) * num 212 | self.y = math.cos(rad_z) * num 213 | self.z = math.sin(rad_x) 214 | end, 215 | degToRad = function (self) 216 | self.x = self.x * math.pi / 180 217 | self.y = self.y * math.pi / 180 218 | self.z = self.z * math.pi / 180 219 | end, 220 | radToDeg = function (self) 221 | self.x = self.x * 180 / math.pi 222 | self.y = self.y * 180 / math.pi 223 | self.z = self.z * 180 / math.pi 224 | end 225 | } 226 | setmetatable(vec, v3_meta) 227 | return vec 228 | end 229 | 230 | local function IntToRGBA(colour) 231 | local t = {} 232 | for i = 0, 3 do 233 | t[i+1] = (colour >> (i * 8)) & 0xFF 234 | end 235 | return t 236 | end 237 | 238 | local og_type = type 239 | type = function (t) 240 | t_type = og_type(t) 241 | if t_type == "table" and t.name then 242 | return "userdata" 243 | else 244 | return t_type 245 | end 246 | end 247 | 248 | local function RGBAToInt(R, G, B, A) 249 | A = A or 255 250 | return ( 251 | (R&0x0ff)<<0x00)| 252 | ((G&0x0ff)<<0x08)| 253 | ((B&0x0ff)<<0x10)| 254 | ((A&0x0ff)<<0x18) 255 | end 256 | 257 | local gamerHandle = memory.alloc(13) 258 | local function getGamerHandle(pid) 259 | NETWORK.NETWORK_HANDLE_FROM_PLAYER(pid, gamerHandle, 13) 260 | return gamerHandle 261 | end 262 | 263 | local function ensure_valid_value(is_float, val) 264 | if is_float then 265 | val = val * 100 266 | end 267 | return math.floor(val) 268 | end 269 | 270 | local function does_type_support_value(type) 271 | return type == feature_type_ids.regular.action_value_f or type == feature_type_ids.regular.action_value_i or type == feature_type_ids.regular.autoaction_value_f or type == feature_type_ids.regular.autoaction_value_i or type == feature_type_ids.regular.slider 272 | end 273 | 274 | local player_feature_setters = { 275 | min = function (self, val) 276 | val = ensure_valid_value(self.is_float, val) 277 | for _, command in pairs(self.feats) do 278 | stand.set_min_value(command.id, val) 279 | end 280 | rawset(self, "_min", val) 281 | end, 282 | max = function (self, val) 283 | val = ensure_valid_value(self.is_float, val) 284 | for _, command in pairs(self.feats) do 285 | stand.set_max_value(command.id, val) 286 | end 287 | rawset(self, "_max", val) 288 | end, 289 | mod = function (self, val) 290 | val = ensure_valid_value(self.is_float, val) 291 | for _, command in pairs(self.feats) do 292 | stand.set_value(command.id, val) 293 | end 294 | rawset(self, "_mod", val) 295 | end, 296 | value = function (self, val) 297 | val = ensure_valid_value(self.is_float, val) 298 | for _, command in pairs(self.feats) do 299 | command.id = val 300 | end 301 | rawset(self, "_value", val) 302 | end, 303 | hidden = function (self, val) 304 | for _, command in pairs(self.feats) do 305 | stand.set_visible(command.id, not not val) 306 | end 307 | rawset(self, "_hidden", val) 308 | end, 309 | on = function (self, val) 310 | if self.id_toggle then 311 | for _, command in pairs(self.feats) do 312 | command.id_toggle = val 313 | end 314 | else 315 | for _, command in pairs(self.feats) do 316 | command.on = val 317 | end 318 | end 319 | rawset(self, "_on", val) 320 | end, 321 | str_data = function (self, val) 322 | for _, command in pairs(self.feats) do 323 | stand.set_action_slider_options(command.id, val) 324 | end 325 | rawset(self, "_str_data", val) 326 | end 327 | } 328 | 329 | local feature_setters = { 330 | name = function (self, val) 331 | if self.id_toggle then 332 | stand.set_menu_name(self.id_toggle, val) 333 | stand.set_menu_name(self.id, val.." type") 334 | else 335 | stand.set_menu_name(self.id, val) 336 | end 337 | rawset(self, "_name", val) 338 | end, 339 | min = function (self, val) 340 | val = ensure_valid_value(self.is_float, val) 341 | stand.set_min_value(self.id, val) 342 | rawset(self, "_min", val) 343 | end, 344 | max = function (self, val) 345 | val = ensure_valid_value(self.is_float, val) 346 | stand.set_max_value(self.id, val) 347 | rawset(self, "_max", val) 348 | end, 349 | mod = function (self, val) 350 | val = ensure_valid_value(self.is_float, val) 351 | stand.set_step_size(self.id, val) 352 | rawset(self, "_value", val) 353 | end, 354 | value = function (self, val) 355 | rawset(self, "_value", val) 356 | if does_type_support_value(self.type) then 357 | val = ensure_valid_value(self.is_float, val) 358 | stand.set_value(self.id, val) 359 | end 360 | end, 361 | hidden = function (self, val) 362 | stand.set_visible(self.id, not not val) 363 | rawset(self, "_hidden", val) 364 | end, 365 | on = function (self, val) 366 | if self.id_toggle then 367 | stand.set_value(self.id_toggle, val) 368 | else 369 | if self.type == feature_type_ids.player.toggle or self.type == feature_type_ids.regular.toggle then 370 | stand.set_value(self.id, val) 371 | end 372 | end 373 | rawset(self, "_on", val) 374 | if self.handler then 375 | self:handler() 376 | end 377 | end, 378 | str_data = function (self, val) 379 | stand.set_action_slider_options(self.id, val) 380 | rawset(self, "_str_data", val) 381 | end 382 | } 383 | 384 | local player_feature_meta = { 385 | __index=function(self, index) 386 | return rawget(self, "_"..index) 387 | end, 388 | __newindex=function(self, index, val) 389 | local setter = player_feature_setters[index] 390 | if setter then 391 | setter(self, val) 392 | else 393 | rawset(self, index, val) 394 | end 395 | end 396 | } 397 | 398 | local feat_array_meta = { 399 | __index=function () 400 | return {} 401 | end 402 | } 403 | 404 | local parents = {} 405 | 406 | local existing_features = {} 407 | 408 | local feature_meta = { 409 | __index=function(self, index) 410 | return rawget(self, "_"..index) 411 | end, 412 | __newindex=function(self, index, val) 413 | local setter = feature_setters[index] 414 | if setter then 415 | setter(self, val) 416 | else 417 | rawset(self, index, val) 418 | end 419 | end 420 | } 421 | 422 | local player_features = {} 423 | 424 | 425 | 426 | local feat = { 427 | new = function(name, parent, type) 428 | local parent_ft = parents[parent] 429 | local ft = { 430 | id=0, 431 | id_toggle=nil, 432 | parent=parents[parent], 433 | type=type, 434 | data={}, 435 | _on=false, 436 | _name=name, 437 | _min=0, 438 | _max=1, 439 | _value=0, 440 | _hidden=false, 441 | set_str_data = function (self, data) 442 | self.str_data = data 443 | local feat = player_features[self.id] 444 | if feat then 445 | for _, command in ipairs(feat) do 446 | stand.set_action_slider_options(command, data) 447 | end 448 | else 449 | stand.set_action_slider_options(self.id, data) 450 | end 451 | end, 452 | pid=nil --this is not actually in the 2Take1 API but its usefull for me so i added it 453 | } 454 | setmetatable(ft, feature_meta) 455 | 456 | if parent_ft then 457 | parent_ft.children[#parent_ft.children+1] = ft 458 | parent_ft.child_count = parent_ft.child_count + 1 459 | end 460 | return ft 461 | end 462 | } 463 | 464 | local player_feat = { 465 | new = function(parent, feats, type) 466 | local ft = { 467 | feats = feats, 468 | id=0, 469 | parent_id=parent, 470 | type=type, 471 | data={}, 472 | _on=false, 473 | _value=0, 474 | _min=0, 475 | _max=1, 476 | _mod=nil, 477 | _str_data={}, 478 | set_str_data = function (self, data) 479 | for _, command in pairs(self.feats) do 480 | stand.set_action_slider_options(command.id, data) 481 | end 482 | end 483 | } 484 | setmetatable(ft.feats, feat_array_meta) 485 | setmetatable(ft, player_feature_meta) 486 | 487 | return ft 488 | end 489 | } 490 | 491 | local root_parent = feat.new("root", nil) 492 | root_parent.id = stand.my_root() 493 | root_parent.children = {} 494 | root_parent.child_count = 0 495 | parents[root_parent.id] = root_parent 496 | 497 | local feature_types = { 498 | parent = function (name, parent, handler, pid) 499 | if parent == 0 or parent == nil then 500 | if pid then 501 | parent = stand.player_root(pid) 502 | else 503 | parent = stand.my_root() 504 | end 505 | end 506 | local f = feat.new(name, parent) 507 | 508 | f.id = stand.list(parent, name, {name}, "", function () 509 | while handler(f, pid) == HANDLER_CONTINUE do 510 | util.yield() 511 | end 512 | end) 513 | 514 | f.children = {} 515 | f.child_count = 0 516 | 517 | parents[f.id] = f 518 | 519 | return f 520 | end, 521 | toggle = function (name, parent, handler, pid) 522 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 523 | 524 | local f = feat.new(name, parent) 525 | 526 | f.id = stand.toggle(parent, name, {name}, "", function (value) 527 | rawset(f, "on", value) 528 | 529 | while handler(f, pid) == HANDLER_CONTINUE do 530 | 531 | util.yield() 532 | end 533 | end) 534 | 535 | return f 536 | end, 537 | action = function (name, parent, handler, pid) 538 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 539 | 540 | local f = feat.new(name, parent) 541 | 542 | f.id = stand.action(parent, name, {name}, "", function () 543 | while handler(f, pid) == HANDLER_CONTINUE do 544 | util.yield() 545 | end 546 | end) 547 | 548 | return f 549 | end, 550 | value_i = function (name, parent, handler, pid) 551 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 552 | 553 | local f = feat.new(name, parent) 554 | 555 | f.id_toggle = stand.toggle(parent, name, {name}, "", function (value) 556 | rawset(f, "on", value) 557 | while handler(f, pid) == HANDLER_CONTINUE do 558 | util.yield() 559 | end 560 | end) 561 | 562 | f.id = stand.slider(parent, name.." value", {name.."value"}, "", 0, 1, 0, 1, function(value) 563 | rawset(f, "_value", value - 1) 564 | end) 565 | 566 | return f 567 | end, 568 | value_f = function (name, parent, handler, pid) 569 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 570 | 571 | local f = feat.new(name, parent) 572 | 573 | f.id_toggle = stand.toggle(parent, name, {name}, "", function (value) 574 | rawset(f, "on", value) 575 | while handler(f, pid) == HANDLER_CONTINUE do 576 | util.yield() 577 | end 578 | end) 579 | 580 | f.id = stand.slider_float(parent, name.." value", {name.."value"}, "", 0, 1, 0, 100, function(value) 581 | rawset(f, "_value", value - 1) 582 | end) 583 | f.is_float = true 584 | 585 | return f 586 | end, 587 | slider = function (name, parent, handler, pid) 588 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 589 | 590 | local f = feat.new(name, parent) 591 | 592 | f.id_toggle = stand.toggle(parent, name, {name}, "", function (value) 593 | rawset(f, "on", value) 594 | while handler(f, pid) == HANDLER_CONTINUE do 595 | util.yield() 596 | end 597 | end) 598 | 599 | f.id = stand.slider(parent, name.." value", {name.."value"}, "", 0, 1, 0, 1, function(value) 600 | rawset(f, "_value", value - 1) 601 | end) 602 | 603 | return f 604 | end, 605 | value_str = function (name, parent, handler, pid) 606 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 607 | 608 | local f = feat.new(name, parent) 609 | 610 | f.id_toggle = stand.toggle(parent, name, {name}, "", function (value) 611 | rawset(f, "on", value) 612 | while handler(f, pid) == HANDLER_CONTINUE do 613 | util.yield() 614 | end 615 | end) 616 | 617 | f.id = stand.slider_text(parent, name.." type", {name.."type"}, "", {}, function (index) 618 | rawset(f, "_value", index - 1) 619 | end) 620 | 621 | return f 622 | end, 623 | action_value_i = function (name, parent, handler, pid) 624 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 625 | 626 | local f = feat.new(name, parent) 627 | 628 | f.id = stand.slider(parent, name, {name}, "", 0, 1, 0, 1, function(value, click) 629 | rawset(f, "value", value) 630 | if not (click & CLICK_FLAG_AUTO) then 631 | while handler(f, pid) == HANDLER_CONTINUE do 632 | util.yield() 633 | end 634 | end 635 | end) 636 | 637 | return f 638 | end, 639 | action_value_f = function (name, parent, handler, pid) 640 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 641 | 642 | local f = feat.new(name, parent) 643 | 644 | f.id = stand.slider_float(parent, name, {name}, "", 0, 1, 0, 100, function (value, click) 645 | rawset(f, "value", value) 646 | if not (click & CLICK_FLAG_AUTO) then 647 | while handler(f, pid) == HANDLER_CONTINUE do 648 | util.yield() 649 | end 650 | end 651 | end) 652 | f.is_float = true 653 | return f 654 | end, 655 | action_slider = function (name, parent, handler, pid) 656 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 657 | 658 | local f = feat.new(name, parent) 659 | 660 | f.id = stand.click_slider(parent, name, {name}, "", 0, 1, 0, 1, function (value) 661 | rawset(f, "_value", value) 662 | while handler(f, pid) == HANDLER_CONTINUE do 663 | util.yield() 664 | end 665 | end) 666 | 667 | return f 668 | end, 669 | action_value_str = function (name, parent, handler, pid) 670 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 671 | 672 | local f = feat.new(name, parent) 673 | 674 | f.id = stand.slider_text(parent, name, {name}, "", {}, function (index) 675 | rawset(f, "_value", index - 1) 676 | while handler(f, pid) == HANDLER_CONTINUE do 677 | util.yield() 678 | end 679 | end) 680 | 681 | return f 682 | end, 683 | autoaction_value_i = function (name, parent, handler, pid) 684 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 685 | 686 | local f = feat.new(name, parent) 687 | 688 | f.id = stand.slider(parent, name, {name}, "", 0, 1, 0, 1, function (value) 689 | rawset(f, "_value", value) 690 | while handler(f, pid) == HANDLER_CONTINUE do 691 | util.yield() 692 | end 693 | end) 694 | 695 | return f 696 | end, 697 | autoaction_value_f = function (name, parent, handler, pid) 698 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 699 | 700 | local f = feat.new(name, parent) 701 | 702 | f.id = stand.slider_float(parent, name, {name}, "", 0, 1, 0, 100, function (value) 703 | rawset(f, "_value", value) 704 | while handler(f, pid) == HANDLER_CONTINUE do 705 | util.yield() 706 | end 707 | end) 708 | f.is_float = true 709 | 710 | return f 711 | end, 712 | autoaction_slider = function (name, parent, handler, pid) 713 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 714 | 715 | local f = feat.new(name, parent) 716 | 717 | f.id = stand.slider(parent, name, {name}, "", 0, 1, 0, 1, function (value) 718 | rawset(f, "_value", value) 719 | while handler(f, pid) == HANDLER_CONTINUE do 720 | util.yield() 721 | end 722 | end) 723 | 724 | return f 725 | end, 726 | autoaction_value_str = function (name, parent, handler, pid) 727 | if parent == 0 or parent == nil then parent = pid and stand.player_root(pid) or stand.my_root() end 728 | 729 | local f = feat.new(name, parent) 730 | 731 | f.id = stand.slider_text(parent, name, {name}, "", {}, function (index) 732 | rawset(f, "_value", index - 1) 733 | while handler(f, pid) == HANDLER_CONTINUE do 734 | util.yield() 735 | end 736 | end) 737 | 738 | return f 739 | end 740 | } 741 | 742 | --players.on_join(function(pid) 743 | -- for _, playerfeat in pairs(player_features) do 744 | -- local parent_playerfeat = player_features[playerfeat.parent].playerfeat 745 | -- playerfeat.playerfeat.feats[#playerfeat.playerfeat.feats + 1] = feature_types[playerfeat.type](playerfeat.name, parent_playerfeat.id, playerfeat.handler, pid) 746 | -- end 747 | --end) 748 | 749 | menu = { 750 | add_feature = function (name, type, parent, handler) 751 | local feature_type = feature_types[type] 752 | if feature_type == nil then util.toast(type.." not found") return end 753 | local feature = feature_type(name, parent, handler or function() end) 754 | feature.type = feature_type_ids.regular[type] 755 | existing_features[feature.id] = feature 756 | return feature 757 | end, 758 | add_player_feature = function (name, type, parent, handler) 759 | local feature_type = feature_types[type] 760 | if feature_type == nil then util.toast(type.." not found") return end 761 | local feats = {} 762 | local parent_playerfeat = player_features[parent] 763 | if parent_playerfeat then 764 | for _, p_feat in pairs(parent_playerfeat.playerfeat.feats) do 765 | local new_feat = feature_type(name, p_feat.id, handler or function() end, p_feat.pid) 766 | new_feat.pid = p_feat.pid 767 | new_feat.type = feature_type_ids.regular[type] 768 | feats[p_feat.pid] = new_feat 769 | end 770 | else 771 | for _, pid in ipairs(players.list()) do 772 | parent = stand.player_root(pid) 773 | 774 | local new_feat = feature_type(name, parent, handler or function() end, pid) 775 | new_feat.pid = pid 776 | new_feat.type = feature_type_ids.regular[type] 777 | feats[pid] = new_feat 778 | end 779 | end 780 | 781 | local new_player_feat = player_feat.new(parent, feats, feature_type_ids.player[type]) 782 | 783 | new_player_feat.id = util.joaat(name..type..tostring(util.current_time_millis())) --generate an id to use for the player feature 784 | 785 | player_features[new_player_feat.id] = { 786 | playerfeat = new_player_feat, 787 | name = name, 788 | type = type, 789 | parent = parent, 790 | handler = handler 791 | } 792 | return new_player_feat 793 | end, 794 | notify = function (message, title, _, _) 795 | message = tostring(message) 796 | if title then message = title.."\n"..message end 797 | util.toast(message, TOAST_ALL) 798 | end, 799 | get_player_feature = function (id) 800 | return player_features[id].playerfeat 801 | end, 802 | delete_feature = function (id) 803 | local feature = existing_features[id] or player_features[id].playerfeat 804 | if feature then 805 | feature.parent.children[feature.id] = nil 806 | end 807 | stand.delete(id) 808 | end, 809 | delete_player_feature = function (id) 810 | local p_feature = player_features[id].playerfeat 811 | if p_feature then 812 | for _, feature in pairs(p_feature.feats) do 813 | feature.parent.children[feature.id] = nil 814 | stand.delete(feature.id) 815 | end 816 | player_features[id] = nil 817 | end 818 | end, 819 | create_thread = util.create_thread, 820 | has_thread_finished = function (t) 821 | if type(t) == "thread" then 822 | return coroutine.status(t) == "dead" or not util.is_scheduled_in(t) 823 | end 824 | return true 825 | end, 826 | delete_thread = util.shoot_thread, 827 | is_trusted_mode_enabled = function (trusted_flag) 828 | return true 829 | end, 830 | get_version = function () 831 | return "2.115.0" 832 | end 833 | } 834 | 835 | utils = { 836 | get_all_files_in_directory = function (path, extension) 837 | local files = filesystem.list_files(path) 838 | local result = {} 839 | for _, file in ipairs(files) do 840 | if filesystem.is_regular_file(file) then 841 | local split_file = split(file, ".") 842 | if #split_file > 1 and split_file[#split_file] == extension then 843 | local file_subs = split(file, "\\") 844 | result[#result+1] = file_subs[#file_subs] 845 | end 846 | end 847 | end 848 | return result 849 | end, 850 | get_all_sub_directories_in_directory = function (path) 851 | local files = filesystem.list_files(path) 852 | local result = {} 853 | for _, file in ipairs(files) do 854 | if not filesystem.is_regular_file(file) then 855 | local file_subs = split(file, "\\") 856 | result[#result+1] = file_subs[#file_subs] 857 | end 858 | end 859 | return result 860 | end, 861 | file_exists = filesystem.exists, 862 | dir_exists = filesystem.is_dir, 863 | make_dir = filesystem.mkdirs, 864 | get_appdata_path = function (dir, file) 865 | if dir[-1] == "\\" then 866 | dir = dir:sub(1, -2) 867 | end 868 | if file ~= "" then 869 | dir ..= "\\"..file 870 | end 871 | if config.spoof_2take1_install_dir and dir:sub(1, 22) == "PopstarDevs\\2Take1Menu" then 872 | dir = filesystem.stand_dir() .. "From 2Take1Menu\\" .. dir:sub(24) 873 | else 874 | dir = filesystem.appdata_dir() .. dir 875 | end 876 | if not filesystem.exists(dir) then 877 | filesystem.mkdir(dir) 878 | end 879 | return dir 880 | end, 881 | from_clipboard = util.get_clipboard_text, 882 | to_clipboard = util.copy_to_clipboard, 883 | time = util.current_unix_time_seconds, 884 | time_ms = util.current_time_millis, 885 | str_to_vecu64 = function (str) 886 | local tbl = {} 887 | str = str or "" 888 | for i=0,#str-1 do 889 | local slot = i//8 890 | local byte = string.byte(str,i+1) 891 | tbl[slot+1] = (tbl[slot+1] or 0) | byte<<((i-slot*8)*8) 892 | end 893 | return tbl 894 | end, 895 | vecu64_to_str = function (vec) 896 | local mem = memory.alloc(#vec*8) 897 | for i, value in ipairs(vec) do 898 | memory.write_long(mem+(8 * (i -1)), value) 899 | end 900 | return memory.read_string(mem) 901 | end 902 | } 903 | 904 | input = { 905 | get = function(header, prefill, max_length) 906 | local label = util.register_label(header or "") 907 | MISC.DISPLAY_ONSCREEN_KEYBOARD(1, label, 0, prefill or 0, 0, 0, 0, max_length or 500) 908 | local status 909 | 910 | repeat 911 | status = MISC.UPDATE_ONSCREEN_KEYBOARD() 912 | util.yield() 913 | until status ~= 0 914 | 915 | if status == 1 then status = 0 end 916 | 917 | return status, MISC.GET_ONSCREEN_KEYBOARD_RESULT() or "" 918 | end 919 | } 920 | 921 | ui = { 922 | notify_above_map = function (text, title, colour) 923 | util.toast(title.."\n"..text, TOAST_ABOVE_MAP) 924 | end, 925 | get_entity_from_blip = HUD.GET_BLIP_INFO_ID_ENTITY_INDEX, 926 | get_blip_from_entity = HUD.GET_BLIP_FROM_ENTITY, 927 | add_blip_for_entity = HUD.ADD_BLIP_FOR_ENTITY, 928 | set_blip_sprite = HUD.SET_BLIP_SPRITE, 929 | set_blip_colour = HUD.SET_BLIP_COLOUR, 930 | hide_hud_component_this_frame = HUD.HIDE_HUD_COMPONENT_THIS_FRAME, 931 | hide_hud_and_radar_this_frame = HUD.HIDE_HUD_AND_RADAR_THIS_FRAME, 932 | get_label_text = HUD._GET_LABEL_TEXT, 933 | draw_rect = GRAPHICS.DRAW_RECT, 934 | draw_line = function (pos1, pos2 , r, g, b, a) 935 | GRAPHICS.DRAW_LINE(pos1.x, pos1.y, pos1.z, pos2.x, pos2.y, pos2.z, r, g, b, a) 936 | end, 937 | draw_text = function (text, pos) 938 | util.BEGIN_TEXT_COMMAND_DISPLAY_TEXT(text) 939 | HUD.END_TEXT_COMMAND_DISPLAY_TEXT(pos.x, pos.y, 0) 940 | end, 941 | set_text_scale = function (size) 942 | return HUD.SET_TEXT_SCALE(1.0, size) 943 | end, 944 | set_text_color = HUD.SET_TEXT_COLOUR, 945 | set_text_font = HUD.SET_TEXT_FONT, 946 | set_text_wrap = HUD.SET_TEXT_WRAP, 947 | set_text_outline = HUD.SET_TEXT_OUTLINE, 948 | set_text_centre = HUD.SET_TEXT_CENTRE, 949 | set_text_right_justify = HUD.SET_TEXT_RIGHT_JUSTIFY, 950 | set_text_justification = HUD.SET_TEXT_JUSTIFICATION, 951 | set_new_waypoint = function (pos) 952 | HUD.SET_NEW_WAYPOINT(pos.x, pos.y) 953 | end, 954 | get_waypoint_coord = function() 955 | local waypoint = HUD.GET_FIRST_BLIP_INFO_ID(8) 956 | local coords = HUD.GET_BLIP_COORDS(waypoint) 957 | return v2(coords.x, coords.y) 958 | end, 959 | is_hud_component_active = HUD.IS_HUD_COMPONENT_ACTIVE, 960 | show_hud_component_this_frame = HUD.SHOW_HUD_COMPONENT_THIS_FRAME, 961 | set_waypoint_off = HUD.SET_WAYPOINT_OFF, 962 | set_blip_as_mission_creator_blip = HUD.SET_BLIP_AS_MISSION_CREATOR_BLIP, 963 | is_mission_creator_blip = HUD.IS_MISSION_CREATOR_BLIP, 964 | add_blip_for_radius = function (pos, radius) 965 | HUD.ADD_BLIP_FOR_RADIUS(pos.x, pos.y, pos.z, radius) 966 | end, 967 | add_blip_for_pickup = HUD.ADD_BLIP_FOR_PICKUP, 968 | add_blip_for_coord = function(pos) 969 | HUD.ADD_BLIP_FOR_COORD(pos.x, pos.y, pos.z) 970 | end, 971 | set_blip_coord = function (blip, pos) 972 | HUD.SET_BLIP_COORDS(blip, pos.x, pos.y, pos.z) 973 | end, 974 | get_blip_coord = HUD.GET_BLIP_COORDS, 975 | remove_blip = HUD.REMOVE_BLIP, 976 | set_blip_route = HUD.SET_BLIP_ROUTE, 977 | set_blip_route_color = HUD.SET_BLIP_ROUTE_COLOUR, 978 | get_current_notification = HUD.THEFEED_GET_FIRST_VISIBLE_DELETE_REMAINING, 979 | remove_notification = HUD.THEFEED_REMOVE_ITEM, 980 | get_objective_coord = function () 981 | local blip = HUD.GET_NEXT_BLIP_INFO_ID(143) or HUD.GET_NEXT_BLIP_INFO_ID(144) or HUD.GET_NEXT_BLIP_INFO_ID(145) or HUD.GET_NEXT_BLIP_INFO_ID(146) 982 | if not blip then return false end 983 | HUD.GET_BLIP_COORDS(blip) 984 | end, 985 | } 986 | 987 | scriptdraw = { 988 | register_sprite = directx.create_texture, 989 | draw_sprite = function (id, pos, scale, rot, colour) 990 | local c = IntToRGBA(colour) 991 | directx.draw_texture(id, scale, scale, 0.5 , 0.5, pos.x, pos.y, rot, c[1], c[2], c[3], c[4]) 992 | end, 993 | get_text_size = function (str, factor) 994 | return v2(0.001, 0.001) 995 | end, 996 | size_pixel_to_rel_x = function (x) 997 | return x 998 | end, 999 | size_pixel_to_rel_y = function (y) 1000 | return y 1001 | end, 1002 | draw_text = function (text, pos, size, scale, rgba, outline, unk) 1003 | util.BEGIN_TEXT_COMMAND_DISPLAY_TEXT(text) 1004 | HUD.END_TEXT_COMMAND_DISPLAY_TEXT(pos.x, pos.y, 0) 1005 | end, 1006 | draw_line = function(pos1, pos2, unk, rgba) 1007 | notif_not_imp() 1008 | end 1009 | } 1010 | 1011 | player = { 1012 | player_id = players.user, 1013 | get_player_ped = players.user_ped, 1014 | set_player_model = PLAYER.SET_PLAYER_MODEL, 1015 | get_player_group = PLAYER.GET_PLAYER_GROUP, 1016 | is_player_female = function (pid) 1017 | return ENTITY.GET_ENTITY_MODEL(PLAYER.GET_PLAYER_PED(pid)) == util.joaat("mp_f_freemode_01") 1018 | end, 1019 | is_player_friend = function (pid) 1020 | return NETWORK.NETWORK_IS_FRIEND(getGamerHandle(pid)) 1021 | end, 1022 | is_player_playing = PLAYER.IS_PLAYER_PLAYING, 1023 | is_player_free_aiming = PLAYER.IS_PLAYER_FREE_AIMING, 1024 | get_entity_player_is_aiming_at = function (pid) 1025 | local ent = memory.alloc_int() 1026 | PLAYER.GET_ENTITY_PLAYER_IS_FREE_AIMING_AT(pid, ent) 1027 | local result = memory.read_int(ent) 1028 | return result 1029 | end, 1030 | get_personal_vehicle = entities.get_user_personal_vehicle_as_handle, 1031 | set_player_visible_locally = NETWORK.SET_PLAYER_VISIBLE_LOCALLY, 1032 | set_local_player_visible_locally = NETWORK.SET_LOCAL_PLAYER_VISIBLE_LOCALLY, 1033 | set_player_as_modder = function () 1034 | end, 1035 | get_player_name = PLAYER.GET_PLAYER_NAME, 1036 | get_player_scid = players.get_rockstar_id, 1037 | is_player_pressing_horn = PLAYER.IS_PLAYER_PRESSING_HORN, 1038 | get_player_ip = players.get_connect_ip, 1039 | is_player_modder = players.is_marked_as_modder, 1040 | is_player_god = players.is_godmode, 1041 | get_player_wanted_level = PLAYER.GET_PLAYER_WANTED_LEVEL, 1042 | player_count = function () 1043 | return #players.list() 1044 | end, 1045 | is_player_in_any_vehicle = function (pid) 1046 | return PED.IS_PED_IN_ANY_VEHICLE(PLAYER.GET_PLAYER_PED(pid), true) 1047 | end, 1048 | get_player_coords = function (pid) 1049 | return ENTITY.GET_ENTITY_COORDS(PLAYER.GET_PLAYER_PED(pid)) 1050 | end, 1051 | get_player_heading = function (pid) 1052 | return ENTITY.GET_ENTITY_HEADING(PLAYER.GET_PLAYER_PED(pid)) 1053 | end, 1054 | get_player_health = function (pid) 1055 | return ENTITY.GET_ENTITY_HEALTH(PLAYER.GET_PLAYER_PED(pid)) 1056 | end, 1057 | get_player_max_health = function (pid) 1058 | return ENTITY.GET_ENTITY_MAX_HEALTH(PLAYER.GET_PLAYER_PED(pid)) 1059 | end, 1060 | get_player_armour = function (pid) 1061 | return PED.GET_PED_ARMOUR(PLAYER.GET_PLAYER_PED(pid)) 1062 | end, 1063 | get_player_from_ped = function (ped) 1064 | if not PED.IS_PED_A_PLAYER(ped) then return -1 end 1065 | for _, pid in ipairs(players.list()) do 1066 | if PLAYER.GET_PLAYER_PED(pid) == ped then 1067 | return pid 1068 | end 1069 | end 1070 | return -1 1071 | end, 1072 | get_player_team = PLAYER.GET_PLAYER_TEAM, 1073 | get_player_vehicle = function (pid) 1074 | return PED.GET_VEHICLE_PED_IS_IN(PLAYER.GET_PLAYER_PED(pid)) 1075 | end, 1076 | is_player_vehicle_god = function (pid) 1077 | return ENTITY.GET_ENTITY_CAN_BE_DAMAGED(PED.GET_VEHICLE_PED_IS_IN(PLAYER.GET_PLAYER_PED(pid))) 1078 | end, 1079 | is_player_host = function (pid) 1080 | return players.get_host() == pid 1081 | end, 1082 | get_host = players.get_host, 1083 | is_player_spectating = function (pid) 1084 | return false 1085 | end, 1086 | get_player_model = function (pid) 1087 | return int_to_uint(ENTITY.GET_ENTITY_MODEL(PLAYER.GET_PLAYER_PED(pid))) 1088 | end, 1089 | send_player_sms = function (pid, message) 1090 | stand.trigger_commands("smstext"..players.get_name(pid).." "..message) 1091 | stand.trigger_commands("smssend"..players.get_name(pid)) 1092 | end, 1093 | unset_player_as_modder = function (pid) 1094 | end, 1095 | get_player_modder_flags = function (pid) 1096 | return 0 1097 | end, 1098 | get_modder_flag_text = function (pid) 1099 | return "" 1100 | end, 1101 | get_modder_flag_ends = function (pid) 1102 | return 0 1103 | end, 1104 | add_modder_flag = function (pid) 1105 | return 0 1106 | end, 1107 | is_player_valid = function (pid) 1108 | return players.exists(pid) 1109 | end, 1110 | get_player_host_token = function (pid) 1111 | players.get_host_token(pid) 1112 | end, 1113 | get_player_host_priority = function (pid) --will implement at some point 1114 | return 4 1115 | end, 1116 | set_player_targeting_mode = PLAYER.SET_PLAYER_TARGETING_MODE, 1117 | } 1118 | 1119 | ped = { 1120 | is_ped_in_any_vehicle = PED.IS_PED_IN_ANY_VEHICLE, 1121 | set_group_formation = PED.SET_GROUP_FORMATION, 1122 | set_ped_as_group_member = PED.SET_PED_AS_GROUP_MEMBER, 1123 | get_ped_group = PED.GET_PED_GROUP_INDEX, 1124 | get_group_size = PED.GET_GROUP_SIZE, 1125 | get_ped_health = function (ped) 1126 | return ENTITY.GET_ENTITY_HEALTH(ped) 1127 | end, 1128 | set_ped_health = function (ped, value) 1129 | ENTITY.SET_ENTITY_HEALTH(ped, value, 0) 1130 | end, 1131 | is_ped_ragdoll = PED.IS_PED_RAGDOLL, 1132 | is_ped_a_player = PED.IS_PED_A_PLAYER, 1133 | get_current_ped_weapon = WEAPON.GET_CURRENT_PED_WEAPON, 1134 | set_ped_into_vehicle = PED.SET_PED_INTO_VEHICLE, 1135 | get_ped_drawable_variation = PED.GET_PED_DRAWABLE_VARIATION, 1136 | get_ped_texture_variation = PED.GET_PED_TEXTURE_VARIATION, 1137 | get_ped_prop_index = PED.GET_PED_PROP_INDEX, 1138 | get_ped_prop_texture_index = PED.GET_PED_PROP_TEXTURE_INDEX, 1139 | set_ped_component_variation = PED.SET_PED_COMPONENT_VARIATION, 1140 | set_ped_prop_index = PED.SET_PED_PROP_INDEX, 1141 | set_ped_can_switch_weapons = function (ped, state) 1142 | PED.SET_PED_CONFIG_FLAG(ped, 48, state) 1143 | end, 1144 | is_ped_shooting = PED.IS_PED_SHOOTING, 1145 | get_ped_bone_index = PED.GET_PED_BONE_INDEX, 1146 | get_ped_bone_coords = function (ped, boneindex, offset) 1147 | return true, PED.GET_PED_BONE_COORDS(ped, boneindex, offset.x, offset.y, offset.z) 1148 | end, 1149 | get_ped_relationship_group_hash = PED.GET_PED_RELATIONSHIP_GROUP_HASH, 1150 | set_ped_relationship_group_hash = PED.SET_PED_RELATIONSHIP_GROUP_HASH, 1151 | get_vehicle_ped_is_using = PED.GET_VEHICLE_PED_IS_USING, 1152 | clear_all_ped_props = PED.CLEAR_ALL_PED_PROPS, 1153 | clear_ped_tasks_immediately = TASK.CLEAR_PED_TASKS_IMMEDIATELY, 1154 | clear_ped_blood_damage = PED.CLEAR_PED_BLOOD_DAMAGE, 1155 | is_ped_in_vehicle = PED.IS_PED_IN_VEHICLE, 1156 | is_ped_using_any_scenario = PED.IS_PED_USING_ANY_SCENARIO, 1157 | set_ped_to_ragdoll = PED.SET_PED_TO_RAGDOLL, 1158 | set_ped_can_ragdoll = PED.SET_PED_CAN_RAGDOLL, 1159 | can_ped_ragdoll = PED.CAN_PED_RAGDOLL, 1160 | get_ped_last_weapon_impact = function (ped) 1161 | local vec = vec3.new() 1162 | PED.GET_PED_LAST_WEAPON_IMPACT_COORD(ped, vec) 1163 | local coord = {x = vec3.getX(vec), y = vec3.getY(vec), z = vec3.getZ(vec)} 1164 | return coord 1165 | end, 1166 | set_ped_combat_ability = PED.SET_PED_COMBAT_ABILITY, 1167 | get_ped_max_health = PED.GET_PED_MAX_HEALTH, 1168 | set_ped_max_health = PED.SET_PED_MAX_HEALTH, 1169 | resurrect_ped = PED.RESURRECT_PED, 1170 | set_ped_combat_movement = PED.SET_PED_COMBAT_MOVEMENT, 1171 | set_ped_combat_range = PED.SET_PED_COMBAT_RANGE, 1172 | set_ped_combat_attributes = PED.SET_PED_COMBAT_ATTRIBUTES, 1173 | set_ped_accuracy = PED.SET_PED_ACCURACY, 1174 | create_ped = entities.create_ped, 1175 | get_number_of_ped_drawable_variations = PED.GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS, 1176 | get_number_of_ped_texture_variations = PED.GET_NUMBER_OF_PED_TEXTURE_VARIATIONS, 1177 | get_number_of_ped_prop_drawable_variations = PED.GET_NUMBER_OF_PED_PROP_DRAWABLE_VARIATIONS, 1178 | get_number_of_ped_prop_texture_variations = PED.GET_NUMBER_OF_PED_PROP_TEXTURE_VARIATIONS, 1179 | set_ped_random_component_variation = PED.SET_PED_RANDOM_COMPONENT_VARIATION, 1180 | set_ped_default_component_variation = PED.SET_PED_DEFAULT_COMPONENT_VARIATION, 1181 | set_ped_movement_clipset = PED.SET_PED_MOVEMENT_CLIPSET, 1182 | reset_ped_movement_clipset = PED.RESET_PED_MOVEMENT_CLIPSET, 1183 | clone_ped = PED.CLONE_PED, 1184 | set_ped_config_flag = PED.SET_PED_CONFIG_FLAG, 1185 | set_ped_ragdoll_blocking_flags = PED.SET_RAGDOLL_BLOCKING_FLAGS, 1186 | reset_ped_ragdoll_blocking_flags = PED.CLEAR_RAGDOLL_BLOCKING_FLAGS, 1187 | set_ped_density_multiplier_this_frame = PED.SET_PED_DENSITY_MULTIPLIER_THIS_FRAME, 1188 | set_scenario_ped_density_multiplier_this_frame = PED.SET_SCENARIO_PED_DENSITY_MULTIPLIER_THIS_FRAME, 1189 | get_all_peds = entities.get_all_peds_as_handles, 1190 | create_group = PED.CREATE_GROUP, 1191 | remove_group = PED.REMOVE_GROUP, 1192 | set_ped_as_group_leader = PED.SET_PED_AS_GROUP_LEADER, 1193 | remove_ped_from_group = PED.REMOVE_PED_FROM_GROUP, 1194 | is_ped_group_member = PED.IS_PED_GROUP_MEMBER, 1195 | set_group_formation_spacing = PED.SET_GROUP_FORMATION_SPACING, 1196 | reset_group_formation_default_spacing = PED.RESET_GROUP_FORMATION_DEFAULT_SPACING, 1197 | set_ped_never_leaves_group = PED.SET_PED_NEVER_LEAVES_GROUP, 1198 | does_group_exist = PED.DOES_GROUP_EXIST, 1199 | is_ped_in_group = PED.IS_PED_IN_GROUP, 1200 | set_create_random_cops = PED.SET_CREATE_RANDOM_COPS, 1201 | can_create_random_cops = PED.CAN_CREATE_RANDOM_COPS, 1202 | is_ped_swimming = PED.IS_PED_SWIMMING, 1203 | is_ped_swimming_underwater = PED.IS_PED_SWIMMING_UNDER_WATER, 1204 | clear_relationship_between_groups = PED.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, 1205 | set_relationship_between_groups = PED.SET_RELATIONSHIP_BETWEEN_GROUPS, 1206 | get_ped_head_blend_data = PED.GET_PED_HEAD_BLEND_DATA, 1207 | set_ped_head_blend_data = PED.SET_PED_HEAD_BLEND_DATA, 1208 | --get_ped_face_feature = !#! NO MATCH FOUND !#!, 1209 | set_ped_face_feature = PED._SET_PED_MICRO_MORPH_VALUE, 1210 | --get_ped_hair_color = !#! NO MATCH FOUND !#!, ----need a hook 1211 | --get_ped_hair_highlight_color = !#! NO MATCH FOUND !#!, ----need a hook 1212 | get_ped_eye_color = PED._GET_PED_EYE_COLOR, 1213 | set_ped_hair_colors = PED._SET_PED_HAIR_COLOR, 1214 | set_ped_eye_color = PED._SET_PED_EYE_COLOR, 1215 | set_ped_head_overlay = PED.SET_PED_HEAD_OVERLAY, 1216 | get_ped_head_overlay_value = PED._GET_PED_HEAD_OVERLAY_VALUE, 1217 | --get_ped_head_overlay_opacity = !#! NO MATCH FOUND !#!, --need a hook 1218 | set_ped_head_overlay_color = PED._SET_PED_HEAD_OVERLAY_COLOR, 1219 | --get_ped_head_overlay_color_type = !#! NO MATCH FOUND !#!, --need a hook 1220 | --get_ped_head_overlay_color = !#! NO MATCH FOUND !#!, --need a hook 1221 | --get_ped_head_overlay_highlight_color = !#! NO MATCH FOUND !#!, --need a hook 1222 | set_can_attack_friendly = PED.SET_CAN_ATTACK_FRIENDLY, 1223 | add_relationship_group = PED.ADD_RELATIONSHIP_GROUP, 1224 | does_relationship_group_exist = PED._DOES_RELATIONSHIP_GROUP_EXIST, 1225 | remove_relationship_group = PED.REMOVE_RELATIONSHIP_GROUP 1226 | } 1227 | 1228 | network = { 1229 | network_is_host = NETWORK.NETWORK_IS_HOST, 1230 | has_control_of_entity = NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY, 1231 | request_control_of_entity = NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY, 1232 | is_session_started = NETWORK.NETWORK_IS_SESSION_STARTED, 1233 | network_session_kick_player = NETWORK.NETWORK_SESSION_KICK_PLAYER, 1234 | is_friend_online = NETWORK.NETWORK_IS_FRIEND_ONLINE, 1235 | is_friend_in_multiplayer = NETWORK.NETWORK_IS_FRIEND_IN_MULTIPLAYER, 1236 | get_friend_scid = function(name) 1237 | for i=0,NETWORK.NETWORK_GET_FRIEND_COUNT()-1 do 1238 | if NETWORK.NETWORK_GET_FRIEND_NAME(i) == name then 1239 | NETWORK.NETWORK_HANDLE_FROM_FRIEND(i, gamerHandle, 13) 1240 | return tonumber(NETWORK.NETWORK_MEMBER_ID_FROM_GAMER_HANDLE(gamerHandle)) 1241 | end 1242 | end 1243 | return 0 1244 | end, 1245 | get_friend_count = NETWORK.NETWORK_GET_FRIEND_COUNT, 1246 | get_max_friends = NETWORK.NETWORK_GET_MAX_FRIENDS, 1247 | network_hash_from_player = NETWORK.NETWORK_HASH_FROM_PLAYER_HANDLE, 1248 | get_friend_index_name = NETWORK.NETWORK_GET_FRIEND_NAME, 1249 | is_friend_index_online = NETWORK.NETWORK_IS_FRIEND_INDEX_ONLINE, 1250 | is_scid_friend = function(rid) 1251 | rid = tostring(rid) 1252 | for i=0,NETWORK.NETWORK_GET_FRIEND_COUNT()-1 do 1253 | NETWORK.NETWORK_HANDLE_FROM_FRIEND(i, gamerHandle, 13) 1254 | if NETWORK.NETWORK_MEMBER_ID_FROM_GAMER_HANDLE(gamerHandle) == rid then 1255 | return true 1256 | end 1257 | end 1258 | return false 1259 | end, 1260 | get_entity_player_is_spectating = function () 1261 | return nil 1262 | end, 1263 | get_player_player_is_spectating = function () 1264 | return nil 1265 | end, 1266 | send_chat_message = function (message, team) 1267 | chat.send_message(message, team, true, true) 1268 | end, 1269 | force_remove_player = function (pid) 1270 | stand.trigger_commands("kick"..players.get_name(pid)) 1271 | return false 1272 | end, 1273 | } 1274 | 1275 | entity = { 1276 | get_entity_coords = ENTITY.GET_ENTITY_COORDS, 1277 | set_entity_coords_no_offset = function (ent, pos) 1278 | ENTITY.SET_ENTITY_COORDS_NO_OFFSET(ent, pos.x, pos.y, pos.z) 1279 | return true 1280 | end, 1281 | get_entity_rotation = ENTITY.GET_ENTITY_ROTATION, 1282 | set_entity_rotation = function (ent, rot) 1283 | ENTITY.SET_ENTITY_ROTATION(ent, rot.x, rot.y, rot.z, 2, true) 1284 | end, 1285 | set_entity_heading = ENTITY.SET_ENTITY_HEADING, 1286 | set_entity_velocity = function (ent, veh) 1287 | ENTITY.SET_ENTITY_VELOCITY(ent, veh.x, veh.y, veh.z) 1288 | end, 1289 | get_entity_velocity = ENTITY.GET_ENTITY_VELOCITY, 1290 | is_an_entity = ENTITY.IS_AN_ENTITY, 1291 | is_entity_a_ped = ENTITY.IS_ENTITY_A_PED, 1292 | is_entity_a_vehicle = ENTITY.IS_ENTITY_A_VEHICLE, 1293 | is_entity_an_object = ENTITY.IS_ENTITY_AN_OBJECT, 1294 | is_entity_dead = ENTITY.IS_ENTITY_DEAD, 1295 | is_entity_on_fire = FIRE.IS_ENTITY_ON_FIRE, 1296 | is_entity_visible = ENTITY.IS_ENTITY_VISIBLE, 1297 | is_entity_attached = ENTITY.IS_ENTITY_ATTACHED, 1298 | set_entity_visible = ENTITY.SET_ENTITY_VISIBLE, 1299 | get_entity_type = ENTITY.GET_ENTITY_TYPE, 1300 | set_entity_gravity = ENTITY.SET_ENTITY_HAS_GRAVITY, 1301 | apply_force_to_entity = ENTITY.APPLY_FORCE_TO_ENTITY, 1302 | get_entity_attached_to = ENTITY.GET_ENTITY_ATTACHED_TO, 1303 | detach_entity = ENTITY.DETACH_ENTITY, 1304 | get_entity_model_hash = function (veh) 1305 | return int_to_uint(ENTITY.GET_ENTITY_MODEL(veh)) 1306 | end, 1307 | get_entity_heading = ENTITY.GET_ENTITY_HEADING, 1308 | attach_entity_to_entity = function (subject, target, boneIndex, offset, rot, softPinning, collision, isPed, vertexIndex, fixedRot) 1309 | ENTITY.ATTACH_ENTITY_TO_ENTITY(subject, target, boneIndex, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, false, softPinning, collision, isPed, vertexIndex, fixedRot) 1310 | return true 1311 | end, 1312 | set_entity_as_mission_entity = ENTITY.SET_ENTITY_AS_MISSION_ENTITY, 1313 | set_entity_collision = ENTITY.SET_ENTITY_COLLISION, 1314 | is_entity_in_air = ENTITY.IS_ENTITY_IN_AIR, 1315 | set_entity_as_no_longer_needed = function (ent) 1316 | local ent_ptr = memory.alloc_int() 1317 | memory.write_int(ent_ptr, ent) 1318 | ENTITY.SET_ENTITY_AS_NO_LONGER_NEEDED(ent_ptr) 1319 | end, 1320 | set_entity_no_collsion_entity = ENTITY.SET_ENTITY_NO_COLLISION_ENTITY, 1321 | freeze_entity = ENTITY.FREEZE_ENTITY_POSITION, 1322 | get_entity_offset_from_coords = ENTITY.GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS, 1323 | get_entity_offset_from_entity = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS, 1324 | set_entity_alpha = ENTITY.SET_ENTITY_ALPHA, 1325 | reset_entity_alpha = ENTITY.RESET_ENTITY_ALPHA, 1326 | delete_entity = entities.delete_by_handle, 1327 | set_entity_god_mode = ENTITY.SET_ENTITY_INVINCIBLE, 1328 | get_entity_god_mode = function(ent) return not ENTITY._GET_ENTITY_CAN_BE_DAMAGED(ent) end, 1329 | is_entity_in_water = ENTITY.IS_ENTITY_IN_WATER, 1330 | get_entity_speed = ENTITY.GET_ENTITY_SPEED, 1331 | set_entity_lights = ENTITY.SET_ENTITY_LIGHTS, 1332 | set_entity_max_speed = ENTITY.SET_ENTITY_MAX_SPEED, 1333 | get_entity_pitch = ENTITY.GET_ENTITY_PITCH, 1334 | get_entity_roll = ENTITY.GET_ENTITY_ROLL, 1335 | --get_entity_physics_rotation = !#! NO MATCH FOUND !#!, 1336 | get_entity_physics_heading = ENTITY._GET_ENTITY_PHYSICS_HEADING, 1337 | --get_entity_physics_pitch = !#! NO MATCH FOUND !#!, 1338 | --get_entity_physics_roll = !#! NO MATCH FOUND !#!, 1339 | does_entity_have_physics = ENTITY.DOES_ENTITY_HAVE_PHYSICS, 1340 | get_entity_rotation_velocity = ENTITY.GET_ENTITY_ROTATION_VELOCITY, 1341 | get_entity_submerged_level = ENTITY.GET_ENTITY_SUBMERGED_LEVEL, 1342 | get_entity_population_type = ENTITY.GET_ENTITY_POPULATION_TYPE, 1343 | is_entity_static = ENTITY.IS_ENTITY_STATIC, 1344 | is_entity_in_zone = ENTITY.IS_ENTITY_IN_ZONE, 1345 | is_entity_upright = ENTITY.IS_ENTITY_UPRIGHT, 1346 | is_entity_upside_down = ENTITY.IS_ENTITY_UPSIDEDOWN, 1347 | has_entity_been_damaged_by_any_object = ENTITY.HAS_ENTITY_BEEN_DAMAGED_BY_ANY_OBJECT, 1348 | has_entity_been_damaged_by_any_vehicle = ENTITY.HAS_ENTITY_BEEN_DAMAGED_BY_ANY_VEHICLE, 1349 | has_entity_been_damaged_by_any_ped = ENTITY.HAS_ENTITY_BEEN_DAMAGED_BY_ANY_PED, 1350 | has_entity_been_damaged_by_entity = ENTITY.HAS_ENTITY_BEEN_DAMAGED_BY_ENTITY, 1351 | does_entity_have_drawable = ENTITY.DOES_ENTITY_HAVE_DRAWABLE, 1352 | has_entity_collided_with_anything = ENTITY.HAS_ENTITY_COLLIDED_WITH_ANYTHING, 1353 | --get_entity_entity_has_collided_with = !#! NO MATCH FOUND !#!, 1354 | get_entity_bone_index_by_name = ENTITY.GET_ENTITY_BONE_INDEX_BY_NAME, 1355 | get_entity_forward_vector = ENTITY.GET_ENTITY_FORWARD_VECTOR, 1356 | get_entity_model_dimensions = function (hash) 1357 | local minimum = vec3.new() 1358 | local maximum = vec3.new() 1359 | MISC.GET_MODEL_DIMENSIONS(hash, minimum, maximum) 1360 | local maximum_vec = v3(maximum.x, maximum.y, maximum.z) 1361 | local minimum_vec = v3(minimum.x, minimum.y, minimum.z) 1362 | return minimum_vec, maximum_vec 1363 | end 1364 | } 1365 | 1366 | object = { 1367 | create_object = function (model, pos, networked, dynamic) 1368 | return OBJECT.CREATE_OBJECT_NO_OFFSET(model, pos.x, pos.y, pos.z, networked, dynamic) 1369 | end, 1370 | create_world_object = entities.create_object, 1371 | get_all_objects = entities.get_all_objects_as_handles, 1372 | get_all_pickups = entities.get_all_pickups_as_handles 1373 | } 1374 | 1375 | stats = { 1376 | stat_get_int = function (hash, unk) 1377 | local value_ptr = memory.alloc_int() 1378 | local state = STATS.STAT_GET_INT(hash, value_ptr, unk) 1379 | local value = memory.read_int(value_ptr) 1380 | return value, state 1381 | end, 1382 | stat_get_float = function (hash, unk) 1383 | local value_ptr = memory.alloc_int() 1384 | local state = STATS.STAT_GET_FLOAT(hash, value_ptr, unk) 1385 | local value = memory.read_float(value_ptr) 1386 | return value, state 1387 | end, 1388 | stat_get_bool = function (hash, unk) 1389 | local value_ptr = memory.alloc_int() 1390 | local state = STATS.STAT_GET_BOOl(hash, value_ptr, unk) 1391 | local value = memory.read_bool(value_ptr) 1392 | return value, state 1393 | end, 1394 | stat_set_int = STATS.STAT_SET_INT, 1395 | stat_set_float = STATS.STAT_SET_FLOAT, 1396 | stat_set_bool = STATS.STAT_SET_BOOL, 1397 | stat_get_i64 = notif_not_imp, 1398 | stat_set_i64 = notif_not_imp, 1399 | stat_get_u64 = notif_not_imp, 1400 | stat_set_u64 = notif_not_imp, 1401 | stat_get_masked_int = STATS.STAT_GET_MASKED_INT, 1402 | stat_set_masked_int = STATS.STAT_SET_MASKED_INT, 1403 | stat_get_masked_bool = notif_not_imp, 1404 | stat_set_masked_bool = notif_not_imp, 1405 | stat_get_bool_hash_and_mask = notif_not_imp, 1406 | stat_get_int_hash_and_mask = notif_not_imp, 1407 | } 1408 | 1409 | script = { 1410 | trigger_script_event = function (eventId, player, params) 1411 | util.trigger_script_event(1 << player, {eventId, table.unpack(params)}) 1412 | end, 1413 | get_host_of_this_script = players.get_script_host, 1414 | get_global_f = function (i) 1415 | return memory.read_float(memory.script_global(i)) 1416 | end, 1417 | get_global_i = function (i) 1418 | return memory.read_int(memory.script_global(i)) 1419 | end, 1420 | set_global_f = function (i, v) 1421 | memory.write_float(memory.script_global(i), v) 1422 | return true 1423 | end, 1424 | set_global_i = function (i, v) 1425 | memory.write_int(memory.script_global(i), v) 1426 | return true 1427 | end, 1428 | get_local_f = function (script, i) 1429 | return memory.read_float(memory.script_local(script, i)) 1430 | end, 1431 | get_local_i = function (script, i) 1432 | return memory.read_int(memory.script_local(script, i)) 1433 | end, 1434 | set_local_f = function (script, i, v) 1435 | return memory.write_float(memory.script_local(script, i), v) 1436 | end, 1437 | set_local_i = function (script, i, v) 1438 | return memory.write_int(memory.script_local(script, i), v) 1439 | end 1440 | } 1441 | 1442 | local weapon_list 1443 | --category_id || 0 1444 | --hash || -1716189206 1445 | --label_key || WT_KNIFE 1446 | --category || MELEE 1447 | local weapon_hash_to_weapon 1448 | local function populate_hash_to_weapon_table() 1449 | if not weapon_list then weapon_list = util.get_weapons() end 1450 | weapon_hash_to_weapon = {} 1451 | for _, weapon in ipairs(weapon_list) do 1452 | weapon_hash_to_weapon[int_to_uint(weapon.hash)] = weapon 1453 | end 1454 | end 1455 | weapon = { 1456 | give_delayed_weapon_to_ped = WEAPON.GIVE_DELAYED_WEAPON_TO_PED, 1457 | get_weapon_tint_count = WEAPON.GET_WEAPON_TINT_COUNT, 1458 | get_ped_weapon_tint_index = WEAPON.GET_PED_WEAPON_TINT_INDEX, 1459 | set_ped_weapon_tint_index = WEAPON.SET_PED_WEAPON_TINT_INDEX, 1460 | give_weapon_component_to_ped = WEAPON.GIVE_WEAPON_COMPONENT_TO_PED, 1461 | remove_all_ped_weapons = WEAPON.REMOVE_ALL_PED_WEAPONS, 1462 | remove_weapon_from_ped = WEAPON.REMOVE_WEAPON_FROM_PED, 1463 | get_max_ammo = WEAPON.GET_MAX_AMMO, 1464 | set_ped_ammo = WEAPON.SET_PED_AMMO, 1465 | remove_weapon_component_from_ped = WEAPON.REMOVE_WEAPON_COMPONENT_FROM_PED, 1466 | has_ped_got_weapon_component = WEAPON.HAS_PED_GOT_WEAPON_COMPONENT, 1467 | get_ped_ammo_type_from_weapon = WEAPON.GET_PED_AMMO_TYPE_FROM_WEAPON, 1468 | set_ped_ammo_by_type = WEAPON.SET_PED_AMMO_BY_TYPE, 1469 | has_ped_got_weapon = WEAPON.HAS_PED_GOT_WEAPON, 1470 | get_all_weapon_hashes = function () 1471 | if not weapon_list then weapon_list = util.get_weapons() end 1472 | local result = {} 1473 | for _, weapon in ipairs(weapon_list) do 1474 | result[#result+1] = weapon.hash 1475 | end 1476 | return result 1477 | end, 1478 | get_weapon_name = function (hash) 1479 | if not weapon_hash_to_weapon then 1480 | populate_hash_to_weapon_table() 1481 | end 1482 | 1483 | if not hash then return "invalid weapon" end 1484 | 1485 | local weapon = weapon_hash_to_weapon[hash] 1486 | 1487 | if weapon then 1488 | return util.get_label_text(weapon_hash_to_weapon[hash].label_key) 1489 | else 1490 | return "invalid weapon" 1491 | end 1492 | 1493 | end, 1494 | get_weapon_weapon_wheel_slot = notif_not_imp, 1495 | get_weapon_model = WEAPON.GET_WEAPONTYPE_MODEL, 1496 | get_weapon_audio_item = notif_not_imp, 1497 | get_weapon_slot = WEAPON.GET_WEAPONTYPE_SLOT, 1498 | get_weapon_ammo_type = function (hash) 1499 | return WEAPON.GET_PED_AMMO_TYPE_FROM_WEAPON(PLAYER.PLAYER_PED_ID(), hash) 1500 | end, 1501 | get_weapon_weapon_group = WEAPON.GET_WEAPONTYPE_GROUP, 1502 | get_weapon_weapon_type = notif_not_imp, 1503 | get_weapon_pickup = notif_not_imp 1504 | } 1505 | 1506 | fire = { 1507 | add_explosion = function (pos, type, isAudible, isInvis, fCamShake, owner) 1508 | FIRE.ADD_EXPLOSION(pos.x, pos.y ,pos.z, type, isAudible, isInvis, fCamShake, owner) 1509 | end, 1510 | start_entity_fire = FIRE.START_ENTITY_FIRE, 1511 | stop_entity_fire = FIRE.STOP_ENTITY_FIRE 1512 | } 1513 | 1514 | cutscene = { 1515 | stop_cutscene_immediately = CUTSCENE.STOP_CUTSCENE_IMMEDIATELY, 1516 | remove_cutscene = CUTSCENE.REMOVE_CUTSCENE, 1517 | is_cutscene_active = CUTSCENE.IS_CUTSCENE_ACTIVE, 1518 | is_cutscene_playing = CUTSCENE.IS_CUTSCENE_PLAYING 1519 | } 1520 | 1521 | vehicle = { 1522 | set_vehicle_reduce_grip = VEHICLE.SET_VEHICLE_REDUCE_GRIP, 1523 | set_vehicle_steer_bias = VEHICLE.SET_VEHICLE_STEER_BIAS, 1524 | set_vehicle_tire_smoke_color = VEHICLE.SET_VEHICLE_TYRE_SMOKE_COLOR, 1525 | get_ped_in_vehicle_seat = VEHICLE.GET_PED_IN_VEHICLE_SEAT, 1526 | get_free_seat = function (veh) 1527 | local seat_count = VEHICLE.GET_VEHICLE_MODEL_NUMBER_OF_SEATS(ENTITY.GET_ENTITY_MODEL(veh)) 1528 | for i = -1, seat_count - 2, 1 do 1529 | if VEHICLE.IS_VEHICLE_SEAT_FREE(veh, i, true) then 1530 | return i 1531 | end 1532 | end 1533 | end, 1534 | is_vehicle_full = function (veh) 1535 | return not VEHICLE.ARE_ANY_VEHICLE_SEATS_FREE(veh) 1536 | end, 1537 | set_vehicle_stolen = VEHICLE.SET_VEHICLE_IS_STOLEN, 1538 | set_vehicle_color = VEHICLE.SET_VEHICLE_COLOURS, 1539 | get_mod_text_label = VEHICLE.GET_MOD_TEXT_LABEL, 1540 | get_mod_slot_name = VEHICLE.GET_MOD_SLOT_NAME, 1541 | get_num_vehicle_mods = VEHICLE.GET_NUM_VEHICLE_MODS, 1542 | set_vehicle_mod = VEHICLE.SET_VEHICLE_MOD, 1543 | get_vehicle_mod = VEHICLE.GET_VEHICLE_MOD, 1544 | set_vehicle_mod_kit_type = VEHICLE.SET_VEHICLE_MOD_KIT, 1545 | set_vehicle_extra = VEHICLE.SET_VEHICLE_EXTRA, 1546 | does_extra_exist = VEHICLE.DOES_EXTRA_EXIST, 1547 | is_vehicle_extra_turned_on = VEHICLE.IS_VEHICLE_EXTRA_TURNED_ON, 1548 | toggle_vehicle_mod = VEHICLE.TOGGLE_VEHICLE_MOD, 1549 | set_vehicle_bulletproof_tires = VEHICLE.SET_VEHICLE_TYRES_CAN_BURST, 1550 | is_vehicle_a_convertible = VEHICLE.IS_VEHICLE_A_CONVERTIBLE, 1551 | get_convertible_roof_state = VEHICLE.GET_CONVERTIBLE_ROOF_STATE, 1552 | set_convertible_roof = VEHICLE.SET_CONVERTIBLE_ROOF, 1553 | set_vehicle_indicator_lights = VEHICLE.SET_VEHICLE_INDICATOR_LIGHTS, 1554 | set_vehicle_brake_lights = VEHICLE.SET_VEHICLE_BRAKE_LIGHTS, 1555 | set_vehicle_can_be_visibly_damaged = VEHICLE.SET_VEHICLE_CAN_BE_VISIBLY_DAMAGED, 1556 | set_vehicle_engine_on = VEHICLE.SET_VEHICLE_ENGINE_ON, 1557 | set_vehicle_fixed = VEHICLE.SET_VEHICLE_FIXED, 1558 | set_vehicle_deformation_fixed = VEHICLE.SET_VEHICLE_DEFORMATION_FIXED, 1559 | set_vehicle_undriveable = VEHICLE.SET_VEHICLE_UNDRIVEABLE, 1560 | set_vehicle_on_ground_properly = VEHICLE.SET_VEHICLE_ON_GROUND_PROPERLY, 1561 | set_vehicle_forward_speed = VEHICLE.SET_VEHICLE_FORWARD_SPEED, 1562 | set_vehicle_number_plate_text = VEHICLE.SET_VEHICLE_NUMBER_PLATE_TEXT, 1563 | set_vehicle_door_open = VEHICLE.SET_VEHICLE_DOOR_OPEN, 1564 | set_vehicle_doors_shut = VEHICLE.SET_VEHICLE_DOORS_SHUT, 1565 | is_toggle_mod_on = VEHICLE.IS_TOGGLE_MOD_ON, 1566 | set_vehicle_wheel_type = VEHICLE.SET_VEHICLE_WHEEL_TYPE, 1567 | set_vehicle_number_plate_index = VEHICLE.SET_VEHICLE_NUMBER_PLATE_TEXT_INDEX, 1568 | set_vehicle_tires_can_burst = VEHICLE.SET_VEHICLE_TYRES_CAN_BURST, 1569 | set_vehicle_tire_burst = VEHICLE.SET_VEHICLE_TYRE_BURST, 1570 | get_num_vehicle_mod = VEHICLE.GET_VEHICLE_MOD, 1571 | is_vehicle_engine_running = VEHICLE.GET_IS_VEHICLE_ENGINE_RUNNING, 1572 | set_vehicle_engine_health = VEHICLE.SET_VEHICLE_ENGINE_HEALTH, 1573 | is_vehicle_damaged = function (veh) 1574 | return VEHICLE.GET_ENTITY_MAX_HEALTH(veh) > VEHICLE.GET_ENTITY_HEALTH(veh) 1575 | end, 1576 | is_vehicle_on_all_wheels = VEHICLE.IS_VEHICLE_ON_ALL_WHEELS, 1577 | create_vehicle = function (hash, pos, heading, networked, alwaysFalse) 1578 | local veh = entities.create_vehicle(hash, pos, heading) 1579 | ENTITY._SET_ENTITY_CLEANUP_BY_ENGINE(veh, true) 1580 | return veh 1581 | end, 1582 | set_vehicle_doors_locked = VEHICLE.SET_VEHICLE_DOORS_LOCKED, 1583 | set_vehicle_neon_lights_color = function (veh, colour) 1584 | c = IntToRGBA(colour) 1585 | VEHICLE._SET_VEHICLE_NEON_LIGHTS_COLOUR(veh, c.r, c.g, c.b) 1586 | end, 1587 | get_vehicle_neon_lights_color = function (veh) 1588 | local colour_ptr = memory.alloc(12) 1589 | VEHICLE._GET_VEHICLE_NEON_LIGHTS_COLOUR(veh, colour_ptr, colour_ptr + 4, colour_ptr + 8) 1590 | local colour = RGBAToInt(memory.read_byte(colour_ptr), memory.read_byte(colour_ptr + 4), memory.read_byte(colour_ptr + 8), 255) 1591 | return colour 1592 | end, 1593 | set_vehicle_neon_light_enabled = VEHICLE._SET_VEHICLE_NEON_LIGHT_ENABLED, 1594 | is_vehicle_neon_light_enabled = VEHICLE._IS_VEHICLE_NEON_LIGHT_ENABLED, 1595 | set_vehicle_density_multipliers_this_frame = VEHICLE.SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME, 1596 | set_random_vehicle_density_multiplier_this_frame = VEHICLE.SET_RANDOM_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME, 1597 | set_parked_vehicle_density_multiplier_this_frame = VEHICLE.SET_PARKED_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME, 1598 | set_ambient_vehicle_range_multiplier_this_frame = VEHICLE.SET_AMBIENT_VEHICLE_RANGE_MULTIPLIER_THIS_FRAME, 1599 | is_vehicle_rocket_boost_active = VEHICLE._IS_VEHICLE_ROCKET_BOOST_ACTIVE, 1600 | set_vehicle_rocket_boost_active = VEHICLE._SET_VEHICLE_ROCKET_BOOST_ACTIVE, 1601 | set_vehicle_rocket_boost_percentage = VEHICLE._SET_VEHICLE_ROCKET_BOOST_PERCENTAGE, 1602 | set_vehicle_rocket_boost_refill_time = VEHICLE._SET_VEHICLE_ROCKET_BOOST_REFILL_TIME, 1603 | control_landing_gear = VEHICLE.CONTROL_LANDING_GEAR, 1604 | get_landing_gear_state = VEHICLE.GET_LANDING_GEAR_STATE, 1605 | get_vehicle_livery = VEHICLE.GET_VEHICLE_LIVERY, 1606 | set_vehicle_livery = VEHICLE.SET_VEHICLE_LIVERY, 1607 | is_vehicle_stopped = VEHICLE.IS_VEHICLE_STOPPED, 1608 | get_vehicle_number_of_passengers = VEHICLE.GET_VEHICLE_NUMBER_OF_PASSENGERS, 1609 | get_vehicle_max_number_of_passengers = VEHICLE.GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS, 1610 | get_vehicle_model_number_of_seats = VEHICLE.GET_VEHICLE_MODEL_NUMBER_OF_SEATS, 1611 | get_vehicle_livery_count = VEHICLE.GET_VEHICLE_LIVERY_COUNT, 1612 | get_vehicle_roof_livery_count = VEHICLE._GET_VEHICLE_ROOF_LIVERY_COUNT, 1613 | is_vehicle_model = VEHICLE.IS_VEHICLE_MODEL, 1614 | is_vehicle_stuck_on_roof = VEHICLE.IS_VEHICLE_STUCK_ON_ROOF, 1615 | set_vehicle_doors_locked_for_player = VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_PLAYER, 1616 | get_vehicle_doors_locked_for_player = VEHICLE.GET_VEHICLE_DOORS_LOCKED_FOR_PLAYER, 1617 | set_vehicle_doors_locked_for_all_players = VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS, 1618 | set_vehicle_doors_locked_for_non_script_players = VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_NON_SCRIPT_PLAYERS, 1619 | set_vehicle_doors_locked_for_team = VEHICLE.SET_VEHICLE_DOORS_LOCKED_FOR_TEAM, 1620 | explode_vehicle = VEHICLE.EXPLODE_VEHICLE, 1621 | set_vehicle_out_of_control = VEHICLE.SET_VEHICLE_OUT_OF_CONTROL, 1622 | set_vehicle_timed_explosion = VEHICLE.SET_VEHICLE_TIMED_EXPLOSION, 1623 | add_vehicle_phone_explosive_device = VEHICLE.ADD_VEHICLE_PHONE_EXPLOSIVE_DEVICE, 1624 | has_vehicle_phone_explosive_device = VEHICLE.HAS_VEHICLE_PHONE_EXPLOSIVE_DEVICE, 1625 | detonate_vehicle_phone_explosive_device = VEHICLE.DETONATE_VEHICLE_PHONE_EXPLOSIVE_DEVICE, 1626 | set_taxi_lights = VEHICLE.SET_TAXI_LIGHTS, 1627 | is_taxi_light_on = VEHICLE.IS_TAXI_LIGHT_ON, 1628 | set_vehicle_colors = VEHICLE.SET_VEHICLE_COLOURS, 1629 | set_vehicle_extra_colors = VEHICLE.SET_VEHICLE_EXTRA_COLOURS, 1630 | get_vehicle_primary_color = function (veh) 1631 | local a, b = memory.alloc_int(), memory.alloc_int() 1632 | VEHICLE.GET_VEHICLE_COLOURS(veh, a, b) 1633 | local colour = memory.read_int(a) 1634 | return colour 1635 | end, 1636 | get_vehicle_secondary_color = function (veh) 1637 | local a, b = memory.alloc_int(), memory.alloc_int() 1638 | VEHICLE.GET_VEHICLE_COLOURS(veh, a, b) 1639 | local colour = memory.read_int(b) 1640 | return colour 1641 | end, 1642 | get_vehicle_pearlecent_color = function (veh) 1643 | return entities.vehicle_draw_handler_get_pearlecent_colour(entities.get_draw_handler(veh)) 1644 | end, 1645 | get_vehicle_wheel_color = function (veh) 1646 | return entities.vehicle_draw_handler_get_wheel_colour(entities.get_draw_handler(veh)) 1647 | end, 1648 | set_vehicle_fullbeam = VEHICLE.SET_VEHICLE_FULLBEAM, 1649 | set_vehicle_custom_primary_colour = VEHICLE.SET_VEHICLE_CUSTOM_PRIMARY_COLOUR, 1650 | get_vehicle_custom_primary_colour = VEHICLE.GET_VEHICLE_CUSTOM_PRIMARY_COLOUR, 1651 | clear_vehicle_custom_primary_colour = VEHICLE.CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR, 1652 | is_vehicle_primary_colour_custom = VEHICLE.GET_IS_VEHICLE_PRIMARY_COLOUR_CUSTOM, 1653 | set_vehicle_custom_secondary_colour = VEHICLE.SET_VEHICLE_CUSTOM_SECONDARY_COLOUR, 1654 | get_vehicle_custom_secondary_colour = VEHICLE.GET_VEHICLE_CUSTOM_SECONDARY_COLOUR, 1655 | clear_vehicle_custom_secondary_colour = VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR, 1656 | is_vehicle_secondary_colour_custom = VEHICLE.GET_IS_VEHICLE_SECONDARY_COLOUR_CUSTOM, 1657 | set_vehicle_custom_pearlescent_colour = notif_not_imp, 1658 | get_vehicle_custom_pearlescent_colour = notif_not_imp, 1659 | set_vehicle_custom_wheel_colour = notif_not_imp, 1660 | get_vehicle_custom_wheel_colour = notif_not_imp, 1661 | get_livery_name = VEHICLE.GET_LIVERY_NAME, 1662 | set_vehicle_window_tint = VEHICLE.SET_VEHICLE_WINDOW_TINT, 1663 | get_vehicle_window_tint = VEHICLE.GET_VEHICLE_WINDOW_TINT, 1664 | get_all_vehicle_model_hashes = function () 1665 | local t = {} 1666 | local v = util.get_vehicles() 1667 | for _, entry in pairs(v) do 1668 | table.insert(t, int_to_uint(util.joaat(entry.name))) 1669 | end 1670 | return t 1671 | end, 1672 | get_all_vehicles = entities.get_all_vehicles_as_handles, 1673 | modify_vehicle_top_speed = VEHICLE.MODIFY_VEHICLE_TOP_SPEED, 1674 | set_vehicle_engine_torque_multiplier_this_frame = VEHICLE.SET_VEHICLE_CHEAT_POWER_INCREASE, 1675 | get_vehicle_headlight_color = VEHICLE._GET_VEHICLE_XENON_LIGHTS_COLOR, 1676 | set_vehicle_headlight_color = VEHICLE._SET_VEHICLE_XENON_LIGHTS_COLOR, 1677 | set_heli_blades_full_speed = VEHICLE.SET_HELI_BLADES_FULL_SPEED, 1678 | set_heli_blades_speed = VEHICLE.SET_HELI_BLADES_SPEED, 1679 | set_vehicle_parachute_active = VEHICLE._SET_VEHICLE_PARACHUTE_ACTIVE, 1680 | does_vehicle_have_parachute = VEHICLE._GET_VEHICLE_HAS_PARACHUTE, 1681 | can_vehicle_parachute_be_activated = VEHICLE._GET_VEHICLE_CAN_ACTIVATE_PARACHUTE, 1682 | set_vehicle_can_be_locked_on = VEHICLE._SET_VEHICLE_CAN_BE_LOCKED_ON, 1683 | get_vehicle_current_gear = function (veh) 1684 | return entities.get_current_gear(entities.handle_to_pointer(veh)) 1685 | end, 1686 | set_vehicle_current_gear = function (veh, gear) 1687 | entities.set_current_gear(entities.handle_to_pointer(veh), gear) 1688 | end, 1689 | get_vehicle_next_gear = function (veh) 1690 | return entities.get_next_gear(entities.handle_to_pointer(veh)) 1691 | end, 1692 | set_vehicle_next_gear = function (veh, gear) 1693 | entities.set_next_gear(entities.handle_to_pointer(veh), gear) 1694 | end, 1695 | --get_vehicle_max_gear = !#! NO MATCH FOUND !#!, 1696 | --set_vehicle_max_gear = !#! NO MATCH FOUND !#!, 1697 | --get_vehicle_gear_ratio = !#! NO MATCH FOUND !#!, 1698 | --set_vehicle_gear_ratio = !#! NO MATCH FOUND !#!, 1699 | get_vehicle_rpm = function (veh) 1700 | return entities.get_rpm(entities.handle_to_pointer(veh)) 1701 | end, 1702 | get_vehicle_has_been_owned_by_player = function (veh) 1703 | return entities.get_vehicle_has_been_owned_by_player(entities.handle_to_pointer(veh)) 1704 | end, 1705 | set_vehicle_has_been_owned_by_player = VEHICLE.SET_VEHICLE_HAS_BEEN_OWNED_BY_PLAYER, 1706 | --get_vehicle_steer_bias = !#! NO MATCH FOUND !#!, 1707 | --get_vehicle_reduce_grip = !#! NO MATCH FOUND !#!, 1708 | --get_vehicle_wheel_count = !#! NO MATCH FOUND !#!, 1709 | --get_vehicle_wheel_tire_radius = !#! NO MATCH FOUND !#!, 1710 | --get_vehicle_wheel_rim_radius = !#! NO MATCH FOUND !#!, 1711 | --get_vehicle_wheel_tire_width = !#! NO MATCH FOUND !#!, 1712 | --get_vehicle_wheel_rotation_speed = !#! NO MATCH FOUND !#!, 1713 | --set_vehicle_wheel_tire_radius = !#! NO MATCH FOUND !#!, 1714 | --set_vehicle_wheel_rim_radius = !#! NO MATCH FOUND !#!, 1715 | --set_vehicle_wheel_tire_width = !#! NO MATCH FOUND !#!, 1716 | --set_vehicle_wheel_rotation_speed = !#! NO MATCH FOUND !#!, 1717 | --get_vehicle_wheel_render_size = !#! NO MATCH FOUND !#!, 1718 | --set_vehicle_wheel_render_size = !#! NO MATCH FOUND !#!, 1719 | --get_vehicle_wheel_render_width = !#! NO MATCH FOUND !#!, 1720 | --set_vehicle_wheel_render_width = !#! NO MATCH FOUND !#!, 1721 | set_vehicle_tire_fixed = VEHICLE.SET_VEHICLE_TYRE_FIXED, 1722 | --get_vehicle_wheel_power = !#! NO MATCH FOUND !#!, 1723 | --set_vehicle_wheel_power = !#! NO MATCH FOUND !#!, 1724 | --get_vehicle_wheel_health = !#! NO MATCH FOUND !#!, 1725 | --set_vehicle_wheel_health = !#! NO MATCH FOUND !#!, 1726 | --get_vehicle_wheel_brake_pressure = !#! NO MATCH FOUND !#!, 1727 | --set_vehicle_wheel_brake_pressure = !#! NO MATCH FOUND !#!, 1728 | --get_vehicle_wheel_traction_vector_length = !#! NO MATCH FOUND !#!, 1729 | --set_vehicle_wheel_traction_vector_length = !#! NO MATCH FOUND !#!, 1730 | --get_vehicle_wheel_x_offset = !#! NO MATCH FOUND !#!, 1731 | --set_vehicle_wheel_x_offset = !#! NO MATCH FOUND !#!, 1732 | --get_vehicle_wheel_y_rotation = !#! NO MATCH FOUND !#!, 1733 | --set_vehicle_wheel_y_rotation = !#! NO MATCH FOUND !#!, 1734 | --get_vehicle_wheel_flags = !#! NO MATCH FOUND !#!, 1735 | --set_vehicle_wheel_flags = !#! NO MATCH FOUND !#!, 1736 | --set_vehicle_wheel_is_powered = !#! NO MATCH FOUND !#!, 1737 | get_vehicle_class = VEHICLE.GET_VEHICLE_CLASS, 1738 | get_vehicle_class_name = function (veh) 1739 | local classes = {"Compacts", 1740 | "Sedans", 1741 | "SUVs", 1742 | "Coupes", 1743 | "Muscle", 1744 | "Sports Classics", 1745 | "Sports", 1746 | "Super", 1747 | "Motorcycles", 1748 | "Off-road", 1749 | "Industrial", 1750 | "Utility", 1751 | "Vans", 1752 | "Cycles", 1753 | "Boats", 1754 | "Helicopters", 1755 | "Planes", 1756 | "Service", 1757 | "Emergency", 1758 | "Military", 1759 | "Commercial", 1760 | "Trains"} 1761 | return classes[VEHICLE.GET_VEHICLE_CLASS(veh)] 1762 | end, 1763 | get_vehicle_brand = function(veh) 1764 | return VEHICLE._GET_MAKE_NAME_FROM_VEHICLE_MODEL(ENTITY.GET_ENTITY_MODEL(veh)) 1765 | end, 1766 | get_vehicle_model = function(veh) 1767 | local str = util.reverse_joaat(ENTITY.GET_ENTITY_MODEL(veh)) 1768 | if str == "" then 1769 | return nil 1770 | end 1771 | return str 1772 | end, 1773 | --get_vehicle_brand_label = !#! NO MATCH FOUND !#!, 1774 | --get_vehicle_model_label = !#! NO MATCH FOUND !#!, 1775 | start_vehicle_horn = VEHICLE.START_VEHICLE_HORN, 1776 | set_vehicle_gravity_amount = function (veh, grav) 1777 | entities.set_gravity(entities.handle_to_pointer(veh), grav) 1778 | end, 1779 | get_vehicle_gravity_amount = function (veh) 1780 | return entities.get_gravity(entities.handle_to_pointer(veh)) 1781 | end 1782 | } 1783 | 1784 | cutscene = { 1785 | stop_cutscene_immediately = CUTSCENE.STOP_CUTSCENE_IMMEDIATELY, 1786 | remove_cutscene = CUTSCENE.REMOVE_CUTSCENE, 1787 | is_cutscene_active = CUTSCENE.IS_CUTSCENE_ACTIVE, 1788 | is_cutscene_playing = CUTSCENE.IS_CUTSCENE_PLAYING 1789 | } 1790 | 1791 | controls = { 1792 | disable_control_action = PAD.DISABLE_CONTROL_ACTION, 1793 | is_control_pressed = PAD.IS_CONTROL_PRESSED, 1794 | is_control_just_pressed = PAD.IS_CONTROL_JUST_PRESSED, 1795 | is_disabled_control_pressed = PAD.IS_DISABLED_CONTROL_PRESSED, 1796 | is_disabled_control_just_pressed = PAD.IS_DISABLED_CONTROL_JUST_PRESSED, 1797 | get_control_normal = PAD.GET_CONTROL_NORMAL, 1798 | set_control_normal = PAD._SET_CONTROL_NORMAL 1799 | } 1800 | 1801 | rope = { 1802 | rope_load_textures = PHYSICS.ROPE_LOAD_TEXTURES, 1803 | rope_unload_textures = PHYSICS.ROPE_UNLOAD_TEXTURES, 1804 | rope_are_textures_loaded = PHYSICS.ROPE_ARE_TEXTURES_LOADED, 1805 | add_rope = function (pos, rot, maxLen, ropeType, initLength, minLength, lengthChangeRate, onlyPPU, collisionOn, lockFromFront, timeMultiplier, breakable) 1806 | return PHYSICS.ADD_ROPE(pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, initLength, ropeType, maxLen, minLength, lengthChangeRate, onlyPPU, collisionOn, lockFromFront, timeMultiplier, breakable, 0) 1807 | end, 1808 | does_rope_exist = PHYSICS.DOES_ROPE_EXIST, 1809 | delete_rope = function (rope) 1810 | local rope_ptr = memory.alloc_int() 1811 | memory.write_int(rope_ptr, rope) 1812 | PHYSICS.DELETE_ROPE(rope_ptr) 1813 | end, 1814 | attach_rope_to_entity = function (rope, e, offset, a3) 1815 | PHYSICS.ATTACH_ROPE_TO_ENTITY(rope, e, offset.x, offset.y, offset.z, a3) 1816 | end, 1817 | attach_entities_to_rope = function (rope, ent1, ent2, pos_ent1, pos_ent2, len, a7, a8, boneName1, boneName2) 1818 | PHYSICS.ATTACH_ENTITIES_TO_ROPE(rope, ent1, ent2, pos_ent1.x, pos_ent1.y, pos_ent1.z, pos_ent2.x, pos_ent2.y, pos_ent2.z, len, a7, a8, 0, 0) 1819 | end, 1820 | detach_rope_from_entity = PHYSICS.DETACH_ROPE_FROM_ENTITY, 1821 | start_rope_unwinding_front = PHYSICS.START_ROPE_UNWINDING_FRONT, 1822 | start_rope_winding = PHYSICS.START_ROPE_WINDING, 1823 | stop_rope_unwinding_front = PHYSICS.STOP_ROPE_UNWINDING_FRONT, 1824 | stop_rope_winding = PHYSICS.STOP_ROPE_WINDING, 1825 | rope_force_length = PHYSICS.ROPE_FORCE_LENGTH, 1826 | activate_physics = PHYSICS.ACTIVATE_PHYSICS, 1827 | } 1828 | 1829 | system = { 1830 | yield = util.yield, 1831 | wait = util.yield 1832 | } 1833 | 1834 | local event_types = { 1835 | exit = util.on_stop 1836 | } 1837 | 1838 | event = { 1839 | add_event_listener = function (name, callback) 1840 | local event = event_types[name] 1841 | if event then event(callback) end 1842 | end, 1843 | remove_event_listener = function () 1844 | return false 1845 | end 1846 | } 1847 | 1848 | graphics = { 1849 | get_screen_height = function () 1850 | local _, y = directx.get_client_size() 1851 | return y 1852 | end, 1853 | get_screen_width = directx.get_client_size, 1854 | request_named_ptfx_asset = STREAMING.REQUEST_NAMED_PTFX_ASSET, 1855 | has_named_ptfx_asset_loaded = STREAMING.HAS_NAMED_PTFX_ASSET_LOADED, 1856 | remove_named_ptfx_asset = STREAMING.REMOVE_NAMED_PTFX_ASSET, 1857 | set_next_ptfx_asset = GRAPHICS.USE_PARTICLE_FX_ASSET, 1858 | set_next_ptfx_asset_by_hash = util.use_particle_fx_asset, 1859 | start_ptfx_looped_on_entity = function (name, ent, offset, rot, scale) 1860 | GRAPHICS.START_PARTICLE_FX_LOOPED_ON_ENTITY(name, ent, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, scale) 1861 | end, 1862 | start_ptfx_non_looped_on_entity = function (name, ent, offset, rot, scale) 1863 | GRAPHICS.START_PARTICLE_FX_NON_LOOPED_ON_ENTITY(name, ent, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, scale) 1864 | end, 1865 | start_networked_ptfx_looped_on_entity = function (name, ent, offset, rot, scale) 1866 | GRAPHICS.START_NETWORKED_PARTICLE_FX_LOOPED_ON_ENTITY(name, ent, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, scale) 1867 | end, 1868 | start_networked_ptfx_non_looped_on_entity = function (name, ent, offset, rot, scale) 1869 | GRAPHICS.START_NETWORKED_PARTICLE_FX_NON_LOOPED_ON_ENTITY(name, ent, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, scale) 1870 | end, 1871 | remove_ptfx_from_entity = GRAPHICS.REMOVE_PARTICLE_FX_FROM_ENTITY, 1872 | does_looped_ptfx_exist = GRAPHICS.DOES_PARTICLE_FX_LOOPED_EXIST, 1873 | start_ptfx_looped_at_coord = function (name, pos, rot, scale, xAxis, yAxis, zAxis) 1874 | GRAPHICS.START_PARTICLE_FX_LOOPED_AT_COORD(name, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scale, xAxis, yAxis, zAxis) 1875 | end, 1876 | start_ptfx_non_looped_at_coord = function (name, pos, rot, scale, xAxis, yAxis, zAxis) 1877 | GRAPHICS.START_PARTICLE_FX_NON_LOOPED_AT_COORD(name, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scale, xAxis, yAxis, zAxis) 1878 | end, 1879 | start_networked_ptfx_non_looped_at_coord = function (name, pos, rot, scale, xAxis, yAxis, zAxis) 1880 | GRAPHICS.START_NETWORKED_PARTICLE_FX_NON_LOOPED_AT_COORD(name, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scale, xAxis, yAxis, zAxis) 1881 | end, 1882 | start_networked_ptfx_looped_at_coord = notif_not_imp, 1883 | remove_particle_fx = GRAPHICS.REMOVE_PARTICLE_FX, 1884 | remove_ptfx_in_range = function (pos, range) 1885 | GRAPHICS.REMOVE_PARTICLE_FX_IN_RANGE(pos.x, pos.y, pos.z, range) 1886 | end, 1887 | set_ptfx_looped_offsets = function (ptfx, pos, rot) 1888 | GRAPHICS.SET_PARTICLE_FX_LOOPED_OFFSETS(ptfx, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z) 1889 | end, 1890 | set_ptfx_looped_evolution = GRAPHICS.SET_PARTICLE_FX_LOOPED_EVOLUTION, 1891 | set_ptfx_looped_color = GRAPHICS.SET_PARTICLE_FX_LOOPED_COLOUR, 1892 | set_ptfx_looped_alpha = GRAPHICS.SET_PARTICLE_FX_LOOPED_ALPHA, 1893 | set_ptfx_looped_scale = GRAPHICS.SET_PARTICLE_FX_LOOPED_SCALE, 1894 | set_ptfx_looped_far_clip_dist = GRAPHICS.SET_PARTICLE_FX_LOOPED_FAR_CLIP_DIST, 1895 | enable_clown_blood_vfx = GRAPHICS.ENABLE_CLOWN_BLOOD_VFX, 1896 | enable_alien_blood_vfx = GRAPHICS.ENABLE_ALIEN_BLOOD_VFX, 1897 | animpostfx_play = GRAPHICS.ANIMPOSTFX_PLAY, 1898 | animpostfx_stop = GRAPHICS.ANIMPOSTFX_STOP, 1899 | animpostfx_is_running = GRAPHICS.ANIMPOSTFX_IS_RUNNING, 1900 | animpostfx_stop_all = GRAPHICS.ANIMPOSTFX_STOP_ALL, 1901 | request_scaleform_movie = GRAPHICS.REQUEST_SCALEFORM_MOVIE, 1902 | begin_scaleform_movie_method = GRAPHICS.BEGIN_SCALEFORM_MOVIE_METHOD, 1903 | scaleform_movie_method_add_param_texture_name_string = GRAPHICS.SCALEFORM_MOVIE_METHOD_ADD_PARAM_TEXTURE_NAME_STRING, 1904 | scaleform_movie_method_add_param_int = GRAPHICS.SCALEFORM_MOVIE_METHOD_ADD_PARAM_INT, 1905 | scaleform_movie_method_add_param_float = GRAPHICS.SCALEFORM_MOVIE_METHOD_ADD_PARAM_FLOAT, 1906 | scaleform_movie_method_add_param_bool = GRAPHICS.SCALEFORM_MOVIE_METHOD_ADD_PARAM_BOOL, 1907 | draw_scaleform_movie_fullscreen = GRAPHICS.DRAW_SCALEFORM_MOVIE_FULLSCREEN, 1908 | draw_scaleform_movie = GRAPHICS.DRAW_SCALEFORM_MOVIE, 1909 | end_scaleform_movie_method = GRAPHICS.END_SCALEFORM_MOVIE_METHOD, 1910 | draw_marker = function (type, pos, dir, rot, scale, red, green, blue, alpha, bobUpAndDown, faceCam, a12, rotate, textureDict, textureName, drawOntEnts) 1911 | GRAPHICS.DRAW_MARKER(type, pos.x, pos.y, pos.z, dir.x, dir.y, dir.z, rot.x, rot.y, rot.z, scale.x, scale.y, scale.z, red, green, blue, alpha, bobUpAndDown, faceCam, a12, rotate, textureDict or 0, textureName or 0, drawOntEnts) 1912 | end, 1913 | create_checkpoint = function (type, thisPos, nextPos, radius, red, green, blue, alpha, reserved) 1914 | return GRAPHICS.CREATE_CHECKPOINT(type, thisPos.x, thisPos.y, thisPos.z, nextPos.x, nextPos.y, nextPos.z, radius, red, green, blue, alpha, reserved) 1915 | end, 1916 | set_checkpoint_icon_height = GRAPHICS._SET_CHECKPOINT_ICON_SCALE, 1917 | set_checkpoint_cylinder_height = GRAPHICS.SET_CHECKPOINT_CYLINDER_HEIGHT, 1918 | set_checkpoint_rgba = GRAPHICS.SET_CHECKPOINT_RGBA, 1919 | set_checkpoint_icon_rgba = GRAPHICS.SET_CHECKPOINT_RGBA2, 1920 | delete_checkpoint = GRAPHICS.DELETE_CHECKPOINT, 1921 | has_scaleform_movie_loaded = GRAPHICS.HAS_SCALEFORM_MOVIE_LOADED, 1922 | set_scaleform_movie_as_no_longer_needed = function(h) 1923 | local pH = memory.alloc_int() 1924 | memory.write_int(pH, h) 1925 | GRAPHICS.SET_SCALEFORM_MOVIE_AS_NO_LONGER_NEEDED(pH) 1926 | end, 1927 | project_3d_coord = function (coord) 1928 | local x_ptr, y_ptr = memory.alloc_int(), memory.alloc_int() 1929 | local status = GRAPHICS.GET_SCREEN_COORD_FROM_WORLD_COORD(coord.x, coord.y, coord.z, x_ptr, y_ptr) 1930 | local x, y = memory.read_float(x_ptr), memory.read_float(y_ptr) 1931 | return status, v2(x, y) 1932 | end, 1933 | } 1934 | 1935 | cam = { 1936 | get_gameplay_cam_rot = function() 1937 | return CAM.GET_FINAL_RENDERED_CAM_COORD(2) 1938 | end, 1939 | get_gameplay_cam_pos = CAM.GET_GAMEPLAY_CAM_COORD, 1940 | get_gameplay_cam_relative_pitch = CAM.GET_GAMEPLAY_CAM_RELATIVE_PITCH, 1941 | get_gameplay_cam_relative_yaw = CAM.GET_GAMEPLAY_CAM_RELATIVE_HEADING 1942 | } 1943 | 1944 | gameplay = { 1945 | get_hash_key = util.joaat, 1946 | display_onscreen_keyboard = MISC.DISPLAY_ONSCREEN_KEYBOARD, 1947 | update_onscreen_keyboard = MISC.UPDATE_ONSCREEN_KEYBOARD, 1948 | get_onscreen_keyboard_result = MISC.GET_ONSCREEN_KEYBOARD_RESULT, 1949 | is_onscreen_keyboard_active = function () 1950 | return MISC.UPDATE_ONSCREEN_KEYBOARD() ~= -1 1951 | end, 1952 | set_override_weather = MISC.SET_OVERRIDE_WEATHER, 1953 | clear_override_weather = MISC.CLEAR_OVERRIDE_WEATHER, 1954 | set_blackout = GRAPHICS.SET_ARTIFICIAL_LIGHTS_STATE, 1955 | set_mobile_radio = AUDIO.SET_MOBILE_RADIO_ENABLED_DURING_GAMEPLAY, 1956 | get_game_state = function() 1957 | return entities.player_info_get_game_state(entities.get_player_info(entities.handle_to_pointer(players.user_ped()))) 1958 | end, 1959 | is_game_state = function(state) 1960 | return gameplay.get_game_state() == state 1961 | end, 1962 | clear_area_of_objects = function (vec, radius, flags) 1963 | MISC.CLEAR_AREA_OF_OBJECTS(vec.x, vec.y, vec.z, radius, flags) 1964 | end, 1965 | clear_area_of_vehicles = function (coord, radius, a3, a4, a5, a6, a7) 1966 | MISC.CLEAR_AREA_OF_VEHICLES(coord.x, coord.y, coord.z, radius, a3, a4, a5, a6, a7) 1967 | end, 1968 | clear_area_of_peds = function (vec, radius, flags) 1969 | MISC.CLEAR_AREA_OF_PEDS(vec.x, vec.y, vec.z, radius, flags) 1970 | end, 1971 | clear_area_of_cops = function (vec, radius, flags) 1972 | MISC.CLEAR_AREA_OF_COPS(vec.x, vec.y, vec.z, radius, flags) 1973 | end, 1974 | set_cloud_hat_opacity = MISC._SET_CLOUD_HAT_OPACITY, 1975 | get_cloud_hat_opacity = MISC._GET_CLOUD_HAT_OPACITY, 1976 | preload_cloud_hat = MISC.PRELOAD_CLOUD_HAT, 1977 | clear_cloud_hat = MISC.UNLOAD_CLOUD_HAT, 1978 | load_cloud_hat = MISC.LOAD_CLOUD_HAT, 1979 | unload_cloud_hat = MISC.UNLOAD_CLOUD_HAT, 1980 | get_ground_z = function (vec) 1981 | return util.get_ground_z(vec.x, vec.y) 1982 | end, 1983 | get_frame_count = MISC.GET_FRAME_COUNT, 1984 | get_frame_time = MISC.GET_FRAME_TIME, 1985 | shoot_single_bullet_between_coords = function (start, end_point, damage, weapon, owner, audible, invisible, speed) 1986 | MISC.SHOOT_SINGLE_BULLET_BETWEEN_COORDS(start.x, start.y, start.z, end_point.x, end_point.y, end_point.z, damage, weapon, owner, audible, invisible, speed) 1987 | end, 1988 | find_spawn_point_in_direction = function (pos, fwd, dist) 1989 | local vec_ptr = vec3.new() 1990 | local status MISC.FIND_SPAWN_POINT_IN_DIRECTION(pos.x, pos.y, pos.z, fwd.x, fwd.y, fwd.z, dist, vec_ptr) 1991 | local vec = v3(vec3.getX(vec_ptr), vec3.getY(vec_ptr), vec3.getZ(vec_ptr)) 1992 | return status, vec 1993 | end 1994 | } 1995 | 1996 | streaming = { 1997 | request_model = STREAMING.REQUEST_MODEL, 1998 | has_model_loaded = STREAMING.HAS_MODEL_LOADED, 1999 | set_model_as_no_longer_needed = STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED, 2000 | is_model_in_cdimage = STREAMING.IS_MODEL_IN_CDIMAGE, 2001 | is_model_valid = STREAMING.IS_MODEL_VALID, 2002 | is_model_a_plane = VEHICLE.IS_THIS_MODEL_A_PLANE, 2003 | is_model_a_vehicle = STREAMING.IS_MODEL_A_VEHICLE, 2004 | is_model_a_heli = VEHICLE.IS_THIS_MODEL_A_HELI, 2005 | request_ipl = STREAMING.REQUEST_IPL, 2006 | remove_ipl = STREAMING.REMOVE_IPL, 2007 | request_anim_set = STREAMING.REQUEST_ANIM_SET, 2008 | has_anim_set_loaded = STREAMING.HAS_ANIM_SET_LOADED, 2009 | request_anim_dict = STREAMING.REQUEST_ANIM_DICT, 2010 | has_anim_dict_loaded = STREAMING.HAS_ANIM_DICT_LOADED, 2011 | is_model_a_bike = VEHICLE.IS_THIS_MODEL_A_BIKE, 2012 | is_model_a_car = VEHICLE.IS_THIS_MODEL_A_CAR, 2013 | is_model_a_bicycle = VEHICLE.IS_THIS_MODEL_A_BICYCLE, 2014 | is_model_a_quad = VEHICLE.IS_THIS_MODEL_A_QUADBIKE, 2015 | is_model_a_boat = VEHICLE.IS_THIS_MODEL_A_BOAT, 2016 | is_model_a_train = VEHICLE.IS_THIS_MODEL_A_TRAIN, 2017 | is_model_an_object = util.is_this_model_an_object, 2018 | is_model_a_world_object = function(hash) return false end, 2019 | is_model_a_ped = STREAMING.IS_MODEL_A_PED, 2020 | remove_anim_dict = STREAMING.REMOVE_ANIM_DICT, 2021 | remove_anim_set = STREAMING.REMOVE_ANIM_SET 2022 | } 2023 | 2024 | audio = { 2025 | play_sound = AUDIO.PLAY_SOUND, 2026 | play_sound_frontend = AUDIO.PLAY_SOUND_FRONTEND, 2027 | play_sound_from_entity = AUDIO.PLAY_SOUND_FROM_ENTITY, 2028 | play_sound_from_coord = function (soundId, audioName, pos, audioRef, isNetwork, range, p8) 2029 | AUDIO.PLAY_SOUND_FROM_COORD(soundId, audioName, pos.x, pos.y, pos.z, audioRef, isNetwork, range, p8) 2030 | end, 2031 | stop_sound = AUDIO.STOP_SOUND 2032 | } 2033 | 2034 | ai = { 2035 | task_goto_entity = function (e, target, duration, distance, speed) 2036 | TASK.TASK_GOTO_ENTITY_OFFSET(e, target, -1, 0, 0, 0, duration) 2037 | end, 2038 | task_combat_ped = TASK.TASK_COMBAT_PED, 2039 | task_go_to_coord_by_any_means = function (ped, coords, speed, p4, p5, walkStyle, a7) 2040 | TASK.TASK_GO_TO_COORD_ANY_MEANS(ped, coords.x, coords.y, coords.z, speed, p4, p5, walkStyle, a7) 2041 | end, 2042 | task_wander_standard = TASK.TASK_WANDER_STANDARD, 2043 | task_vehicle_drive_wander = TASK.TASK_VEHICLE_DRIVE_WANDER, 2044 | task_start_scenario_in_place = TASK.TASK_START_SCENARIO_IN_PLACE, 2045 | task_start_scenario_at_position = function (ped, name, coord, heading, duration, sittingScenario, teleport) 2046 | TASK.TASK_START_SCENARIO_AT_POSITION(ped, name, coord.x, coord.y, coord.z, heading, duration, sittingScenario, teleport) 2047 | end, 2048 | task_stand_guard = function (ped, coord, heading, name) 2049 | TASK.TASK_STAND_GUARD(ped, coord.x, coord.y, coord.z, heading, name) 2050 | end, 2051 | play_anim_on_running_scenario = TASK.PLAY_ANIM_ON_RUNNING_SCENARIO, 2052 | does_scenario_group_exist = TASK.DOES_SCENARIO_GROUP_EXIST, 2053 | is_scenario_group_enabled = TASK.IS_SCENARIO_GROUP_ENABLED, 2054 | set_scenario_group_enabled = TASK.SET_SCENARIO_GROUP_ENABLED, 2055 | reset_scenario_groups_enabled = TASK.RESET_SCENARIO_GROUPS_ENABLED, 2056 | set_exclusive_scenario_group = TASK.SET_EXCLUSIVE_SCENARIO_GROUP, 2057 | reset_exclusive_scenario_group = TASK.RESET_EXCLUSIVE_SCENARIO_GROUP, 2058 | is_scenario_type_enabled = TASK.IS_SCENARIO_TYPE_ENABLED, 2059 | set_scenario_type_enabled = TASK.SET_SCENARIO_TYPE_ENABLED, 2060 | reset_scenario_types_enabled = TASK.RESET_SCENARIO_TYPES_ENABLED, 2061 | is_ped_active_in_scenario = TASK.IS_PED_ACTIVE_IN_SCENARIO, 2062 | task_follow_to_offset_of_entity = function (ped, entity, offset, speed, timeout, stopRange, persistFollowing) 2063 | TASK.TASK_FOLLOW_TO_OFFSET_OF_ENTITY(ped, entity, offset.x, offset.y, offset.z, speed, timeout, stopRange, persistFollowing) 2064 | end, 2065 | task_vehicle_drive_to_coord_longrange = function (ped, vehicle, pos, speed, mode, stopRange) 2066 | TASK.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE(ped, vehicle, pos.x ,pos.y, pos.z, speed, mode, stopRange) 2067 | end, 2068 | task_shoot_at_entity = TASK.TASK_SHOOT_AT_ENTITY, 2069 | task_vehicle_escort = TASK.TASK_VEHICLE_ESCORT, 2070 | task_vehicle_follow = TASK.TASK_VEHICLE_FOLLOW, 2071 | task_vehicle_drive_to_coord = function (ped, vehicle, coord, speed, a5, vehicleModel, driveMode, stopRange, a9) 2072 | TASK.TASK_VEHICLE_DRIVE_TO_COORD(ped, vehicle, coord.x, coord.y, coord.z, speed, a5, vehicleModel, driveMode, stopRange, a9) 2073 | end, 2074 | task_vehicle_shoot_at_coord = function (ped, coord, a3) 2075 | TASK.TASK_VEHICLE_SHOOT_AT_COORD(ped, coord.x, coord.y, coord.z, a3) 2076 | end, 2077 | task_vehicle_shoot_at_ped = TASK.TASK_VEHICLE_SHOOT_AT_PED, 2078 | task_vehicle_aim_at_coord = function (ped, coord) 2079 | TASK.TASK_VEHICLE_AIM_AT_COORD(ped, coord.x, coord.y, coord.z) 2080 | end, 2081 | task_vehicle_aim_at_ped = TASK.TASK_VEHICLE_AIM_AT_PED, 2082 | task_stay_in_cover = TASK.TASK_STAY_IN_COVER, 2083 | task_go_to_coord_while_aiming_at_coord = function (ped, gotoCoord, aimCoord, moveSpeed, a5, a6, a7, a8, flags, a10, firingPattern) 2084 | TASK.TASK_GO_TO_COORD_WHILE_AIMING_AT_COORD(ped, gotoCoord.x, gotoCoord.y, gotoCoord.z, aimCoord.x, aimCoord.y, aimCoord.z, moveSpeed, a5, a6, a7, a8, flags, a10, firingPattern) 2085 | end, 2086 | task_go_to_coord_while_aiming_at_entity = function (ped, gotoCoord, ent, moveSpeed, a5, a6, a7, a8, flags, a10, firingPattern) 2087 | TASK.TASK_GO_TO_COORD_WHILE_AIMING_AT_ENTITY(ped, gotoCoord, ent, moveSpeed, a5, a6, a7, a8, flags, a10, firingPattern) 2088 | end, 2089 | task_go_to_entity_while_aiming_at_coord = function (ped, ent, aimCoord, moveSpeed, a5, a6, a7, a8, flags, a10, firingPattern) 2090 | TASK.TASK_GO_TO_ENTITY_WHILE_AIMING_AT_COORD(ped, ent, aimCoord.x, aimCoord.y, aimCoord.z, moveSpeed, a5, a6, a7, a8, flags, firingPattern) 2091 | end, 2092 | task_go_to_entity_while_aiming_at_entity = TASK.TASK_GO_TO_ENTITY_WHILE_AIMING_AT_ENTITY, 2093 | task_open_vehicle_door = TASK.TASK_OPEN_VEHICLE_DOOR, 2094 | task_enter_vehicle = TASK.TASK_ENTER_VEHICLE, 2095 | task_leave_vehicle = TASK.TASK_LEAVE_VEHICLE, 2096 | task_sky_dive = TASK.TASK_SKY_DIVE, 2097 | task_parachute = TASK.TASK_PARACHUTE, 2098 | task_parachute_to_target = function (ped, coord) 2099 | TASK.TASK_PARACHUTE_TO_TARGET(ped, coord.x, coord.y, coord.z) 2100 | end, 2101 | set_parachute_task_target = function (ped, coord) 2102 | TASK.SET_PARACHUTE_TASK_TARGET(ped, coord.x, coord.y, coord.z) 2103 | end, 2104 | set_parachute_task_thrust = TASK.SET_PARACHUTE_TASK_THRUST, 2105 | task_rappel_from_heli = TASK.TASK_RAPPEL_FROM_HELI, 2106 | task_vehicle_chase = TASK.TASK_VEHICLE_CHASE, 2107 | set_task_vehicle_chase_behaviour_flag = TASK.SET_TASK_VEHICLE_CHASE_BEHAVIOR_FLAG, 2108 | set_task_vehicle_chase_ideal_persuit_distance = TASK.SET_TASK_VEHICLE_CHASE_IDEAL_PURSUIT_DISTANCE, 2109 | task_shoot_gun_at_coord = function (ped, coord, duration, firingPattern) 2110 | TASK.TASK_SHOOT_AT_COORD(ped, coord.x, coord.y, coord.z, duration, firingPattern) 2111 | end, 2112 | task_aim_gun_at_coord = function (ped, coord, time, a4, a5) 2113 | TASK.TASK_AIM_GUN_AT_COORD(ped, coord.x, coord.y, coord.z, time , a4, a5) 2114 | end, 2115 | task_turn_ped_to_face_entity = TASK.TASK_TURN_PED_TO_FACE_ENTITY, 2116 | task_aim_gun_at_entity = TASK.TASK_AIM_GUN_AT_ENTITY, 2117 | is_task_active = TASK.GET_IS_TASK_ACTIVE, 2118 | task_play_anim = TASK.TASK_PLAY_ANIM, 2119 | stop_anim_task = TASK.STOP_ANIM_TASK, 2120 | } 2121 | 2122 | decorator = { 2123 | decor_register = DECORATOR.DECOR_REGISTER, 2124 | decor_exists_on = DECORATOR.DECOR_EXIST_ON, 2125 | decor_remove = DECORATOR.DECOR_REMOVE, 2126 | decor_get_int = DECORATOR.DECOR_GET_INT, 2127 | decor_set_int = DECORATOR.DECOR_SET_INT, 2128 | decor_get_float = DECORATOR.DECOR_GET_FLOAT, 2129 | decor_set_float = DECORATOR.DECOR_SET_FLOAT, 2130 | decor_get_bool = DECORATOR.DECOR_GET_BOOL, 2131 | decor_set_bool = DECORATOR.DECOR_SET_BOOL, 2132 | decor_set_time = DECORATOR.DECOR_SET_TIME, 2133 | } 2134 | 2135 | hook = { -- silently ignore all this shit because, guess what, stand comes with protections 2136 | register_script_event_hook = function() end, 2137 | register_net_event_hook = function() end, 2138 | remove_script_event_hook = function() end, 2139 | remove_net_event_hook = function() end, 2140 | } 2141 | 2142 | native = { 2143 | call = function(hash, ...) 2144 | local args = { ... } 2145 | native_invoker.begin_call() 2146 | for _, arg in ipairs(args) do 2147 | pluto_switch type(arg) do 2148 | case "int": 2149 | native_invoker.push_arg_int(arg) 2150 | break 2151 | 2152 | case "number": 2153 | do 2154 | local i, f = math.modf(arg) 2155 | if f == 0 then 2156 | native_invoker.push_arg_int(arg) 2157 | else 2158 | native_invoker.push_arg_float(arg) 2159 | end 2160 | end 2161 | break 2162 | 2163 | case "boolean": 2164 | native_invoker.push_arg_bool(arg) 2165 | break 2166 | 2167 | default: 2168 | error("Unsupported argument for native.call: " .. type(arg) .. " " .. tostring(arg)) 2169 | end 2170 | end 2171 | native_invoker.end_call(string.format("%X", hash)) 2172 | return { 2173 | __tointeger = native_invoker.get_return_value_int, 2174 | __tonumber = native_invoker.get_return_value_float, 2175 | __tostring = native_invoker.get_return_value_string, 2176 | __tov3 = native_invoker.get_return_value_vector3, 2177 | } 2178 | end 2179 | } 2180 | 2181 | web = { 2182 | urlencode = function (str) return str end, 2183 | urldecode = function (str) return str end, 2184 | get = function () return 0, "" end 2185 | } 2186 | 2187 | eTrustedFlags = { 2188 | LUA_TRUST_STATS = 1, 2189 | LUA_TRUST_SCRIPT_VARS = 2, 2190 | LUA_TRUST_NATIVES = 4, 2191 | LUA_TRUST_HTTP = 8, 2192 | LUA_TRUST_MEMORY = 16, 2193 | } 2194 | 2195 | local fucky_meta = { 2196 | __newindex=function () 2197 | end 2198 | } 2199 | 2200 | setmetatable(menu, fucky_meta) 2201 | setmetatable(utils, fucky_meta) 2202 | setmetatable(input, fucky_meta) 2203 | setmetatable(ui, fucky_meta) 2204 | setmetatable(scriptdraw, fucky_meta) 2205 | setmetatable(player, fucky_meta) 2206 | setmetatable(ped, fucky_meta) 2207 | setmetatable(network, fucky_meta) 2208 | setmetatable(entity, fucky_meta) 2209 | setmetatable(object, fucky_meta) 2210 | setmetatable(weapon, fucky_meta) 2211 | setmetatable(vehicle, fucky_meta) 2212 | setmetatable(controls, fucky_meta) 2213 | setmetatable(system, fucky_meta) 2214 | setmetatable(event, fucky_meta) 2215 | setmetatable(graphics, fucky_meta) 2216 | setmetatable(gameplay, fucky_meta) 2217 | setmetatable(streaming, fucky_meta) 2218 | setmetatable(ai, fucky_meta) 2219 | setmetatable(cam, fucky_meta) 2220 | setmetatable(fire, fucky_meta) 2221 | setmetatable(hook, fucky_meta) 2222 | setmetatable(native, fucky_meta) 2223 | setmetatable(web, fucky_meta) 2224 | setmetatable(eTrustedFlags, fucky_meta) 2225 | 2226 | -- checked by 2take1script to make sure the script is loaded via 2take1 2227 | -- they might replace this check in a future version, in which case, feel free to use the files from the "From 2Take1Menu" folder in this repository 2228 | local og_tostring = tostring 2229 | tostring = function(v) 2230 | if type(v) == "table" and #v == 0 then 2231 | return "[]" 2232 | end 2233 | return og_tostring(v) 2234 | end 2235 | 2236 | return config 2237 | --------------------------------------------------------------------------------