├── EXAMPLES.md ├── LICENSE ├── README.md ├── TEMPLATES.md ├── client.lua ├── data ├── bones.lua └── debug.lua ├── fxmanifest.lua ├── html ├── css │ └── style.css ├── index.html └── js │ └── app.js └── init.lua /EXAMPLES.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | The config is in the init.lua 4 | 5 | ### All the exports have to be on the client-side to work! 6 | 7 | ## AddBoxZone / Job Check 8 | This is an example setup for a police job. The resource defines a BoxZone around a clipboard in the `gabz_mrpd` MLO. 9 | It's a simple set-up, we provide a **unique** name, define its center point with the vector3, define a length and a width, and then we define some options; the unique name again, the heading of the box, a bool to display a debug poly, and the height of the zone. 10 | 11 | Then, in the actual options themselves, we define 'police' as our required job. 12 | 13 | This is an example using **exports** 14 | 15 | ```lua 16 | exports['qb-target']:AddBoxZone("MissionRowDutyClipboard", vector3(441.7989, -982.0529, 30.67834), 0.45, 0.35, { 17 | name = "MissionRowDutyClipboard", 18 | heading = 11.0, 19 | debugPoly = false, 20 | minZ = 30.77834, 21 | maxZ = 30.87834, 22 | }, { 23 | options = { 24 | { 25 | type = "client", 26 | event = "qb-policejob:ToggleDuty", 27 | icon = "fas fa-sign-in-alt", 28 | label = "Sign In", 29 | job = "police", 30 | }, 31 | }, 32 | distance = 2.5 33 | }) 34 | ``` 35 | 36 | This is an example using the provided **config** 37 | 38 | ```lua 39 | Config.BoxZones = { 40 | ["boxzone1"] = { 41 | name = "MissionRowDutyClipboard", 42 | coords = vector3(441.7989, -982.0529, 30.67834), 43 | length = 0.45, 44 | width = 0.35, 45 | heading = 11.0, 46 | debugPoly = false, 47 | minZ = 30.77834, 48 | maxZ = 30.87834, 49 | options = { 50 | { 51 | type = "client", 52 | event = "qb-policejob:ToggleDuty", 53 | icon = "fas fa-sign-in-alt", 54 | label = "Sign In", 55 | job = "police", 56 | }, 57 | }, 58 | distance = 2.5 59 | }, 60 | } 61 | ``` 62 | 63 | There is only one way you can define the job though, but you can also provide a `[key] = value` table instead to enable checking for more jobs or gangs: 64 | 65 | ```lua 66 | job = { 67 | ["police"] = 5, 68 | ["ambulance"] = 0, 69 | } 70 | 71 | gang = { 72 | ["ballas"] = 5, 73 | ["thelostmc"] = 0, 74 | } 75 | ``` 76 | 77 | This also applies to citizenid's, but citizenid's don't have grades so we set them to true to allow them: 78 | 79 | ```lua 80 | citizenid = { 81 | ["JFJ94924"] = true, 82 | ["KSD18372"] = true, 83 | } 84 | ``` 85 | 86 | When defining multiple jobs or gangs, you **must** provide a minimum grade, even if you don't need one. This is due to how key/value tables work. Set the minimum grade to the minimum grade of the job if you want everyone to access it. 87 | 88 | ## AddTargetModel / item / canInteract() 89 | 90 | This is an example for ped interaction. It utilizes both the `item` parameter and `canInteract` function. 91 | 92 | This is an example using **exports** 93 | 94 | ```lua 95 | Config.Peds = { 96 | "g_m_importexport_0", 97 | "g_m_m_armboss_01" 98 | } 99 | exports['qb-target']:AddTargetModel(Config.Peds, { 100 | options = { 101 | { 102 | event = "request:CuffPed", 103 | icon = "fas fa-hands", 104 | label = "Cuff / Uncuff", 105 | item = 'handcuffs', 106 | job = "police" 107 | }, 108 | { 109 | event = "Rob:Ped", 110 | icon = "fas fa-sack-dollar", 111 | label = "Rob", 112 | canInteract = function(entity) 113 | if not IsPedAPlayer(entity) then 114 | return IsEntityDead(entity) 115 | end 116 | end, 117 | }, 118 | }, 119 | distance = 2.5, 120 | }) 121 | ``` 122 | 123 | This is an example using the provided **config** 124 | 125 | ```lua 126 | Config.TargetModels = { 127 | ["targetmodel1"] = { 128 | models = { 129 | "g_m_importexport_0", 130 | "g_m_m_armboss_01" 131 | }, 132 | options = { 133 | { 134 | type = "client", 135 | event = "request:CuffPed", 136 | icon = "fas fa-hands", 137 | label = "Cuff / Uncuff", 138 | item = 'handcuffs', 139 | job = "police", 140 | }, 141 | { 142 | type = "client", 143 | event = "Rob:Ped", 144 | icon = "fas fa-sack-dollar", 145 | label = "Rob", 146 | canInteract = function(entity) 147 | if not IsPedAPlayer(entity) then 148 | return IsEntityDead(entity) 149 | end 150 | end, 151 | }, 152 | }, 153 | distance = 2.5, 154 | }, 155 | } 156 | ``` 157 | 158 | ## Add Target Entity 159 | This is an example from a postop resource. Players can rent delivery vehicles in order to make deliveries. When they rent a vehicle, we apply this target to that entity only, which allows them to "get packages" from the vehicle 160 | 161 | This is an example using **exports** 162 | 163 | ```lua 164 | local model = `mule2` 165 | RequestModel(model) 166 | while not HasModelLoaded(model) do 167 | Wait(0) 168 | end 169 | local mule = CreateVehicle(model, GetEntityCoords(PlayerPedId()), GetEntityHeading(PlayerPedId()), true, false) 170 | TaskWarpPedIntoVehicle(PlayerPedId(), mule, -1) 171 | exports['qb-target']:AddTargetEntity(mule, { 172 | options = { 173 | { 174 | type = "client", 175 | event = "postop:getPackage", 176 | icon = "fas fa-box-circle-check", 177 | label = "Get Package", 178 | job = "postop", 179 | }, 180 | }, 181 | distance = 3.0 182 | }) 183 | ``` 184 | 185 | ## Passing Item Data 186 | In this example, we define the model of the coffee machines you see around the map, and allow players to purchase a coffee. You'll have to provide your own logic for the purchase, but this is how you would handle it with qb-target, and how you would pass data through to an event for future use. 187 | 188 | This is an example using **exports** 189 | 190 | The event should **not** go into the config, hence why it's not provided with the config example, it's meant for a client file 191 | 192 | ```lua 193 | exports['qb-target']:AddTargetModel(`prop_vend_coffe_01`, { 194 | options = { 195 | { 196 | type = "client", 197 | event = "coffee:buy", 198 | icon = "fas fa-coffee", 199 | label = "Coffee", 200 | price = 5, 201 | }, 202 | }, 203 | distance = 2.5 204 | }) 205 | 206 | RegisterNetEvent('coffee:buy',function(data) 207 | -- server event to buy the item here 208 | QBCore.Functions.Notify("You purchased a " .. data.label .. " for $" .. data.price .. ". Enjoy!", 'success') 209 | end) 210 | ``` 211 | 212 | This is an example using the provided **config** 213 | 214 | ```lua 215 | Config.TargetModels = { 216 | ['buyCoffee'] = { 217 | models = `prop_vend_coffe_01`, 218 | options = { 219 | { 220 | type = "client", 221 | event = "coffee:buy", 222 | icon = "fas fa-coffee", 223 | label = "Coffee", 224 | price = 5, 225 | }, 226 | }, 227 | distance = 2.5 228 | } 229 | } 230 | ``` 231 | 232 | ### EntityZone / Add a target in an event 233 | This is an example of how you can dynamically create a target options in an event, for example, planting a potato plant. 234 | 235 | This is an example using **exports** 236 | This example is **not** advised to use with the provided config 237 | 238 | ```lua 239 | AddEventHandler('plantpotato',function() 240 | local playerPed = PlayerPedId() 241 | local coords = GetEntityCoords(playerPed) 242 | model = `prop_plant_fern_02a` 243 | RequestModel(model) 244 | while not HasModelLoaded(model) do 245 | Wait(0) 246 | end 247 | local plant = CreateObject(model, coords.x, coords.y, coords.z, true, true) 248 | Wait(50) 249 | PlaceObjectOnGroundProperly(plant) 250 | SetEntityInvincible(plant, true) 251 | 252 | -- Logic to handle growth, create a thread and loop, or do something else. Up to you. 253 | 254 | exports['qb-target']:AddEntityZone("potato-growing-"..plant, plant, { 255 | name = "potato-growing-"..plant, 256 | heading = GetEntityHeading(plant), 257 | debugPoly = false, 258 | }, { 259 | options = { 260 | { 261 | type = "client", 262 | event = "farming:harvestPlant", 263 | icon = "fa-solid fa-scythe", 264 | label = "Harvest potato", 265 | plant = plant, 266 | job = "farmer", 267 | canInteract = function(entity) 268 | return Entity(entity).state.growth >= 100 269 | end, 270 | }, 271 | }, 272 | distance = 2.5 273 | }) 274 | end) 275 | ``` -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # qb-target 2 | 3 | QB-Target with additional features such as outlining where nearby Targets are located this also includes a NP Inspired Eye look for the target instead of using the normal Fas-Fa Eye Icon. 4 | 5 | QBCore Help and Community 6 | https://discord.gg/AS2Y8TWejt 7 | 8 | ## Credits 9 | 10 | * Credit to [BerkieBb](https://github.com/BerkieBb/qb-target) For mainting the original qb-target repo 11 | 12 | * Credit to [loljoshie](https://discord.gg/ljlabs) For the original HTML and JS for the Target. 13 | 14 | * Credit to [xtrsyz](https://github.com/overextended/qtarget/pull/70) for a better way of doing the dots 15 | 16 | ## Dependency 17 | * [PolyZone](https://github.com/mkafrin/PolyZone) 18 | -------------------------------------------------------------------------------- /TEMPLATES.md: -------------------------------------------------------------------------------- 1 | # These are Templates for all the functions in qb-target 2 | 3 | ## AddCircleZone 4 | 5 | ### Function Format 6 | 7 | ```lua 8 | -- This is the function from how you would use it inside qb-target/client.lua 9 | AddCircleZone(name: string, center: vector3, radius: float, options: table, targetoptions: table) 10 | 11 | options = { 12 | name: string (UNIQUE), 13 | debugPoly: boolean, 14 | } 15 | 16 | targetoptions = { 17 | options = { 18 | { 19 | type: string, 20 | event: string, 21 | icon: string, 22 | label: string, 23 | targeticon: string, 24 | item: string, 25 | action: function, 26 | canInteract: function, 27 | job: string or table, 28 | gang: string or table 29 | } 30 | }, 31 | distance: float 32 | } 33 | ``` 34 | 35 | ### Config option, this will go into the Config.CircleZones table 36 | 37 | ```lua 38 | ["index"] = { -- This can be a string or a number 39 | name = "name", -- This is the name of the zone recognized by PolyZone, this has to be unique so it doesn't mess up with other zones 40 | coords = vector3(x, y, z), -- These are the coords for the zone, this has to be a vector3 and the coords have to be a float value, fill in x, y and z with the coords 41 | radius = 1.5, -- The radius of the circlezone calculated from the center of the zone, this has to be a float value 42 | debugPoly = false, -- This is for enabling/disabling the drawing of the box, it accepts only a boolean value (true or false), when true it will draw the polyzone in green 43 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 44 | { -- This is the first table with options, you can make as many options inside the options table as you want 45 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 46 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 47 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 48 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 49 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 50 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 51 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 52 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 53 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 54 | end, 55 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 56 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 57 | return true 58 | end, 59 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 60 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 61 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 62 | } 63 | }, 64 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 65 | }, 66 | ``` 67 | 68 | ### Export option, this will go into any client side resource file aside from qb-target's one 69 | 70 | ```lua 71 | exports['qb-target']:AddCircleZone("name", vector3(x, y, z), 1.5, { -- The name has to be unique, the coords a vector3 as shown and the 1.5 is the radius which has to be a float value 72 | name = "name", -- This is the name of the zone recognized by PolyZone, this has to be unique so it doesn't mess up with other zones 73 | debugPoly = false, -- This is for enabling/disabling the drawing of the box, it accepts only a boolean value (true or false), when true it will draw the polyzone in green 74 | }, { 75 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 76 | { -- This is the first table with options, you can make as many options inside the options table as you want 77 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 78 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 79 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 80 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 81 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 82 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 83 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 84 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 85 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 86 | end, 87 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 88 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 89 | return true 90 | end, 91 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 92 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 93 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 94 | } 95 | }, 96 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 97 | }) 98 | ``` 99 | 100 | ## AddBoxZone 101 | 102 | ### Function Format 103 | 104 | ```lua 105 | -- This is the function from how you would use it inside qb-target/client.lua 106 | AddBoxZone(name: string, center: vector3, length: float, width: float, options: table, targetoptions: table) 107 | 108 | options = { 109 | name: string (UNIQUE), 110 | heading: float, 111 | debugPoly: boolean, 112 | minZ: float, 113 | maxZ: float, 114 | } 115 | 116 | targetoptions = { 117 | options = { 118 | { 119 | type: string, 120 | event: string, 121 | icon: string, 122 | label: string, 123 | targeticon: string, 124 | item: string, 125 | action: function, 126 | canInteract: function, 127 | job: string or table, 128 | gang: string or table 129 | } 130 | }, 131 | distance: float 132 | } 133 | ``` 134 | 135 | ### Config option, this will go into the Config.BoxZones table 136 | 137 | ```lua 138 | ["index"] = { -- This can be a string or a number 139 | name = "name", -- This is the name of the zone recognized by PolyZone, this has to be unique so it doesn't mess up with other zones 140 | coords = vector3(x, y, z), -- These are the coords for the zone, this has to be a vector3 and the coords have to be a float value, fill in x, y and z with the coords 141 | length = 1.5, -- The length of the boxzone calculated from the center of the zone, this has to be a float value 142 | width = 1.6, -- The width of the boxzone calculated from the center of the zone, this has to be a float value 143 | heading = 12.0, -- The heading of the boxzone, this has to be a float value 144 | debugPoly = false, -- This is for enabling/disabling the drawing of the box, it accepts only a boolean value (true or false), when true it will draw the polyzone in green 145 | minZ = 36.7, -- This is the bottom of the boxzone, this can be different from the Z value in the coords, this has to be a float value 146 | maxZ = 38.9, -- This is the top of the boxzone, this can be different from the Z value in the coords, this has to be a float value 147 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 148 | { -- This is the first table with options, you can make as many options inside the options table as you want 149 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 150 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 151 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 152 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 153 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 154 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 155 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 156 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 157 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 158 | end, 159 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 160 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 161 | return true 162 | end, 163 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 164 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 165 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 166 | } 167 | }, 168 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 169 | }, 170 | ``` 171 | 172 | ### Export option, this will go into any client side resource file aside from qb-target's one 173 | 174 | ```lua 175 | exports['qb-target']:AddBoxZone("name", vector3(x, y, z), 1.5, 1.6, { -- The name has to be unique, the coords a vector3 as shown, the 1.5 is the length of the boxzone and the 1.6 is the width of the boxzone, the length and width have to be float values 176 | name = "name", -- This is the name of the zone recognized by PolyZone, this has to be unique so it doesn't mess up with other zones 177 | heading = 12.0, -- The heading of the boxzone, this has to be a float value 178 | debugPoly = false, -- This is for enabling/disabling the drawing of the box, it accepts only a boolean value (true or false), when true it will draw the polyzone in green 179 | minZ = 36.7, -- This is the bottom of the boxzone, this can be different from the Z value in the coords, this has to be a float value 180 | maxZ = 38.9, -- This is the top of the boxzone, this can be different from the Z value in the coords, this has to be a float value 181 | }, { 182 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 183 | { -- This is the first table with options, you can make as many options inside the options table as you want 184 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 185 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 186 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 187 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 188 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 189 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 190 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 191 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 192 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 193 | end, 194 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 195 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 196 | return true 197 | end, 198 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 199 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 200 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 201 | } 202 | }, 203 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 204 | }) 205 | ``` 206 | 207 | ## AddPolyZone 208 | 209 | ### Function Format 210 | 211 | ```lua 212 | -- This is the function from how you would use it inside qb-target/client.lua 213 | AddPolyZone(name: string, points: table, options: table, targetoptions: table) 214 | 215 | points = { 216 | vector2(x, y), vector2(x, y), -- Add a minimum of 3 points for this to work and they have to be in order of drawing 217 | } 218 | 219 | options = { 220 | name: string (UNIQUE), 221 | debugPoly: boolean, 222 | minZ: float, 223 | maxZ: float 224 | } 225 | 226 | targetoptions = { 227 | options = { 228 | { 229 | type: string, 230 | event: string, 231 | icon: string, 232 | label: string, 233 | targeticon: string, 234 | item: string, 235 | action: function, 236 | canInteract: function, 237 | job: string or table, 238 | gang: string or table 239 | } 240 | }, 241 | distance: float 242 | } 243 | ``` 244 | 245 | ### Config option, this will go into the Config.BoxZones table 246 | 247 | ```lua 248 | ["index"] = { -- This can be a string or a number 249 | name = "name", -- This is the name of the zone recognized by PolyZone, this has to be unique so it doesn't mess up with other zones 250 | points = { -- This will draw the polyzones in order on the specific coords, every coord is a point that it will draw on 251 | vector2(x, y), vector2(x, y), vector2(x, y), vector2(x, y), 252 | } 253 | debugPoly = false, -- This is for enabling/disabling the drawing of the box, it accepts only a boolean value (true or false), when true it will draw the polyzone in green 254 | minZ = 36.7, -- This is the bottom of the boxzone, this can be different from the Z value in the coords, this has to be a float value 255 | maxZ = 38.9, -- This is the top of the boxzone, this can be different from the Z value in the coords, this has to be a float value 256 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 257 | { -- This is the first table with options, you can make as many options inside the options table as you want 258 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 259 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 260 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 261 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 262 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 263 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 264 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 265 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 266 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 267 | end, 268 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 269 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 270 | return true 271 | end, 272 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 273 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 274 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 275 | } 276 | }, 277 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 278 | }, 279 | ``` 280 | 281 | ### Export option, this will go into any client side resource file aside from qb-target's one 282 | 283 | ```lua 284 | local points = { 285 | vector2(x, y, z), vector2(x, y, z), vector2(x, y, z) 286 | } 287 | exports['qb-target']:AddPolyZone("name", points, { 288 | name = "name", -- This is the name of the zone recognized by PolyZone, this has to be unique so it doesn't mess up with other zones 289 | debugPoly = false, -- This is for enabling/disabling the drawing of the box, it accepts only a boolean value (true or false), when true it will draw the polyzone in green 290 | minZ = 36.7, -- This is the bottom of the polyzone, this can be different from the Z value in the coords, this has to be a float value 291 | maxZ = 38.9, -- This is the top of the polyzone, this can be different from the Z value in the coords, this has to be a float value 292 | }, { 293 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 294 | { -- This is the first table with options, you can make as many options inside the options table as you want 295 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 296 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 297 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 298 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 299 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 300 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 301 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 302 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 303 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 304 | end, 305 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 306 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 307 | return true 308 | end, 309 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 310 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 311 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 312 | } 313 | }, 314 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 315 | }) 316 | ``` 317 | 318 | ## AddComboZone 319 | 320 | ### Function Format 321 | 322 | ```lua 323 | -- This is the function from how you would use it inside qb-target/client.lua 324 | AddComboZone(zones: table, options: table, targetoptions: table) 325 | 326 | zones = {zone1: zone, zone2: zone} -- Minimum of 2 zones 327 | 328 | options = { 329 | name: string (UNIQUE), 330 | debugPoly: boolean 331 | } 332 | 333 | targetoptions = { 334 | options = { 335 | { 336 | type: string, 337 | event: string, 338 | icon: string, 339 | label: string, 340 | targeticon: string, 341 | item: string, 342 | action: function, 343 | canInteract: function, 344 | job: string or table, 345 | gang: string or table 346 | } 347 | }, 348 | distance: float 349 | } 350 | ``` 351 | 352 | ### Export option, this will go into any client side resource file aside from qb-target's one 353 | 354 | ```lua 355 | local zone1 = BoxZone:Create(vector3(500, 500, 100), 3.0, 5.0, { 356 | name = "test", 357 | debugPoly = false 358 | }) 359 | local zone2 = BoxZone:Create(vector3(400, 400, 100), 3.0, 5.0, { 360 | name = "test2", 361 | debugPoly = false 362 | }) 363 | local zones = {zone1, zone2} 364 | exports['qb-target']:AddComboZone(zones, { 365 | name = "name", -- This is the name of the zone recognized by PolyZone, this has to be unique so it doesn't mess up with other zones 366 | debugPoly = false, -- This is for enabling/disabling the drawing of the box, it accepts only a boolean value (true or false), when true it will draw the polyzone in green 367 | }, { 368 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 369 | { -- This is the first table with options, you can make as many options inside the options table as you want 370 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 371 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 372 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 373 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 374 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 375 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 376 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 377 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 378 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 379 | end, 380 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 381 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 382 | return true 383 | end, 384 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 385 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 386 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 387 | } 388 | }, 389 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 390 | }) 391 | ``` 392 | 393 | ## AddTargetBone 394 | 395 | ### Function Format 396 | 397 | ```lua 398 | -- This is the function from how you would use it inside qb-target/client.lua 399 | AddTargetBone(bones: table or string, parameters: table) 400 | 401 | parameters = { 402 | options = { 403 | { 404 | type: string, 405 | event: string, 406 | icon: string, 407 | label: string, 408 | targeticon: string, 409 | item: string, 410 | action: function, 411 | canInteract: function, 412 | job: string or table, 413 | gang: string or table 414 | } 415 | }, 416 | distance: float 417 | } 418 | ``` 419 | 420 | ### Config option, this will go into the Config.TargetBones table 421 | 422 | ```lua 423 | ["index"] = { -- This can be a string or a number 424 | bones = {'boot', 'bonnet'} -- This is your bones table, this specifies all the bones that have to be added to the targetoptions, this can be a string or a table 425 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 426 | { -- This is the first table with options, you can make as many options inside the options table as you want 427 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 428 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 429 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 430 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 431 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 432 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 433 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 434 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 435 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 436 | end, 437 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 438 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 439 | return true 440 | end, 441 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 442 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 443 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 444 | } 445 | }, 446 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 447 | }, 448 | ``` 449 | 450 | ### Export option, this will go into any client side resource file aside from qb-target's one 451 | 452 | ```lua 453 | local bones = { 454 | 'boot', 455 | 'bonnet' 456 | } 457 | exports['qb-target']:AddTargetBone(bones, { -- The bones can be a string or a table 458 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 459 | { -- This is the first table with options, you can make as many options inside the options table as you want 460 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 461 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 462 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 463 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 464 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 465 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 466 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 467 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 468 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 469 | end, 470 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 471 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 472 | return true 473 | end, 474 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 475 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 476 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 477 | } 478 | }, 479 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 480 | }) 481 | ``` 482 | 483 | ## AddTargetEntity 484 | 485 | ### Function Format 486 | 487 | ```lua 488 | AddTargetEntity(entity: number or table, parameters: table) 489 | 490 | parameters = { 491 | options = { 492 | { 493 | type: string, 494 | event: string, 495 | icon: string, 496 | label: string, 497 | targeticon: string, 498 | item: string, 499 | action: function, 500 | canInteract: function, 501 | job: string or table, 502 | gang: string or table 503 | } 504 | }, 505 | distance: float 506 | } 507 | ``` 508 | 509 | ### Export option, this will go into any client side resource file aside from qb-target's one 510 | 511 | ```lua 512 | CreateThread(function() 513 | local model = `a_m_m_indian_01` 514 | RequestModel(model) 515 | while not HasModelLoaded(model) do 516 | Wait(0) 517 | end 518 | local entity = CreatePed(0, model, GetEntityCoords(PlayerPedId()), GetEntityHeading(PlayerPedId()), true, false) 519 | exports['qb-target']:AddTargetEntity(entity, { -- The specified entity number 520 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 521 | { -- This is the first table with options, you can make as many options inside the options table as you want 522 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 523 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 524 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 525 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 526 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 527 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 528 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 529 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 530 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 531 | end, 532 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 533 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 534 | return true 535 | end, 536 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 537 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 538 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 539 | } 540 | }, 541 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 542 | }) 543 | end) 544 | ``` 545 | 546 | ## AddEntityZone 547 | 548 | ### Function Format 549 | 550 | ```lua 551 | AddEntityZone(name: string, entity: number, options: table, targetoptions: table) 552 | 553 | options = { 554 | name: string (UNIQUE), 555 | debugPoly: boolean, 556 | } 557 | 558 | targetoptions = { 559 | options = { 560 | { 561 | type: string, 562 | event: string, 563 | icon: string, 564 | label: string, 565 | targeticon: string, 566 | item: string, 567 | action: function, 568 | canInteract: function, 569 | job: string or table, 570 | gang: string or table 571 | } 572 | }, 573 | distance: float 574 | } 575 | ``` 576 | 577 | ### Export option, this will go into any client side resource file aside from qb-target's one 578 | 579 | ```lua 580 | CreateThread(function() 581 | local model = `a_m_m_indian_01` 582 | RequestModel(model) 583 | while not HasModelLoaded(model) do 584 | Wait(0) 585 | end 586 | local entity = CreatePed(0, model, GetEntityCoords(PlayerPedId()), GetEntityHeading(PlayerPedId()), true, false) 587 | exports['qb-target']:AddEntityZone("name", entity, { -- The specified entity number 588 | name = "name", -- This is the name of the zone recognized by PolyZone, this has to be unique so it doesn't mess up with other zones 589 | debugPoly = false, -- This is for enabling/disabling the drawing of the box, it accepts only a boolean value (true or false), when true it will draw the polyzone in green 590 | }, { 591 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 592 | { -- This is the first table with options, you can make as many options inside the options table as you want 593 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 594 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 595 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 596 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 597 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 598 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 599 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 600 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 601 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 602 | end, 603 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 604 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 605 | return true 606 | end, 607 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 608 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 609 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 610 | } 611 | }, 612 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 613 | }) 614 | end) 615 | ``` 616 | 617 | ## AddTargetModel 618 | 619 | ### Function Format 620 | 621 | ```lua 622 | AddTargetModel(models: string or table, parameters: table) 623 | 624 | parameters = { 625 | options = { 626 | { 627 | type: string, 628 | event: string, 629 | icon: string, 630 | label: string, 631 | targeticon: string, 632 | item: string, 633 | action: function, 634 | canInteract: function, 635 | job: string or table, 636 | gang: string or table 637 | } 638 | }, 639 | distance: float 640 | } 641 | ``` 642 | 643 | ### Config option, this will go into the Config.TargetModels table 644 | 645 | ```lua 646 | ["index"] = { -- This can be a string or a number 647 | models = { -- This is your models table, here you define all the target models to be interacted with, this can be a string or a table 648 | 'a_m_m_indian_01', 649 | } 650 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 651 | { -- This is the first table with options, you can make as many options inside the options table as you want 652 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 653 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 654 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 655 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 656 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 657 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 658 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 659 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 660 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 661 | end, 662 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 663 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 664 | return true 665 | end, 666 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 667 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 668 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 669 | } 670 | }, 671 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 672 | }, 673 | ``` 674 | 675 | ### Export option, this will go into any client side resource file aside from qb-target's one 676 | 677 | ```lua 678 | local models = { 679 | 'a_m_m_indian_01', 680 | } 681 | exports['qb-target']:AddTargetModel(models, { -- This defines the models, can be a string or a table 682 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 683 | { -- This is the first table with options, you can make as many options inside the options table as you want 684 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 685 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 686 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 687 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 688 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 689 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 690 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 691 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 692 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 693 | end, 694 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 695 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 696 | return true 697 | end, 698 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 699 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 700 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 701 | } 702 | }, 703 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 704 | }) 705 | ``` 706 | 707 | ## RemoveZone 708 | 709 | ### Function Format 710 | 711 | ```lua 712 | RemoveZone(name: string) 713 | ``` 714 | 715 | ### Export option, this will go into any client side resource file aside from qb-target's one 716 | 717 | ```lua 718 | exports['qb-target']:RemoveZone("name") 719 | ``` 720 | 721 | ## RemoveTargetBone 722 | 723 | ## Function Format 724 | 725 | ```lua 726 | RemoveTargetBone(bones: table or string, labels: table or string) 727 | ``` 728 | 729 | ### Export option, this will go into any client side resource file aside from qb-target's one 730 | 731 | ```lua 732 | exports['qb-target']:RemoveTargetBone('bonnet', 'Test') 733 | ``` 734 | 735 | ## RemoveTargetModel 736 | 737 | ## Function Format 738 | 739 | ```lua 740 | RemoveTargetModel(models: table or string, labels: table or string) 741 | ``` 742 | 743 | ### Export option, this will go into any client side resource file aside from qb-target's one 744 | 745 | ```lua 746 | exports['qb-target']:RemoveTargetModel('a_m_m_indian_01', 'Test') 747 | ``` 748 | 749 | ## RemoveTargetEntity 750 | 751 | ### Function Format 752 | 753 | ```lua 754 | RemoveTargetEntity(entity: number or table, labels: table or string) 755 | ``` 756 | 757 | ### Export option, this will go into any client side resource file aside from qb-target's one 758 | 759 | ```lua 760 | exports['qb-target']:RemoveTargetEntity(entity, 'Test') 761 | ``` 762 | 763 | ## AddGlobalPed 764 | 765 | ### Function Format 766 | 767 | ```lua 768 | AddGlobalPed(parameters: table) 769 | 770 | parameters = { 771 | options = { 772 | { 773 | type: string, 774 | event: string, 775 | icon: string, 776 | label: string, 777 | targeticon: string, 778 | item: string, 779 | action: function, 780 | canInteract: function, 781 | job: string or table, 782 | gang: string or table 783 | } 784 | }, 785 | distance: float 786 | } 787 | ``` 788 | 789 | ### Config option, this will go into the Config.GlobalPedOptions table 790 | 791 | ```lua 792 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 793 | { -- This is the first table with options, you can make as many options inside the options table as you want 794 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 795 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 796 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 797 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 798 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 799 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 800 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 801 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 802 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 803 | end, 804 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 805 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 806 | return true 807 | end, 808 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 809 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 810 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 811 | } 812 | }, 813 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 814 | ``` 815 | 816 | ### Export option, this will go into any client side resource file aside from qb-target's one 817 | 818 | ```lua 819 | exports['qb-target']:AddGlobalPed({ 820 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 821 | { -- This is the first table with options, you can make as many options inside the options table as you want 822 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 823 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 824 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 825 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 826 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 827 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 828 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 829 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 830 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 831 | end, 832 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 833 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 834 | return true 835 | end, 836 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 837 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 838 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 839 | } 840 | }, 841 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 842 | }) 843 | ``` 844 | 845 | ## AddGlobalVehicle 846 | 847 | ### Function Format 848 | 849 | ```lua 850 | AddGlobalVehicle(parameters: table) 851 | 852 | parameters = { 853 | options = { 854 | { 855 | type: string, 856 | event: string, 857 | icon: string, 858 | label: string, 859 | targeticon: string, 860 | item: string, 861 | action: function, 862 | canInteract: function, 863 | job: string or table, 864 | gang: string or table 865 | } 866 | }, 867 | distance: float 868 | } 869 | ``` 870 | 871 | ### Config option, this will go into the Config.GlobalVehicleOptions table 872 | 873 | ```lua 874 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 875 | { -- This is the first table with options, you can make as many options inside the options table as you want 876 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 877 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 878 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 879 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 880 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 881 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 882 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 883 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 884 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 885 | end, 886 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 887 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 888 | return true 889 | end, 890 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 891 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 892 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 893 | } 894 | }, 895 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 896 | ``` 897 | 898 | ### Export option, this will go into any client side resource file aside from qb-target's one 899 | 900 | ```lua 901 | exports['qb-target']:AddGlobalVehicle({ 902 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 903 | { -- This is the first table with options, you can make as many options inside the options table as you want 904 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 905 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 906 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 907 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 908 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 909 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 910 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 911 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 912 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 913 | end, 914 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 915 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 916 | return true 917 | end, 918 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 919 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 920 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 921 | } 922 | }, 923 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 924 | }) 925 | ``` 926 | 927 | ## AddGlobalObject 928 | 929 | ### Function Format 930 | 931 | ```lua 932 | AddGlobalObject(parameters: table) 933 | 934 | parameters = { 935 | options = { 936 | { 937 | type: string, 938 | event: string, 939 | icon: string, 940 | label: string, 941 | targeticon: string, 942 | item: string, 943 | action: function, 944 | canInteract: function, 945 | job: string or table, 946 | gang: string or table 947 | } 948 | }, 949 | distance: float 950 | } 951 | ``` 952 | 953 | ### Config option, this will go into the Config.GlobalObjectOptions table 954 | 955 | ```lua 956 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 957 | { -- This is the first table with options, you can make as many options inside the options table as you want 958 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 959 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 960 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 961 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 962 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 963 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 964 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 965 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 966 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 967 | end, 968 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 969 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 970 | return true 971 | end, 972 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 973 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 974 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 975 | } 976 | }, 977 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 978 | ``` 979 | 980 | ### Export option, this will go into any client side resource file aside from qb-target's one 981 | 982 | ```lua 983 | exports['qb-target']:AddGlobalObject({ 984 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 985 | { -- This is the first table with options, you can make as many options inside the options table as you want 986 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 987 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 988 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 989 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 990 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 991 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 992 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 993 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 994 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 995 | end, 996 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 997 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 998 | return true 999 | end, 1000 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 1001 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 1002 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 1003 | } 1004 | }, 1005 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 1006 | }) 1007 | ``` 1008 | 1009 | ## AddGlobalPlayer 1010 | 1011 | ### Function Format 1012 | 1013 | ```lua 1014 | AddGlobalPlayer(parameters: table) 1015 | 1016 | parameters = { 1017 | options = { 1018 | { 1019 | type: string, 1020 | event: string, 1021 | icon: string, 1022 | label: string, 1023 | targeticon: string, 1024 | item: string, 1025 | action: function, 1026 | canInteract: function, 1027 | job: string or table, 1028 | gang: string or table 1029 | } 1030 | }, 1031 | distance: float 1032 | } 1033 | ``` 1034 | 1035 | ### Config option, this will go into the Config.GlobalPlayerOptions table 1036 | 1037 | ```lua 1038 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 1039 | { -- This is the first table with options, you can make as many options inside the options table as you want 1040 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 1041 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 1042 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 1043 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 1044 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 1045 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 1046 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 1047 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 1048 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 1049 | end, 1050 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 1051 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 1052 | return true 1053 | end, 1054 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 1055 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 1056 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 1057 | } 1058 | }, 1059 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 1060 | ``` 1061 | 1062 | ### Export option, this will go into any client side resource file aside from qb-target's one 1063 | 1064 | ```lua 1065 | exports['qb-target']:AddGlobalPlayer({ 1066 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 1067 | { -- This is the first table with options, you can make as many options inside the options table as you want 1068 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 1069 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 1070 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 1071 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 1072 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 1073 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 1074 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 1075 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 1076 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 1077 | end, 1078 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 1079 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 1080 | return true 1081 | end, 1082 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 1083 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 1084 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 1085 | } 1086 | }, 1087 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 1088 | }) 1089 | ``` 1090 | 1091 | ## RemoveGlobalTypeOptions 1092 | 1093 | ### Function Format 1094 | 1095 | ```lua 1096 | RemoveGlobalTypeOptions(type: integer, labels: table or string) 1097 | ``` 1098 | 1099 | ### Export option, this will go into any client side resource file aside from qb-target's one 1100 | 1101 | ```lua 1102 | exports['qb-target']:RemoveType(1, 'Test') -- 1 is for peds 1103 | ``` 1104 | 1105 | ## RemoveGlobalPed 1106 | 1107 | ### Function Format 1108 | 1109 | ```lua 1110 | RemoveGlobalPed(labels: table or string) 1111 | ``` 1112 | 1113 | ### Export option, this will go into any client side resource file aside from qb-target's one 1114 | 1115 | ```lua 1116 | exports['qb-target']:RemoveGlobalPed('Test') 1117 | ``` 1118 | 1119 | ## RemoveGlobalVehicle 1120 | 1121 | ### Function Format 1122 | 1123 | ```lua 1124 | RemoveGlobalVehicle(labels: table or string) 1125 | ``` 1126 | 1127 | ### Export option, this will go into any client side resource file aside from qb-target's one 1128 | 1129 | ```lua 1130 | exports['qb-target']:RemoveGlobalVehicle('Test') 1131 | ``` 1132 | 1133 | ## RemoveGlobalObject 1134 | 1135 | ### Function Format 1136 | 1137 | ```lua 1138 | RemoveGlobalObject(labels: table or string) 1139 | ``` 1140 | 1141 | ### Export option, this will go into any client side resource file aside from qb-target's one 1142 | 1143 | ```lua 1144 | exports['qb-target']:RemoveGlobalObject('Test') 1145 | ``` 1146 | 1147 | ## RemoveGlobalPlayer 1148 | 1149 | ### Function Format 1150 | 1151 | ```lua 1152 | RemoveGlobalPlayer(labels: table or string) 1153 | ``` 1154 | 1155 | ### Export option, this will go into any client side resource file aside from qb-target's one 1156 | 1157 | ```lua 1158 | exports['qb-target']:RemoveGlobalPlayer('Test') 1159 | ``` 1160 | 1161 | ## RaycastCamera 1162 | 1163 | ### Function Format 1164 | 1165 | ```lua 1166 | RaycastCamera(flag: number, playerCoords: vector3) -- Preferably 30 or -1, -1 will not interact with any hashes higher than 32 bit and 30 will not interact with the world 1167 | ``` 1168 | 1169 | ### Export option, this will go into any client side resource file aside from qb-target's one 1170 | 1171 | ```lua 1172 | CreateThread(function() 1173 | while true do 1174 | local curFlag = 30 1175 | local coords, entity, entityType = exports['qb-target']:RaycastCamera(-1, GetEntityCoords(PlayerPedId())) 1176 | if entityType > 0 then 1177 | print('gotten') 1178 | end 1179 | if curFlag = 30 then curFlag = -1 else curFlag = 30 end 1180 | Wait(100) 1181 | end 1182 | end) 1183 | ``` 1184 | 1185 | ## Ped Spawner 1186 | 1187 | ### Function Format 1188 | 1189 | ```lua 1190 | SpawnPed(datatable: table) 1191 | 1192 | -- This is for 1 ped 1193 | datatable = { 1194 | model: string or number, 1195 | coords: vector4, 1196 | minusOne: boolean, 1197 | freeze: boolean, 1198 | invincible: boolean, 1199 | blockevents: boolean, 1200 | animDict: string, 1201 | anim: string, 1202 | flag: number, 1203 | scenario: string, 1204 | target = { 1205 | useModel: boolean, 1206 | options = { 1207 | { 1208 | type: string, 1209 | event: string, 1210 | icon: string, 1211 | label: string, 1212 | targeticon: string, 1213 | item: string, 1214 | action: function, 1215 | canInteract: function, 1216 | job: string or table, 1217 | gang: string or table 1218 | } 1219 | }, 1220 | distance: float 1221 | }, 1222 | currentpednumber: number 1223 | } 1224 | 1225 | -- This is for multiple peds 1226 | datatable = { 1227 | [index: integer] = { 1228 | model: string or number, 1229 | coords: vector4, 1230 | minusOne: boolean, 1231 | freeze: boolean, 1232 | invincible: boolean, 1233 | blockevents: boolean, 1234 | animDict: string, 1235 | anim: string, 1236 | flag: number, 1237 | scenario: string, 1238 | target = { 1239 | useModel: boolean, 1240 | options = { 1241 | { 1242 | type: string, 1243 | event: string, 1244 | icon: string, 1245 | label: string, 1246 | targeticon: string, 1247 | item: string, 1248 | action: function, 1249 | canInteract: function, 1250 | job: string or table, 1251 | gang: string or table 1252 | } 1253 | }, 1254 | distance: float 1255 | }, 1256 | currentpednumber: number 1257 | } 1258 | } 1259 | ``` 1260 | 1261 | ### Config option, this will go into the Config.Peds table 1262 | 1263 | ```lua 1264 | -- Any of the options in the index table besides model and coords are optional, you can leave them out or set them to false 1265 | [1] = { -- This MUST be a number (UNIQUE), if you make it a string it won't be able to delete peds spawned with the export 1266 | model = 'a_m_m_indian_01', -- This is the ped model that is going to be spawning at the given coords 1267 | coords = vector4(x, y, z, w), -- This is the coords that the ped is going to spawn at, always has to be a vector4 and the w value is the heading 1268 | minusOne = true, -- Set this to true if your ped is hovering above the ground but you want it on the ground (OPTIONAL) 1269 | freeze = true, -- Set this to true if you want the ped to be frozen at the given coords (OPTIONAL) 1270 | invincible = true, -- Set this to true if you want the ped to not take any damage from any source (OPTIONAL) 1271 | blockevents = true, -- Set this to true if you don't want the ped to react the to the environment (OPTIONAL) 1272 | animDict = 'abigail_mcs_1_concat-0', -- This is the animation dictionairy to load the animation to play from (OPTIONAL) 1273 | anim = 'csb_abigail_dual-0', -- This is the animation that will play chosen from the animDict, this will loop the whole time the ped is spawned (OPTIONAL) 1274 | flag = 1, -- This is the flag of the animation to play, for all the flags, check the TaskPlayAnim native here https://docs.fivem.net/natives/?_0x5AB552C6 (OPTIONAL) 1275 | scenario = 'WORLD_HUMAN_AA_COFFEE', -- This is the scenario that will play the whole time the ped is spawned, this cannot pair with anim and animDict (OPTIONAL) 1276 | target = { -- This is the target options table, here you can specify all the options to display when targeting the ped (OPTIONAL) 1277 | useModel = false, -- This is the option for which target function to use, when this is set to true it'll use AddTargetModel and add these to al models of the given ped model, if it is false it will only add the options to this specific ped 1278 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 1279 | { -- This is the first table with options, you can make as many options inside the options table as you want 1280 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 1281 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 1282 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 1283 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 1284 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 1285 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 1286 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 1287 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 1288 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 1289 | end, 1290 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 1291 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 1292 | return true 1293 | end, 1294 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 1295 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 1296 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 1297 | } 1298 | }, 1299 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 1300 | }, 1301 | currentpednumber = 0, -- This is the current ped number, this will be assigned when spawned, you can leave this out because it will always be created (OPTIONAL) 1302 | }, 1303 | ``` 1304 | 1305 | ### Export option, this will go into any client side resource file aside from qb-target's one 1306 | 1307 | ```lua 1308 | -- This is for 1 ped only 1309 | exports['qb-target']:SpawnPed({ 1310 | model = 'a_m_m_indian_01', -- This is the ped model that is going to be spawning at the given coords 1311 | coords = vector4(x, y, z, w), -- This is the coords that the ped is going to spawn at, always has to be a vector4 and the w value is the heading 1312 | minusOne = true, -- Set this to true if your ped is hovering above the ground but you want it on the ground (OPTIONAL) 1313 | freeze = true, -- Set this to true if you want the ped to be frozen at the given coords (OPTIONAL) 1314 | invincible = true, -- Set this to true if you want the ped to not take any damage from any source (OPTIONAL) 1315 | blockevents = true, -- Set this to true if you don't want the ped to react the to the environment (OPTIONAL) 1316 | animDict = 'abigail_mcs_1_concat-0', -- This is the animation dictionairy to load the animation to play from (OPTIONAL) 1317 | anim = 'csb_abigail_dual-0', -- This is the animation that will play chosen from the animDict, this will loop the whole time the ped is spawned (OPTIONAL) 1318 | flag = 1, -- This is the flag of the animation to play, for all the flags, check the TaskPlayAnim native here https://docs.fivem.net/natives/?_0x5AB552C6 (OPTIONAL) 1319 | scenario = 'WORLD_HUMAN_AA_COFFEE', -- This is the scenario that will play the whole time the ped is spawned, this cannot pair with anim and animDict (OPTIONAL) 1320 | target = { -- This is the target options table, here you can specify all the options to display when targeting the ped (OPTIONAL) 1321 | useModel = false, -- This is the option for which target function to use, when this is set to true it'll use AddTargetModel and add these to al models of the given ped model, if it is false it will only add the options to this specific ped 1322 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 1323 | { -- This is the first table with options, you can make as many options inside the options table as you want 1324 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 1325 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 1326 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 1327 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 1328 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 1329 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 1330 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 1331 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 1332 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 1333 | end, 1334 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 1335 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 1336 | return true 1337 | end, 1338 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 1339 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 1340 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 1341 | } 1342 | }, 1343 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 1344 | }, 1345 | currentpednumber = 0, -- This is the current ped number, this will be assigned when spawned, you can leave this out because it will always be created (OPTIONAL) 1346 | }) 1347 | 1348 | -- This is for multiple peds, here I used 2 of the same peds 1349 | exports['qb-target']:SpawnPed({ 1350 | [1] = { -- This has to be a number otherwise it can't delete the ped afterwards 1351 | model = 'a_m_m_indian_01', -- This is the ped model that is going to be spawning at the given coords 1352 | coords = vector4(x, y, z, w), -- This is the coords that the ped is going to spawn at, always has to be a vector4 and the w value is the heading 1353 | minusOne = true, -- Set this to true if your ped is hovering above the ground but you want it on the ground (OPTIONAL) 1354 | freeze = true, -- Set this to true if you want the ped to be frozen at the given coords (OPTIONAL) 1355 | invincible = true, -- Set this to true if you want the ped to not take any damage from any source (OPTIONAL) 1356 | blockevents = true, -- Set this to true if you don't want the ped to react the to the environment (OPTIONAL) 1357 | animDict = 'abigail_mcs_1_concat-0', -- This is the animation dictionairy to load the animation to play from (OPTIONAL) 1358 | anim = 'csb_abigail_dual-0', -- This is the animation that will play chosen from the animDict, this will loop the whole time the ped is spawned (OPTIONAL) 1359 | flag = 1, -- This is the flag of the animation to play, for all the flags, check the TaskPlayAnim native here https://docs.fivem.net/natives/?_0x5AB552C6 (OPTIONAL) 1360 | scenario = 'WORLD_HUMAN_AA_COFFEE', -- This is the scenario that will play the whole time the ped is spawned, this cannot pair with anim and animDict (OPTIONAL) 1361 | target = { -- This is the target options table, here you can specify all the options to display when targeting the ped (OPTIONAL) 1362 | useModel = false, -- This is the option for which target function to use, when this is set to true it'll use AddTargetModel and add these to al models of the given ped model, if it is false it will only add the options to this specific ped 1363 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 1364 | { -- This is the first table with options, you can make as many options inside the options table as you want 1365 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 1366 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 1367 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 1368 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 1369 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 1370 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 1371 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 1372 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 1373 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 1374 | end, 1375 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 1376 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 1377 | return true 1378 | end, 1379 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 1380 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 1381 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 1382 | } 1383 | }, 1384 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 1385 | }, 1386 | currentpednumber = 0, -- This is the current ped number, this will be assigned when spawned, you can leave this out because it will always be created (OPTIONAL) 1387 | }, 1388 | [2] = { 1389 | model = 'a_m_m_indian_01', -- This is the ped model that is going to be spawning at the given coords 1390 | coords = vector4(x, y, z, w), -- This is the coords that the ped is going to spawn at, always has to be a vector4 and the w value is the heading 1391 | minusOne = true, -- Set this to true if your ped is hovering above the ground but you want it on the ground (OPTIONAL) 1392 | freeze = true, -- Set this to true if you want the ped to be frozen at the given coords (OPTIONAL) 1393 | invincible = true, -- Set this to true if you want the ped to not take any damage from any source (OPTIONAL) 1394 | blockevents = true, -- Set this to true if you don't want the ped to react the to the environment (OPTIONAL) 1395 | animDict = 'abigail_mcs_1_concat-0', -- This is the animation dictionairy to load the animation to play from (OPTIONAL) 1396 | anim = 'csb_abigail_dual-0', -- This is the animation that will play chosen from the animDict, this will loop the whole time the ped is spawned (OPTIONAL) 1397 | flag = 1, -- This is the flag of the animation to play, for all the flags, check the TaskPlayAnim native here https://docs.fivem.net/natives/?_0x5AB552C6 (OPTIONAL) 1398 | scenario = 'WORLD_HUMAN_AA_COFFEE', -- This is the scenario that will play the whole time the ped is spawned, this cannot pair with anim and animDict (OPTIONAL) 1399 | target = { -- This is the target options table, here you can specify all the options to display when targeting the ped (OPTIONAL) 1400 | useModel = false, -- This is the option for which target function to use, when this is set to true it'll use AddTargetModel and add these to al models of the given ped model, if it is false it will only add the options to this specific ped 1401 | options = { -- This is your options table, in this table all the options will be specified for the target to accept 1402 | { -- This is the first table with options, you can make as many options inside the options table as you want 1403 | type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified 1404 | event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through 1405 | icon = 'fas fa-example', -- This is the icon that will display next to this trigger option 1406 | label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string 1407 | targeticon = 'fas fa-example', -- This is the icon of the target itself, the icon changes to this when it turns blue on this specific option, this is OPTIONAL 1408 | item = 'handcuffs', -- This is the item it has to check for, this option will only show up if the player has this item, this is OPTIONAL 1409 | action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL 1410 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 1411 | TriggerEvent('testing:event', 'test') -- Triggers a client event called testing:event and sends the argument 'test' with it 1412 | end, 1413 | canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL 1414 | if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true 1415 | return true 1416 | end, 1417 | job = 'police', -- This is the job, this option won't show up if the player doesn't have this job, this can also be done with multiple jobs and grades, if you want multiple jobs you always need a grade with it: job = {["police"] = 0, ["ambulance"] = 2}, 1418 | gang = 'ballas', -- This is the gang, this option won't show up if the player doesn't have this gang, this can also be done with multiple gangs and grades, if you want multiple gangs you always need a grade with it: gang = {["ballas"] = 0, ["thelostmc"] = 2}, 1419 | citizenid = 'JFD98238', -- This is the citizenid, this option won't show up if the player doesn't have this citizenid, this can also be done with multiple citizenid's, if you want multiple citizenid's there is a specific format to follow: citizenid = {["JFD98238"] = true, ["HJS29340"] = true}, 1420 | } 1421 | }, 1422 | distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value 1423 | }, 1424 | currentpednumber = 0, -- This is the current ped number, this will be assigned when spawned, you can leave this out because it will always be created (OPTIONAL) 1425 | } 1426 | }) 1427 | ``` 1428 | 1429 | ## RemoveSpawnedPed 1430 | 1431 | ### Function Format 1432 | 1433 | ```lua 1434 | RemoveSpawnedPed(peds: number or table) 1435 | ``` 1436 | 1437 | ### Export option, this will go into any client side resource file aside from qb-target's one 1438 | 1439 | ```lua 1440 | if DoesEntityExist(a_ped) then 1441 | exports['qb-target']:RemoveSpawnedPed({[5] = a_ped}) -- The 5 specified here is to delete the peds currentpednumber from the config, which here is the index of the ped in the config 5 1442 | ``` 1443 | 1444 | ## AllowTargeting 1445 | 1446 | ### Function Format 1447 | 1448 | ```lua 1449 | AllowTargeting(allow: bool) 1450 | ``` 1451 | 1452 | ### Export option, this will go into any client side resource file aside from qb-target's one 1453 | 1454 | ```lua 1455 | if IsEntityDead(PlayerPedId()) then 1456 | exports['qb-target']:AllowTargeting(false) 1457 | end 1458 | ``` -------------------------------------------------------------------------------- /client.lua: -------------------------------------------------------------------------------- 1 | local GetEntityCoords = GetEntityCoords 2 | local Wait = Wait 3 | local IsDisabledControlPressed = IsDisabledControlPressed 4 | local GetEntityBoneIndexByName = GetEntityBoneIndexByName 5 | local GetWorldPositionOfEntityBone = GetWorldPositionOfEntityBone 6 | local SetPauseMenuActive = SetPauseMenuActive 7 | local DisableAllControlActions = DisableAllControlActions 8 | local EnableControlAction = EnableControlAction 9 | local NetworkGetEntityIsNetworked = NetworkGetEntityIsNetworked 10 | local NetworkGetNetworkIdFromEntity = NetworkGetNetworkIdFromEntity 11 | local GetEntityModel = GetEntityModel 12 | local IsPedAPlayer = IsPedAPlayer 13 | local GetEntityType = GetEntityType 14 | local PlayerPedId = PlayerPedId 15 | local GetShapeTestResult = GetShapeTestResult 16 | local StartShapeTestLosProbe = StartShapeTestLosProbe 17 | local currentResourceName = GetCurrentResourceName() 18 | local Config, Types, Players, Entities, Models, Zones, nuiData, sendData, sendDistance = Config, {{}, {}, {}}, {}, {}, {}, {}, {}, {}, {} 19 | local playerPed, targetActive, hasFocus, success, pedsReady, allowTarget = PlayerPedId(), false, false, false, false, true 20 | local screen = {} 21 | local table_wipe = table.wipe 22 | local pairs = pairs 23 | local CheckOptions 24 | local Bones = Load('bones') 25 | 26 | 27 | local listSprite = {} 28 | 29 | --------------------------------------- 30 | --- Source: https://github.com/citizenfx/lua/blob/luaglm-dev/cfx/libs/scripts/examples/scripting_gta.lua 31 | --- Credits to gottfriedleibniz 32 | local glm = require 'glm' 33 | 34 | -- Cache common functions 35 | local glm_rad = glm.rad 36 | local glm_quatEuler = glm.quatEulerAngleZYX 37 | local glm_rayPicking = glm.rayPicking 38 | 39 | -- Cache direction vectors 40 | local glm_up = glm.up() 41 | local glm_forward = glm.forward() 42 | 43 | local function ScreenPositionToCameraRay() 44 | local pos = GetFinalRenderedCamCoord() 45 | local rot = glm_rad(GetFinalRenderedCamRot(2)) 46 | local q = glm_quatEuler(rot.z, rot.y, rot.x) 47 | return pos, glm_rayPicking( 48 | q * glm_forward, 49 | q * glm_up, 50 | glm_rad(screen.fov), 51 | screen.ratio, 52 | 0.10000, -- GetFinalRenderedCamNearClip(), 53 | 10000.0, -- GetFinalRenderedCamFarClip(), 54 | 0, 0 55 | ) 56 | end 57 | --------------------------------------- 58 | 59 | -- Functions 60 | 61 | local function RaycastCamera(flag, playerCoords) 62 | if not playerPed then playerPed = PlayerPedId() end 63 | if not playerCoords then playerCoords = GetEntityCoords(playerPed) end 64 | 65 | local rayPos, rayDir = ScreenPositionToCameraRay() 66 | local destination = rayPos + 10000 * rayDir 67 | local rayHandle = StartShapeTestLosProbe(rayPos.x, rayPos.y, rayPos.z, destination.x, destination.y, destination.z, flag or -1, playerPed, 0) 68 | 69 | while true do 70 | local result, _, endCoords, _, entityHit = GetShapeTestResult(rayHandle) 71 | 72 | if result ~= 1 then 73 | local distance = playerCoords and #(playerCoords - endCoords) 74 | return endCoords, distance, entityHit, entityHit and GetEntityType(entityHit) or 0 75 | end 76 | 77 | Wait(0) 78 | end 79 | end 80 | 81 | exports('RaycastCamera', RaycastCamera) 82 | 83 | local function DisableNUI() 84 | SetNuiFocus(false, false) 85 | SetNuiFocusKeepInput(false) 86 | hasFocus = false 87 | end 88 | 89 | exports('DisableNUI', DisableNUI) 90 | 91 | local function EnableNUI(options) 92 | if not targetActive or hasFocus then return end 93 | SetCursorLocation(0.5, 0.5) 94 | SetNuiFocus(true, true) 95 | SetNuiFocusKeepInput(true) 96 | hasFocus = true 97 | SendNUIMessage({response = "validTarget", data = options}) 98 | end 99 | 100 | exports('EnableNUI', EnableNUI) 101 | 102 | local function LeftTarget() 103 | SetNuiFocus(false, false) 104 | SetNuiFocusKeepInput(false) 105 | success, hasFocus = false, false 106 | table_wipe(sendData) 107 | SendNUIMessage({response = "leftTarget"}) 108 | end 109 | 110 | exports('LeftTarget', LeftTarget) 111 | 112 | local function DisableTarget(forcedisable) 113 | if (not targetActive and hasFocus and not Config.Toggle) or not forcedisable then return end 114 | SetNuiFocus(false, false) 115 | SetNuiFocusKeepInput(false) 116 | Wait(100) 117 | targetActive, success, hasFocus = false, false, false 118 | SendNUIMessage({response = "closeTarget"}) 119 | end 120 | 121 | exports('DisableTarget', DisableTarget) 122 | 123 | local function DrawOutlineEntity(entity, bool) 124 | if not Config.EnableOutline or IsEntityAPed(entity) then return end 125 | SetEntityDrawOutline(entity, bool) 126 | SetEntityDrawOutlineColor(entity, Config.OutlineColor[1], Config.OutlineColor[2], Config.OutlineColor[3]) 127 | end 128 | 129 | exports('DrawOutlineEntity', DrawOutlineEntity) 130 | 131 | local function CheckEntity(flag, datatable, entity, distance) 132 | if not next(datatable) then return end 133 | table_wipe(sendDistance) 134 | table_wipe(nuiData) 135 | local slot = 0 136 | for _, data in pairs(datatable) do 137 | if CheckOptions(data, entity, distance) then 138 | slot += 1 139 | sendData[slot] = data 140 | sendData[slot].entity = entity 141 | nuiData[slot] = { 142 | icon = data.icon, 143 | label = data.label 144 | } 145 | sendDistance[data.distance] = true 146 | else sendDistance[data.distance] = false end 147 | end 148 | if not next(nuiData) then 149 | LeaveTarget() 150 | DrawOutlineEntity(entity, false) 151 | return 152 | end 153 | success = true 154 | SendNUIMessage({response = "foundTarget", data = sendData[slot].targeticon}) 155 | DrawOutlineEntity(entity, true) 156 | while targetActive and success do 157 | local _, dist, entity2, _ = RaycastCamera(flag) 158 | if entity ~= entity2 then 159 | LeftTarget() 160 | DrawOutlineEntity(entity, false) 161 | break 162 | elseif not hasFocus and IsDisabledControlPressed(0, Config.MenuControlKey) then 163 | EnableNUI(nuiData) 164 | DrawOutlineEntity(entity, false) 165 | else 166 | for k, v in pairs(sendDistance) do 167 | if v and dist > k then 168 | LeftTarget() 169 | DrawOutlineEntity(entity, false) 170 | break 171 | end 172 | end 173 | end 174 | Wait(0) 175 | end 176 | LeftTarget() 177 | DrawOutlineEntity(entity, false) 178 | end 179 | 180 | exports('CheckEntity', CheckEntity) 181 | 182 | local function CheckBones(coords, entity, bonelist) 183 | local closestBone = -1 184 | local closestDistance = 20 185 | local closestPos, closestBoneName 186 | for _, v in pairs(bonelist) do 187 | if Bones.Options[v] then 188 | local boneId = GetEntityBoneIndexByName(entity, v) 189 | local bonePos = GetWorldPositionOfEntityBone(entity, boneId) 190 | local distance = #(coords - bonePos) 191 | if closestBone == -1 or distance < closestDistance then 192 | closestBone, closestDistance, closestPos, closestBoneName = boneId, distance, bonePos, v 193 | end 194 | end 195 | end 196 | if closestBone ~= -1 then return closestBone, closestPos, closestBoneName 197 | else return false end 198 | end 199 | 200 | exports('CheckBones', CheckBones) 201 | 202 | local function EnableTarget() 203 | if not allowTarget or success or (not Config.Standalone and not LocalPlayer.state['isLoggedIn']) or IsNuiFocused() or (Config.DisableInVehicle and IsPedInAnyVehicle(playerPed or PlayerPedId(), false)) then return end 204 | if not CheckOptions then CheckOptions = _ENV.CheckOptions end 205 | if targetActive or not CheckOptions then return end 206 | 207 | targetActive = true 208 | playerPed = PlayerPedId() 209 | screen.ratio = GetAspectRatio(true) 210 | screen.fov = GetFinalRenderedCamFov() 211 | 212 | SendNUIMessage({response = "openTarget"}) 213 | CreateThread(function() 214 | repeat 215 | SetPauseMenuActive(false) 216 | DisableAllControlActions(0) 217 | EnableControlAction(0, 30, true) 218 | EnableControlAction(0, 31, true) 219 | 220 | if not hasFocus then 221 | EnableControlAction(0, 1, true) 222 | EnableControlAction(0, 2, true) 223 | end 224 | 225 | Wait(0) 226 | until not targetActive 227 | end) 228 | 229 | local flag 230 | 231 | while targetActive do 232 | local sleep = 0 233 | if flag == 30 then flag = -1 else flag = 30 end 234 | 235 | local coords, distance, entity, entityType = RaycastCamera(flag) 236 | if distance <= Config.MaxDistance then 237 | if entityType > 0 then 238 | 239 | -- Local(non-net) entity targets 240 | if Entities[entity] then 241 | CheckEntity(flag, Entities[entity], entity, distance) 242 | end 243 | 244 | -- Owned entity targets 245 | if NetworkGetEntityIsNetworked(entity) then 246 | local data = Entities[NetworkGetNetworkIdFromEntity(entity)] 247 | if data then CheckEntity(flag, data, entity, distance) end 248 | end 249 | 250 | -- Player and Ped targets 251 | if entityType == 1 then 252 | local data = Models[GetEntityModel(entity)] 253 | if IsPedAPlayer(entity) then data = Players end 254 | if data and next(data) then CheckEntity(flag, data, entity, distance) end 255 | 256 | -- Vehicle bones 257 | elseif entityType == 2 then 258 | local closestBone, _, closestBoneName = CheckBones(coords, entity, Bones.Vehicle) 259 | local datatable = Bones.Options[closestBoneName] 260 | if datatable and next(datatable) and closestBone then 261 | table_wipe(sendDistance) 262 | table_wipe(nuiData) 263 | local slot = 0 264 | for _, data in pairs(datatable) do 265 | if CheckOptions(data, entity, distance) then 266 | slot += 1 267 | sendData[slot] = data 268 | sendData[slot].entity = entity 269 | nuiData[slot] = { 270 | icon = data.icon, 271 | label = data.label 272 | } 273 | sendDistance[data.distance] = true 274 | else sendDistance[data.distance] = false end 275 | end 276 | if next(nuiData) then 277 | success = true 278 | SendNUIMessage({response = "foundTarget", data = sendData[slot].targeticon}) 279 | DrawOutlineEntity(entity, true) 280 | while targetActive and success do 281 | local _, dist, entity2 = RaycastCamera(flag) 282 | if entity == entity2 then 283 | local closestBone2 = CheckBones(coords, entity, Bones.Vehicle) 284 | if closestBone ~= closestBone2 then 285 | LeftTarget() 286 | DrawOutlineEntity(entity, false) 287 | break 288 | elseif not hasFocus and IsDisabledControlPressed(0, Config.MenuControlKey) then 289 | EnableNUI(nuiData) 290 | DrawOutlineEntity(entity, false) 291 | else 292 | for k, v in pairs(sendDistance) do 293 | if v and dist > k then 294 | LeftTarget() 295 | DrawOutlineEntity(entity, false) 296 | break 297 | end 298 | end 299 | end 300 | else 301 | LeftTarget() 302 | DrawOutlineEntity(entity, false) 303 | break 304 | end 305 | Wait(0) 306 | end 307 | LeftTarget() 308 | DrawOutlineEntity(entity, false) 309 | end 310 | else 311 | -- Vehicle Model targets 312 | local data = Models[GetEntityModel(entity)] 313 | if data then CheckEntity(flag, data, entity, distance) end 314 | end 315 | 316 | -- Entity targets 317 | elseif entityType > 2 then 318 | local data = Models[GetEntityModel(entity)] 319 | if data then CheckEntity(flag, data, entity, distance) end 320 | end 321 | 322 | -- Generic targets 323 | if not success then 324 | local data = Types[entityType] 325 | if data and next(data) then CheckEntity(flag, data, entity, distance) end 326 | end 327 | else sleep += 20 end 328 | if not success then 329 | local closestDis, closestZone, pedcoords 330 | if Config.DrawSprite then pedcoords = GetEntityCoords(playerPed) end 331 | for k, zone in pairs(Zones) do 332 | if Config.DrawSprite then 333 | if #(pedcoords - zone.center) < (zone.targetoptions.drawDistance or Config.DrawDistance) and not listSprite[k] then 334 | listSprite[k] = true 335 | CreateThread(function() 336 | while not HasStreamedTextureDictLoaded("shared") do Wait(10) RequestStreamedTextureDict("shared", true) end 337 | while targetActive do 338 | Wait(0) 339 | SetDrawOrigin(zone.center.x, zone.center.y, zone.center.z, 0) 340 | DrawSprite("shared", "emptydot_32", 0, 0, 0.02, 0.035, 0, 255,255,255, 255.0) 341 | ClearDrawOrigin() 342 | end 343 | listSprite[k] = false 344 | end) 345 | end 346 | end 347 | if distance < (closestDis or Config.MaxDistance) and distance <= zone.targetoptions.distance and zone:isPointInside(coords) then 348 | closestDis = distance 349 | closestZone = zone 350 | end 351 | end 352 | if closestZone then 353 | table_wipe(nuiData) 354 | local slot = 0 355 | for _, data in pairs(closestZone.targetoptions.options) do 356 | if CheckOptions(data, entity, distance) then 357 | slot += 1 358 | sendData[slot] = data 359 | sendData[slot].entity = entity 360 | nuiData[slot] = { 361 | icon = data.icon, 362 | label = data.label 363 | } 364 | end 365 | end 366 | if next(nuiData) then 367 | success = true 368 | SendNUIMessage({response = "foundTarget", data = sendData[slot].targeticon}) 369 | DrawOutlineEntity(entity, true) 370 | while targetActive and success do 371 | local coords, distance = RaycastCamera(flag) 372 | if not closestZone:isPointInside(coords) or distance > closestZone.targetoptions.distance then 373 | LeftTarget() 374 | DrawOutlineEntity(entity, false) 375 | break 376 | elseif not hasFocus and IsDisabledControlPressed(0, Config.MenuControlKey) then 377 | EnableNUI(nuiData) 378 | DrawOutlineEntity(entity, false) 379 | end 380 | Wait(0) 381 | end 382 | LeftTarget() 383 | DrawOutlineEntity(entity, false) 384 | end 385 | else sleep += 20 end 386 | else LeftTarget() DrawOutlineEntity(entity, false) end 387 | else sleep += 20 end 388 | Wait(sleep) 389 | end 390 | DisableTarget(false) 391 | end 392 | 393 | local function AddCircleZone(name, center, radius, options, targetoptions) 394 | center = type(center) == 'table' and vec3(center.x, center.y, center.z) or center 395 | Zones[name] = CircleZone:Create(center, radius, options) 396 | targetoptions.distance = targetoptions.distance or Config.MaxDistance 397 | Zones[name].targetoptions = targetoptions 398 | return Zones[name] 399 | end 400 | 401 | exports("AddCircleZone", AddCircleZone) 402 | 403 | local function AddBoxZone(name, center, length, width, options, targetoptions) 404 | center = type(center) == 'table' and vec3(center.x, center.y, center.z) or center 405 | Zones[name] = BoxZone:Create(center, length, width, options) 406 | targetoptions.distance = targetoptions.distance or Config.MaxDistance 407 | Zones[name].targetoptions = targetoptions 408 | return Zones[name] 409 | end 410 | 411 | exports("AddBoxZone", AddBoxZone) 412 | 413 | local function AddPolyZone(name, points, options, targetoptions) 414 | local _points = {} 415 | if type(points[1]) == 'table' then 416 | for i = 1, #points do 417 | _points[i] = vec2(points[i].x, points[i].y) 418 | end 419 | end 420 | Zones[name] = PolyZone:Create(#_points > 0 and _points or points, options) 421 | targetoptions.distance = targetoptions.distance or Config.MaxDistance 422 | Zones[name].targetoptions = targetoptions 423 | return Zones[name] 424 | end 425 | 426 | exports("AddPolyZone", AddPolyZone) 427 | 428 | local function AddComboZone(zones, options, targetoptions) 429 | Zones[options.name] = ComboZone:Create(zones, options) 430 | targetoptions.distance = targetoptions.distance or Config.MaxDistance 431 | Zones[options.name].targetoptions = targetoptions 432 | return Zones[options.name] 433 | end 434 | 435 | exports("AddComboZone", AddComboZone) 436 | 437 | local function AddEntityZone(name, entity, options, targetoptions) 438 | Zones[name] = EntityZone:Create(entity, options) 439 | targetoptions.distance = targetoptions.distance or Config.MaxDistance 440 | Zones[name].targetoptions = targetoptions 441 | return Zones[name] 442 | end 443 | 444 | exports("AddEntityZone", AddEntityZone) 445 | 446 | local function RemoveZone(name) 447 | if not Zones[name] then return end 448 | if Zones[name].destroy then Zones[name]:destroy() end 449 | Zones[name] = nil 450 | end 451 | 452 | exports("RemoveZone", RemoveZone) 453 | 454 | local function SetOptions(tbl, distance, options) 455 | for _, v in pairs(options) do 456 | if v.required_item then 457 | v.item = v.required_item 458 | v.required_item = nil 459 | end 460 | if not v.distance or v.distance > distance then v.distance = distance end 461 | tbl[v.label] = v 462 | end 463 | end 464 | 465 | exports("SetOptions", SetOptions) 466 | 467 | local function AddTargetBone(bones, parameters) 468 | local distance, options = parameters.distance or Config.MaxDistance, parameters.options 469 | if type(bones) == 'table' then 470 | for _, bone in pairs(bones) do 471 | if not Bones.Options[bone] then Bones.Options[bone] = {} end 472 | SetOptions(Bones.Options[bone], distance, options) 473 | end 474 | elseif type(bones) == 'string' then 475 | if not Bones.Options[bones] then Bones.Options[bones] = {} end 476 | SetOptions(Bones.Options[bones], distance, options) 477 | end 478 | end 479 | 480 | exports("AddTargetBone", AddTargetBone) 481 | 482 | local function RemoveTargetBone(bones, labels) 483 | if type(bones) == 'table' then 484 | for _, bone in pairs(bones) do 485 | if type(labels) == 'table' then 486 | for _, v in pairs(labels) do 487 | if Bones.Options[bone] then 488 | Bones.Options[bone][v] = nil 489 | end 490 | end 491 | elseif type(labels) == 'string' then 492 | if Bones.Options[bone] then 493 | Bones.Options[bone][labels] = nil 494 | end 495 | end 496 | end 497 | else 498 | if type(labels) == 'table' then 499 | for _, v in pairs(labels) do 500 | if Bones.Options[bones] then 501 | Bones.Options[bones][v] = nil 502 | end 503 | end 504 | elseif type(labels) == 'string' then 505 | if Bones.Options[bones] then 506 | Bones.Options[bones][labels] = nil 507 | end 508 | end 509 | end 510 | end 511 | 512 | exports("RemoveTargetBone", RemoveTargetBone) 513 | 514 | local function AddTargetEntity(entities, parameters) 515 | local distance, options = parameters.distance or Config.MaxDistance, parameters.options 516 | if type(entities) == 'table' then 517 | for _, entity in pairs(entities) do 518 | if NetworkGetEntityIsNetworked(entity) then entity = NetworkGetNetworkIdFromEntity(entity) end -- Allow non-networked entities to be targeted 519 | if not Entities[entity] then Entities[entity] = {} end 520 | SetOptions(Entities[entity], distance, options) 521 | end 522 | elseif type(entities) == 'number' then 523 | if NetworkGetEntityIsNetworked(entities) then entities = NetworkGetNetworkIdFromEntity(entities) end -- Allow non-networked entities to be targeted 524 | if not Entities[entities] then Entities[entities] = {} end 525 | SetOptions(Entities[entities], distance, options) 526 | end 527 | end 528 | 529 | exports("AddTargetEntity", AddTargetEntity) 530 | 531 | local function RemoveTargetEntity(entities, labels) 532 | if type(entities) == 'table' then 533 | for _, entity in pairs(entities) do 534 | if NetworkGetEntityIsNetworked(entity) then entity = NetworkGetNetworkIdFromEntity(entity) end -- Allow non-networked entities to be targeted 535 | if type(labels) == 'table' then 536 | for k, v in pairs(labels) do 537 | if Entities[entity] then 538 | Entities[entity][v] = nil 539 | end 540 | end 541 | elseif type(labels) == 'string' then 542 | if Entities[entity] then 543 | Entities[entity][labels] = nil 544 | end 545 | end 546 | end 547 | elseif type(entities) == 'number' then 548 | if NetworkGetEntityIsNetworked(entities) then entities = NetworkGetNetworkIdFromEntity(entities) end -- Allow non-networked entities to be targeted 549 | if type(labels) == 'table' then 550 | for _, v in pairs(labels) do 551 | if Entities[entities] then 552 | Entities[entities][v] = nil 553 | end 554 | end 555 | elseif type(labels) == 'string' then 556 | if Entities[entities] then 557 | Entities[entities][labels] = nil 558 | end 559 | end 560 | end 561 | end 562 | 563 | exports("RemoveTargetEntity", RemoveTargetEntity) 564 | 565 | local function AddTargetModel(models, parameters) 566 | local distance, options = parameters.distance or Config.MaxDistance, parameters.options 567 | if type(models) == 'table' then 568 | for _, model in pairs(models) do 569 | if type(model) == 'string' then model = joaat(model) end 570 | if not Models[model] then Models[model] = {} end 571 | SetOptions(Models[model], distance, options) 572 | end 573 | else 574 | if type(models) == 'string' then models = joaat(models) end 575 | if not Models[models] then Models[models] = {} end 576 | SetOptions(Models[models], distance, options) 577 | end 578 | end 579 | 580 | exports("AddTargetModel", AddTargetModel) 581 | 582 | local function RemoveTargetModel(models, labels) 583 | if type(models) == 'table' then 584 | for _, model in pairs(models) do 585 | if type(model) == 'string' then model = joaat(model) end 586 | if type(labels) == 'table' then 587 | for k, v in pairs(labels) do 588 | if Models[model] then 589 | Models[model][v] = nil 590 | end 591 | end 592 | elseif type(labels) == 'string' then 593 | if Models[model] then 594 | Models[model][labels] = nil 595 | end 596 | end 597 | end 598 | else 599 | if type(models) == 'string' then models = joaat(models) end 600 | if type(labels) == 'table' then 601 | for k, v in pairs(labels) do 602 | if Models[models] then 603 | Models[models][v] = nil 604 | end 605 | end 606 | elseif type(labels) == 'string' then 607 | if Models[models] then 608 | Models[models][labels] = nil 609 | end 610 | end 611 | end 612 | end 613 | 614 | exports("RemoveTargetModel", RemoveTargetModel) 615 | 616 | local function AddGlobalType(type, parameters) 617 | local distance, options = parameters.distance or Config.MaxDistance, parameters.options 618 | SetOptions(Types[type], distance, options) 619 | end 620 | 621 | exports("AddGlobalType", AddGlobalType) 622 | 623 | local function AddGlobalPed(parameters) AddGlobalType(1, parameters) end 624 | 625 | exports("AddGlobalPed", AddGlobalPed) 626 | 627 | local function AddGlobalVehicle(parameters) AddGlobalType(2, parameters) end 628 | 629 | exports("AddGlobalVehicle", AddGlobalVehicle) 630 | 631 | local function AddGlobalObject(parameters) AddGlobalType(3, parameters) end 632 | 633 | exports("AddGlobalObject", AddGlobalObject) 634 | 635 | local function AddGlobalPlayer(parameters) 636 | local distance, options = parameters.distance or Config.MaxDistance, parameters.options 637 | SetOptions(Players, distance, options) 638 | end 639 | 640 | exports("AddGlobalPlayer", AddGlobalPlayer) 641 | 642 | local function RemoveGlobalType(typ, labels) 643 | if type(labels) == 'table' then 644 | for _, v in pairs(labels) do 645 | Types[typ][v] = nil 646 | end 647 | elseif type(labels) == 'string' then 648 | Types[typ][labels] = nil 649 | end 650 | end 651 | 652 | exports("RemoveGlobalType", RemoveGlobalType) 653 | 654 | local function RemoveGlobalPlayer(labels) 655 | if type(labels) == 'table' then 656 | for _, v in pairs(labels) do 657 | Players[v] = nil 658 | end 659 | elseif type(labels) == 'string' then 660 | Players[labels] = nil 661 | end 662 | end 663 | 664 | exports("RemoveGlobalPlayer", RemoveGlobalPlayer) 665 | 666 | function SpawnPeds() 667 | if pedsReady or not next(Config.Peds) then return end 668 | for k, v in pairs(Config.Peds) do 669 | if not v.currentpednumber or v.currentpednumber == 0 then 670 | local spawnedped = 0 671 | RequestModel(v.model) 672 | while not HasModelLoaded(v.model) do 673 | Wait(0) 674 | end 675 | 676 | if type(v.model) == 'string' then v.model = joaat(v.model) end 677 | 678 | if v.minusOne then 679 | spawnedped = CreatePed(0, v.model, v.coords.x, v.coords.y, v.coords.z - 1.0, v.coords.w, v.networked or false, false) 680 | else 681 | spawnedped = CreatePed(0, v.model, v.coords.x, v.coords.y, v.coords.z, v.coords.w, v.networked or false, false) 682 | end 683 | 684 | if v.freeze then 685 | FreezeEntityPosition(spawnedped, true) 686 | end 687 | 688 | if v.invincible then 689 | SetEntityInvincible(spawnedped, true) 690 | end 691 | 692 | if v.blockevents then 693 | SetBlockingOfNonTemporaryEvents(spawnedped, true) 694 | end 695 | 696 | if v.animDict and v.anim then 697 | RequestAnimDict(v.animDict) 698 | while not HasAnimDictLoaded(v.animDict) do 699 | Wait(0) 700 | end 701 | 702 | TaskPlayAnim(spawnedped, v.animDict, v.anim, 8.0, 0, -1, v.flag or 1, 0, 0, 0, 0) 703 | end 704 | 705 | if v.scenario then 706 | SetPedCanPlayAmbientAnims(spawnedped, true) 707 | TaskStartScenarioInPlace(spawnedped, v.scenario, 0, true) 708 | end 709 | 710 | if v.target then 711 | if v.target.useModel then 712 | AddTargetModel(v.model, { 713 | options = v.target.options, 714 | distance = v.target.distance 715 | }) 716 | else 717 | AddTargetEntity(spawnedped, { 718 | options = v.target.options, 719 | distance = v.target.distance 720 | }) 721 | end 722 | end 723 | 724 | Config.Peds[k].currentpednumber = spawnedped 725 | end 726 | end 727 | pedsReady = true 728 | end 729 | 730 | function DeletePeds() 731 | if not pedsReady or not next(Config.Peds) then return end 732 | for k, v in pairs(Config.Peds) do 733 | DeletePed(v.currentpednumber) 734 | Config.Peds[k].currentpednumber = 0 735 | end 736 | pedsReady = false 737 | end 738 | 739 | exports("DeletePeds", DeletePeds) 740 | 741 | local function SpawnPed(data) 742 | local spawnedped = 0 743 | local key, value = next(data) 744 | if type(value) == 'table' and key ~= 'target' and key ~= 'coords' then 745 | for _, v in pairs(data) do 746 | if v.spawnNow then 747 | RequestModel(v.model) 748 | while not HasModelLoaded(v.model) do 749 | Wait(0) 750 | end 751 | 752 | if type(v.model) == 'string' then v.model = joaat(v.model) end 753 | 754 | if v.minusOne then 755 | spawnedped = CreatePed(0, v.model, v.coords.x, v.coords.y, v.coords.z - 1.0, v.coords.w or 0.0, v.networked or false, true) 756 | else 757 | spawnedped = CreatePed(0, v.model, v.coords.x, v.coords.y, v.coords.z, v.coords.w or 0.0, v.networked or false, true) 758 | end 759 | 760 | if v.freeze then 761 | FreezeEntityPosition(spawnedped, true) 762 | end 763 | 764 | if v.invincible then 765 | SetEntityInvincible(spawnedped, true) 766 | end 767 | 768 | if v.blockevents then 769 | SetBlockingOfNonTemporaryEvents(spawnedped, true) 770 | end 771 | 772 | if v.animDict and v.anim then 773 | RequestAnimDict(v.animDict) 774 | while not HasAnimDictLoaded(v.animDict) do 775 | Wait(0) 776 | end 777 | 778 | TaskPlayAnim(spawnedped, v.animDict, v.anim, 8.0, 0, -1, v.flag or 1, 0, 0, 0, 0) 779 | end 780 | 781 | if v.scenario then 782 | SetPedCanPlayAmbientAnims(spawnedped, true) 783 | TaskStartScenarioInPlace(spawnedped, v.scenario, 0, true) 784 | end 785 | 786 | if v.target then 787 | if v.target.useModel then 788 | AddTargetModel(v.model, { 789 | options = v.target.options, 790 | distance = v.target.distance 791 | }) 792 | else 793 | AddTargetEntity(spawnedped, { 794 | options = v.target.options, 795 | distance = v.target.distance 796 | }) 797 | end 798 | end 799 | 800 | v.currentpednumber = spawnedped 801 | end 802 | 803 | local nextnumber = #Config.Peds + 1 804 | if nextnumber <= 0 then nextnumber = 1 end 805 | 806 | Config.Peds[nextnumber] = v 807 | end 808 | else 809 | if type(value) == 'table' and key ~= 'target' and key ~= 'coords' then 810 | if Config.Debug then print('Wrong table format for SpawnPed export') end 811 | return 812 | end 813 | 814 | if data.spawnNow then 815 | RequestModel(data.model) 816 | while not HasModelLoaded(data.model) do 817 | Wait(0) 818 | end 819 | 820 | if type(data.model) == 'string' then data.model = joaat(data.model) end 821 | 822 | if data.minusOne then 823 | spawnedped = CreatePed(0, data.model, data.coords.x, data.coords.y, data.coords.z - 1.0, data.coords.w, data.networked or false, true) 824 | else 825 | spawnedped = CreatePed(0, data.model, data.coords.x, data.coords.y, data.coords.z, data.coords.w, data.networked or false, true) 826 | end 827 | 828 | if data.freeze then 829 | FreezeEntityPosition(spawnedped, true) 830 | end 831 | 832 | if data.invincible then 833 | SetEntityInvincible(spawnedped, true) 834 | end 835 | 836 | if data.blockevents then 837 | SetBlockingOfNonTemporaryEvents(spawnedped, true) 838 | end 839 | 840 | if data.animDict and data.anim then 841 | RequestAnimDict(data.animDict) 842 | while not HasAnimDictLoaded(data.animDict) do 843 | Wait(0) 844 | end 845 | 846 | TaskPlayAnim(spawnedped, data.animDict, data.anim, 8.0, 0, -1, data.flag or 1, 0, 0, 0, 0) 847 | end 848 | 849 | if data.scenario then 850 | SetPedCanPlayAmbientAnims(spawnedped, true) 851 | TaskStartScenarioInPlace(spawnedped, data.scenario, 0, true) 852 | end 853 | 854 | if data.target then 855 | if data.target.useModel then 856 | AddTargetModel(data.model, { 857 | options = data.target.options, 858 | distance = data.target.distance 859 | }) 860 | else 861 | AddTargetEntity(spawnedped, { 862 | options = data.target.options, 863 | distance = data.target.distance 864 | }) 865 | end 866 | end 867 | 868 | data.currentpednumber = spawnedped 869 | end 870 | 871 | local nextnumber = #Config.Peds + 1 872 | if nextnumber <= 0 then nextnumber = 1 end 873 | 874 | Config.Peds[nextnumber] = data 875 | end 876 | end 877 | 878 | exports("SpawnPed", SpawnPed) 879 | 880 | local function RemovePed(peds) 881 | if type(peds) == 'table' then 882 | for k, v in pairs(peds) do 883 | DeletePed(v) 884 | if Config.Peds[k] then Config.Peds[k].currentpednumber = 0 end 885 | end 886 | elseif type(peds) == 'number' then 887 | DeletePed(peds) 888 | end 889 | end 890 | 891 | exports("RemoveSpawnedPed", RemovePed) 892 | 893 | -- Misc. Exports 894 | 895 | exports("RemoveGlobalPed", function(labels) RemoveGlobalType(1, labels) end) 896 | 897 | exports("RemoveGlobalVehicle", function(labels) RemoveGlobalType(2, labels) end) 898 | 899 | exports("RemoveGlobalObject", function(labels) RemoveGlobalType(3, labels) end) 900 | 901 | exports("IsTargetActive", function() return targetActive end) 902 | 903 | exports("IsTargetSuccess", function() return success end) 904 | 905 | exports("GetGlobalTypeData", function(type, label) return Types[type][label] end) 906 | 907 | exports("GetZoneData", function(name) return Zones[name] end) 908 | 909 | exports("GetTargetBoneData", function(bone) return Bones.Options[bone][label] end) 910 | 911 | exports("GetTargetEntityData", function(entity, label) return Entities[entity][label] end) 912 | 913 | exports("GetTargetModelData", function(model, label) return Models[model][label] end) 914 | 915 | exports("GetGlobalPedData", function(label) return Types[1][label] end) 916 | 917 | exports("GetGlobalVehicleData", function(label) return Types[2][label] end) 918 | 919 | exports("GetGlobalObjectData", function(label) return Types[3][label] end) 920 | 921 | exports("GetGlobalPlayerData", function(label) return Players[label] end) 922 | 923 | exports("UpdateGlobalTypeData", function(type, label, data) Types[type][label] = data end) 924 | 925 | exports("UpdateZoneData", function(name, data) Zones[name] = data end) 926 | 927 | exports("UpdateTargetBoneData", function(bone, label, data) Bones.Options[bone][label] = data end) 928 | 929 | exports("UpdateTargetEntityData", function(entity, label, data) Entities[entity][label] = data end) 930 | 931 | exports("UpdateTargetModelData", function(model, label, data) Models[model][label] = data end) 932 | 933 | exports("UpdateGlobalPedData", function(label, data) Types[1][label] = data end) 934 | 935 | exports("UpdateGlobalVehicleData", function(label, data) Types[2][label] = data end) 936 | 937 | exports("UpdateGlobalObjectData", function(label, data) Types[3][label] = data end) 938 | 939 | exports("UpdateGlobalPlayerData", function(label, data) Players[label] = data end) 940 | 941 | exports("GetPeds", function() return Config.Peds end) 942 | 943 | exports("UpdatePedsData", function(index, data) Config.Peds[index] = data end) 944 | 945 | exports("AllowTargeting", function(bool) allowTarget = bool end) 946 | 947 | -- NUI Callbacks 948 | 949 | RegisterNUICallback('selectTarget', function(option, cb) 950 | SetNuiFocus(false, false) 951 | SetNuiFocusKeepInput(false) 952 | Wait(100) 953 | targetActive, success, hasFocus = false, false, false 954 | if not next(sendData) then return end 955 | local data = sendData[option] 956 | if not data then return end 957 | table_wipe(sendData) 958 | CreateThread(function() 959 | Wait(0) 960 | if data.action then 961 | data.action(data.entity) 962 | elseif data.event then 963 | if data.type == "client" then 964 | TriggerEvent(data.event, data) 965 | elseif data.type == "server" then 966 | TriggerServerEvent(data.event, data) 967 | elseif data.type == "command" then 968 | ExecuteCommand(data.event) 969 | elseif data.type == "qbcommand" then 970 | TriggerServerEvent('QBCore:CallCommand', data.event, data) 971 | else 972 | TriggerEvent(data.event, data) 973 | end 974 | else 975 | error("No trigger setup") 976 | end 977 | end) 978 | cb('ok') 979 | end) 980 | 981 | RegisterNUICallback('closeTarget', function(_, cb) 982 | SetNuiFocus(false, false) 983 | SetNuiFocusKeepInput(false) 984 | Wait(100) 985 | targetActive, success, hasFocus = false, false, false 986 | cb('ok') 987 | end) 988 | 989 | RegisterNUICallback('leftTarget', function(_, cb) 990 | if Config.Toggle then 991 | SetNuiFocus(false, false) 992 | SetNuiFocusKeepInput(false) 993 | Wait(100) 994 | table_wipe(sendData) 995 | success, hasFocus = false, false 996 | else 997 | DisableTarget(true) 998 | end 999 | cb('ok') 1000 | end) 1001 | 1002 | -- Startup thread 1003 | 1004 | CreateThread(function() 1005 | if Config.Toggle then 1006 | RegisterCommand('playerTarget', function() 1007 | if targetActive then 1008 | DisableTarget(true) 1009 | else 1010 | EnableTarget() 1011 | end 1012 | end, false) 1013 | RegisterKeyMapping("playerTarget", "Toggle targeting", "keyboard", Config.OpenKey) 1014 | TriggerEvent('chat:removeSuggestion', '/playerTarget') 1015 | else 1016 | RegisterCommand('+playerTarget', EnableTarget, false) 1017 | RegisterCommand('-playerTarget', DisableTarget, false) 1018 | RegisterKeyMapping("+playerTarget", "Enable targeting", "keyboard", Config.OpenKey) 1019 | TriggerEvent('chat:removeSuggestion', '/+playerTarget') 1020 | TriggerEvent('chat:removeSuggestion', '/-playerTarget') 1021 | end 1022 | 1023 | if next(Config.CircleZones) then 1024 | for k, v in pairs(Config.CircleZones) do 1025 | AddCircleZone(v.name, v.coords, v.radius, { 1026 | name = v.name, 1027 | debugPoly = v.debugPoly, 1028 | }, { 1029 | options = v.options, 1030 | distance = v.distance 1031 | }) 1032 | end 1033 | end 1034 | 1035 | if next(Config.BoxZones) then 1036 | for k, v in pairs(Config.BoxZones) do 1037 | AddBoxZone(v.name, v.coords, v.length, v.width, { 1038 | name = v.name, 1039 | heading = v.heading, 1040 | debugPoly = v.debugPoly, 1041 | minZ = v.minZ, 1042 | maxZ = v.maxZ 1043 | }, { 1044 | options = v.options, 1045 | distance = v.distance 1046 | }) 1047 | end 1048 | end 1049 | 1050 | if next(Config.PolyZones) then 1051 | for k, v in pairs(Config.PolyZones) do 1052 | AddPolyZone(v.name, v.points, { 1053 | name = v.name, 1054 | debugPoly = v.debugPoly, 1055 | minZ = v.minZ, 1056 | maxZ = v.maxZ 1057 | }, { 1058 | options = v.options, 1059 | distance = v.distance 1060 | }) 1061 | end 1062 | end 1063 | 1064 | if next(Config.TargetBones) then 1065 | for k, v in pairs(Config.TargetBones) do 1066 | AddTargetBone(v.bones, { 1067 | options = v.options, 1068 | distance = v.distance 1069 | }) 1070 | end 1071 | end 1072 | 1073 | if next(Config.TargetModels) then 1074 | for k, v in pairs(Config.TargetModels) do 1075 | AddTargetModel(v.models, { 1076 | options = v.options, 1077 | distance = v.distance 1078 | }) 1079 | end 1080 | end 1081 | 1082 | if next(Config.GlobalPedOptions) then 1083 | AddGlobalPed(Config.GlobalPedOptions) 1084 | end 1085 | 1086 | if next(Config.GlobalVehicleOptions) then 1087 | AddGlobalVehicle(Config.GlobalVehicleOptions) 1088 | end 1089 | 1090 | if next(Config.GlobalObjectOptions) then 1091 | AddGlobalObject(Config.GlobalObjectOptions) 1092 | end 1093 | 1094 | if next(Config.GlobalPlayerOptions) then 1095 | AddGlobalPlayer(Config.GlobalPlayerOptions) 1096 | end 1097 | end) 1098 | 1099 | -- Events 1100 | 1101 | -- This is to make sure the peds spawn on restart too instead of only when you load/log-in. 1102 | AddEventHandler('onResourceStart', function(resource) 1103 | if resource == currentResourceName then 1104 | SpawnPeds() 1105 | end 1106 | end) 1107 | 1108 | -- This will delete the peds when the resource stops to make sure you don't have random peds walking 1109 | AddEventHandler('onResourceStop', function(resource) 1110 | if resource == currentResourceName then 1111 | DeletePeds() 1112 | end 1113 | end) 1114 | 1115 | -- Debug Option 1116 | 1117 | if Config.Debug then Load('debug') end -------------------------------------------------------------------------------- /data/bones.lua: -------------------------------------------------------------------------------- 1 | local Bones = {Options = {}, Vehicle = {'chassis', 'windscreen', 'seat_pside_r', 'seat_dside_r', 'bodyshell', 'suspension_lm', 'suspension_lr', 'platelight', 'attach_female', 'attach_male', 'bonnet', 'boot', 'chassis_dummy', 'chassis_Control', 'door_dside_f', 'door_dside_r', 'door_pside_f', 'door_pside_r', 'Gun_GripR', 'windscreen_f', 'platelight', 'VFX_Emitter', 'window_lf', 'window_lr', 'window_rf', 'window_rr', 'engine', 'gun_ammo', 'ROPE_ATTATCH', 'wheel_lf', 'wheel_lr', 'wheel_rf', 'wheel_rr', 'exhaust', 'overheat', 'seat_dside_f', 'seat_pside_f', 'Gun_Nuzzle', 'seat_r'}} 2 | 3 | if Config.EnableDefaultOptions then 4 | local BackEngineVehicles = { 5 | [`ninef`] = true, 6 | [`adder`] = true, 7 | [`vagner`] = true, 8 | [`t20`] = true, 9 | [`infernus`] = true, 10 | [`zentorno`] = true, 11 | [`reaper`] = true, 12 | [`comet2`] = true, 13 | [`comet3`] = true, 14 | [`jester`] = true, 15 | [`jester2`] = true, 16 | [`cheetah`] = true, 17 | [`cheetah2`] = true, 18 | [`prototipo`] = true, 19 | [`turismor`] = true, 20 | [`pfister811`] = true, 21 | [`ardent`] = true, 22 | [`nero`] = true, 23 | [`nero2`] = true, 24 | [`tempesta`] = true, 25 | [`vacca`] = true, 26 | [`bullet`] = true, 27 | [`osiris`] = true, 28 | [`entityxf`] = true, 29 | [`turismo2`] = true, 30 | [`fmj`] = true, 31 | [`re7b`] = true, 32 | [`tyrus`] = true, 33 | [`italigtb`] = true, 34 | [`penetrator`] = true, 35 | [`monroe`] = true, 36 | [`ninef2`] = true, 37 | [`stingergt`] = true, 38 | [`surfer`] = true, 39 | [`surfer2`] = true, 40 | [`gp1`] = true, 41 | [`autarch`] = true, 42 | [`tyrant`] = true 43 | } 44 | 45 | local function ToggleDoor(vehicle, door) 46 | if GetVehicleDoorLockStatus(vehicle) ~= 2 then 47 | if GetVehicleDoorAngleRatio(vehicle, door) > 0.0 then 48 | SetVehicleDoorShut(vehicle, door, false) 49 | else 50 | SetVehicleDoorOpen(vehicle, door, false) 51 | end 52 | end 53 | end 54 | 55 | Bones.Options['seat_dside_f'] = { 56 | ["Toggle Front Door"] = { 57 | icon = "fas fa-door-open", 58 | label = "Toggle Front Door", 59 | canInteract = function(entity) 60 | return GetEntityBoneIndexByName(entity, 'door_dside_f') ~= -1 61 | end, 62 | action = function(entity) 63 | ToggleDoor(entity, 0) 64 | end, 65 | distance = 1.2 66 | } 67 | } 68 | 69 | Bones.Options['seat_pside_f'] = { 70 | ["Toggle Front Door"] = { 71 | icon = "fas fa-door-open", 72 | label = "Toggle Front Door", 73 | canInteract = function(entity) 74 | return GetEntityBoneIndexByName(entity, 'door_pside_f') ~= -1 75 | end, 76 | action = function(entity) 77 | ToggleDoor(entity, 1) 78 | end, 79 | distance = 1.2 80 | } 81 | } 82 | 83 | Bones.Options['seat_dside_r'] = { 84 | ["Toggle Rear Door"] = { 85 | icon = "fas fa-door-open", 86 | label = "Toggle Rear Door", 87 | canInteract = function(entity) 88 | return GetEntityBoneIndexByName(entity, 'door_dside_r') ~= -1 89 | end, 90 | action = function(entity) 91 | ToggleDoor(entity, 2) 92 | end, 93 | distance = 1.2 94 | } 95 | } 96 | 97 | Bones.Options['seat_pside_r'] = { 98 | ["Toggle Rear Door"] = { 99 | icon = "fas fa-door-open", 100 | label = "Toggle Rear Door", 101 | canInteract = function(entity) 102 | return GetEntityBoneIndexByName(entity, 'door_pside_r') ~= -1 103 | end, 104 | action = function(entity) 105 | ToggleDoor(entity, 3) 106 | end, 107 | distance = 1.2 108 | } 109 | } 110 | 111 | Bones.Options['bonnet'] = { 112 | ["Toggle Hood"] = { 113 | icon = "fa-duotone fa-engine", 114 | label = "Toggle Hood", 115 | action = function(entity) 116 | ToggleDoor(entity, BackEngineVehicles[GetEntityModel(entity)] and 5 or 4) 117 | end, 118 | distance = 0.9 119 | } 120 | } 121 | 122 | Bones.Options['boot'] = { 123 | ["Toggle Trunk"] = { 124 | icon = "fas fa-truck-ramp-box", 125 | label = "Toggle Trunk", 126 | action = function(entity) 127 | ToggleDoor(entity, BackEngineVehicles[GetEntityModel(entity)] and 4 or 5) 128 | end, 129 | distance = 0.9 130 | } 131 | } 132 | end 133 | 134 | return Bones -------------------------------------------------------------------------------- /data/debug.lua: -------------------------------------------------------------------------------- 1 | local currentResourceName = GetCurrentResourceName() 2 | local targeting = exports[currentResourceName] 3 | 4 | AddEventHandler(currentResourceName..':debug', function(data) 5 | print('Entity: '..data.entity, 'Model: '..GetEntityModel(data.entity), 'Type: '..GetEntityType(data.entity)) 6 | if data.remove then 7 | targeting:RemoveTargetEntity(data.entity, 'Hello World') 8 | else 9 | targeting:AddTargetEntity(data.entity, { 10 | options = { 11 | { 12 | type = "client", 13 | event = currentResourceName..':debug', 14 | icon = "fas fa-box-circle-check", 15 | label = "Hello World", 16 | remove = true 17 | }, 18 | }, 19 | distance = 3.0 20 | }) 21 | end 22 | end) 23 | 24 | targeting:AddGlobalPed({ 25 | options = { 26 | { 27 | type = "client", 28 | event = currentResourceName..':debug', 29 | icon = "fas fa-male", 30 | label = "(Debug) Ped", 31 | }, 32 | }, 33 | distance = Config.MaxDistance 34 | }) 35 | 36 | targeting:AddGlobalVehicle({ 37 | options = { 38 | { 39 | type = "client", 40 | event = currentResourceName..':debug', 41 | icon = "fas fa-car", 42 | label = "(Debug) Vehicle", 43 | }, 44 | }, 45 | distance = Config.MaxDistance 46 | }) 47 | 48 | targeting:AddGlobalObject({ 49 | options = { 50 | { 51 | type = "client", 52 | event = currentResourceName..':debug', 53 | icon = "fas fa-cube", 54 | label = "(Debug) Object", 55 | }, 56 | }, 57 | distance = Config.MaxDistance 58 | }) 59 | 60 | targeting:AddGlobalPlayer({ 61 | options = { 62 | { 63 | type = "client", 64 | event = currentResourceName..':debug', 65 | icon = "fas fa-cube", 66 | label = "(Debug) Player", 67 | }, 68 | }, 69 | distance = Config.MaxDistance 70 | }) -------------------------------------------------------------------------------- /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'cerulean' 2 | game 'gta5' 3 | 4 | author 'BerkieB' 5 | description 'An optimized interaction system for FiveM, based on qtarget' 6 | version '5.3.3' 7 | 8 | ui_page 'html/index.html' 9 | 10 | client_scripts { 11 | '@PolyZone/client.lua', 12 | '@PolyZone/BoxZone.lua', 13 | '@PolyZone/EntityZone.lua', 14 | '@PolyZone/CircleZone.lua', 15 | '@PolyZone/ComboZone.lua', 16 | 'init.lua', 17 | 'client.lua', 18 | } 19 | 20 | files { 21 | 'data/*.lua', 22 | 'html/*.html', 23 | 'html/css/*.css', 24 | 'html/js/*.js' 25 | } 26 | 27 | lua54 'yes' 28 | use_fxv2_oal 'yes' 29 | 30 | dependency 'PolyZone' -------------------------------------------------------------------------------- /html/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | overflow: hidden; 3 | } 4 | 5 | #target-eye { 6 | position: absolute; 7 | top: 50%; 8 | left: 50%; 9 | transform: translateY(-50%) translateX(-50%); 10 | font-size: 3vh; 11 | text-shadow: 0.2vh 0.2vh 0.2vh #000000; 12 | width: 4.6vh; 13 | height: 1.36vw; 14 | } 15 | 16 | #target-label-wrapper { 17 | position: absolute; 18 | display: flex; 19 | align-content: center; 20 | justify-content: center; 21 | flex-direction: row; 22 | left: 87vh; 23 | width: fit-content; 24 | height: 100%; 25 | top: 52%; 26 | } 27 | 28 | #target-label { 29 | list-style: none; 30 | font-size: 1.7vh; 31 | font-family: Arial, Helvetica, sans-serif; 32 | line-height: 0; 33 | letter-spacing: 0.1px; 34 | font-weight: 600; 35 | text-decoration: none; 36 | font-style: normal; 37 | font-variant: small-caps; 38 | text-transform: none; 39 | color: #fff; 40 | user-select: none; 41 | white-space: nowrap; 42 | text-shadow: 0.1vh 0.1vh 0.1vh #000000; 43 | } -------------------------------------------------------------------------------- /html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 37 |
38 | 39 | 40 |
41 |
42 |
43 |
44 | 45 | 46 | -------------------------------------------------------------------------------- /html/js/app.js: -------------------------------------------------------------------------------- 1 | const Targeting = Vue.createApp({ 2 | data() { 3 | return { 4 | Show: false, 5 | ChangeTextIconColor: false, // This is if you want to change the color of the icon next to the option text with the text color 6 | StandardEyeIcon: 'https://cdn.discordapp.com/attachments/903021216464531507/903024370665000981/normaleye.png', // Instead of icon it's using a image source found in HTML 7 | CurrentIcon: 'https://cdn.discordapp.com/attachments/903021216464531507/903024370665000981/normaleye.png', // Instead of icon it's using a image source found in HTML 8 | SuccessIcon: 'https://cdn.discordapp.com/attachments/903021216464531507/903024373626208336/activeeye.png', // Instead of icon it's using a image source found in HTML 9 | SuccessColor: "rgb(5, 241, 178)", 10 | StandardColor: "white", 11 | TargetHTML: "", 12 | TargetEyeStyleObject: { 13 | color: "white", // This is the standardcolor, change this to the same as the StandardColor if you have changed it 14 | }, 15 | } 16 | }, 17 | destroyed() { 18 | window.removeEventListener("message", this.messageListener); 19 | window.removeEventListener("mousedown", this.mouseListener); 20 | window.removeEventListener("keydown", this.keyListener); 21 | }, 22 | mounted() { 23 | this.messageListener = window.addEventListener("message", (event) => { 24 | switch (event.data.response) { 25 | case "openTarget": 26 | this.OpenTarget(); 27 | break; 28 | case "closeTarget": 29 | this.CloseTarget(); 30 | break; 31 | case "foundTarget": 32 | this.FoundTarget(event.data); 33 | break; 34 | case "validTarget": 35 | this.ValidTarget(event.data); 36 | break; 37 | case "leftTarget": 38 | this.LeftTarget(); 39 | break; 40 | } 41 | }); 42 | 43 | this.mouseListener = window.addEventListener("mousedown", (event) => { 44 | let element = event.target; 45 | let split = element.id.split("-"); 46 | if (split[0] === 'target' && split[1] !== 'eye') { 47 | $.post(`https://${GetParentResourceName()}/selectTarget`, JSON.stringify(Number(split[1]) + 1)); 48 | this.TargetHTML = ""; 49 | this.Show = false; 50 | } 51 | 52 | if (event.button == 2) { 53 | this.CloseTarget(); 54 | $.post(`https://${GetParentResourceName()}/closeTarget`); 55 | } 56 | }); 57 | 58 | this.keyListener = window.addEventListener("keydown", (event) => { 59 | if (event.key == 'Escape' || event.key == 'Backspace') { 60 | this.CloseTarget(); 61 | $.post(`https://${GetParentResourceName()}/closeTarget`); 62 | } 63 | }); 64 | }, 65 | methods: { 66 | OpenTarget() { 67 | this.TargetHTML = ""; 68 | this.Show = true; 69 | this.TargetEyeStyleObject.color = this.StandardColor; 70 | }, 71 | 72 | CloseTarget() { 73 | this.TargetHTML = ""; 74 | this.TargetEyeStyleObject.color = this.StandardColor; 75 | this.Show = false; 76 | this.CurrentIcon = this.StandardEyeIcon; 77 | }, 78 | 79 | FoundTarget(item) { 80 | if (item.data) { 81 | this.CurrentIcon = item.data; 82 | } else { 83 | this.CurrentIcon = this.SuccessIcon; 84 | } 85 | this.TargetEyeStyleObject.color = this.SuccessColor; 86 | }, 87 | 88 | ValidTarget(item) { 89 | this.TargetHTML = ""; 90 | let TargetLabel = this.TargetHTML; 91 | const FoundColor = this.SuccessColor; 92 | const ResetColor = this.StandardColor; 93 | const AlsoChangeTextIconColor = this.ChangeTextIconColor; 94 | item.data.forEach(function(item, index) { 95 | if (AlsoChangeTextIconColor) { 96 | TargetLabel += "
 " + item.label + "
"; 97 | } else { 98 | TargetLabel += "
 " + item.label + "
"; 99 | }; 100 | 101 | setTimeout(function() { 102 | const hoverelem = document.getElementById("target-" + index); 103 | 104 | hoverelem.addEventListener("mouseenter", function(event) { 105 | event.target.style.color = FoundColor; 106 | if (AlsoChangeTextIconColor) { 107 | document.getElementById("target-icon-" + index).style.color = FoundColor; 108 | }; 109 | }); 110 | 111 | hoverelem.addEventListener("mouseleave", function(event) { 112 | event.target.style.color = ResetColor; 113 | if (AlsoChangeTextIconColor) { 114 | document.getElementById("target-icon-" + index).style.color = ResetColor; 115 | }; 116 | }); 117 | }, 10) 118 | }); 119 | this.TargetHTML = TargetLabel; 120 | }, 121 | 122 | LeftTarget() { 123 | this.TargetHTML = ""; 124 | this.CurrentIcon = this.StandardEyeIcon; 125 | this.TargetEyeStyleObject.color = this.StandardColor; 126 | } 127 | } 128 | }); 129 | 130 | Targeting.use(Quasar, { 131 | config: { 132 | loadingBar: { skipHijack: true } 133 | } 134 | }); 135 | Targeting.mount("#target-wrapper"); 136 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | function Load(name) 2 | local resourceName = GetCurrentResourceName() 3 | local chunk = LoadResourceFile(resourceName, ('data/%s.lua'):format(name)) 4 | if chunk then 5 | local err 6 | chunk, err = load(chunk, ('@@%s/data/%s.lua'):format(resourceName, name), 't') 7 | if err then 8 | error(('\n^1 %s'):format(err), 0) 9 | end 10 | return chunk() 11 | end 12 | end 13 | 14 | ------------------------------------------------------------------------------- 15 | -- Settings 16 | ------------------------------------------------------------------------------- 17 | 18 | Config = {} 19 | 20 | -- It's possible to interact with entities through walls so this should be low 21 | Config.MaxDistance = 7.0 22 | 23 | -- Enable debug options 24 | Config.Debug = false 25 | 26 | -- Supported values: true, false 27 | Config.Standalone = false 28 | 29 | -- Enable outlines around the entity you're looking at 30 | Config.EnableOutline = false 31 | 32 | -- Whether to have the target as a toggle or not 33 | Config.Toggle = false 34 | 35 | -- Draw sprite on location 36 | Config.DrawSprite = true 37 | Config.DrawDistance = 20.0 38 | 39 | -- The color of the outline in rgb, the first value is red, the second value is green and the last value is blue. Here is a link to a color picker to get these values: https://htmlcolorcodes.com/color-picker/ 40 | Config.OutlineColor = {255, 255, 255} 41 | 42 | -- Enable default options (Toggling vehicle doors) 43 | Config.EnableDefaultOptions = true 44 | 45 | -- Disable the target eye whilst being in a vehicle 46 | Config.DisableInVehicle = false 47 | 48 | -- Key to open the target eye, here you can find all the names: https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/ 49 | Config.OpenKey = 'LMENU' -- Left Alt 50 | 51 | -- Control for key press detection on the context menu, it's the Right Mouse Button by default, controls are found here https://docs.fivem.net/docs/game-references/controls/ 52 | Config.MenuControlKey = 238 53 | 54 | ------------------------------------------------------------------------------- 55 | -- Target Configs 56 | ------------------------------------------------------------------------------- 57 | 58 | -- These are all empty for you to fill in, refer to the .md files for help in filling these in 59 | 60 | Config.CircleZones = { 61 | 62 | } 63 | 64 | Config.BoxZones = { 65 | 66 | } 67 | 68 | Config.PolyZones = { 69 | 70 | } 71 | 72 | Config.TargetBones = { 73 | 74 | } 75 | 76 | Config.TargetModels = { 77 | 78 | } 79 | 80 | Config.GlobalPedOptions = { 81 | 82 | } 83 | 84 | Config.GlobalVehicleOptions = { 85 | 86 | } 87 | 88 | Config.GlobalObjectOptions = { 89 | 90 | } 91 | 92 | Config.GlobalPlayerOptions = { 93 | 94 | } 95 | 96 | Config.Peds = { 97 | 98 | } 99 | 100 | ------------------------------------------------------------------------------- 101 | -- Functions 102 | ------------------------------------------------------------------------------- 103 | local function JobCheck() return true end 104 | local function GangCheck() return true end 105 | local function ItemCount() return true end 106 | local function CitizenCheck() return true end 107 | 108 | CreateThread(function() 109 | local state = GetResourceState('qb-core') 110 | if state ~= 'missing' then 111 | if state ~= 'started' then 112 | local timeout = 0 113 | repeat 114 | timeout += 1 115 | Wait(0) 116 | until GetResourceState('qb-core') == 'started' or timeout > 100 117 | end 118 | Config.Standalone = false 119 | end 120 | if Config.Standalone then 121 | local firstSpawn = false 122 | local event = AddEventHandler('playerSpawned', function() 123 | SpawnPeds() 124 | firstSpawn = true 125 | end) 126 | -- Remove event after it has been triggered 127 | while true do 128 | if firstSpawn then 129 | RemoveEventHandler(event) 130 | break 131 | end 132 | Wait(1000) 133 | end 134 | else 135 | local QBCore = exports['qb-core']:GetCoreObject() 136 | local PlayerData = QBCore.Functions.GetPlayerData() 137 | 138 | ItemCount = function(item) 139 | for _, v in pairs(PlayerData.items) do 140 | if v.name == item then 141 | return true 142 | end 143 | end 144 | return false 145 | end 146 | 147 | JobCheck = function(job) 148 | if type(job) == 'table' then 149 | job = job[PlayerData.job.name] 150 | if job and PlayerData.job.grade.level >= job then 151 | return true 152 | end 153 | elseif job == 'all' or job == PlayerData.job.name then 154 | return true 155 | end 156 | return false 157 | end 158 | 159 | GangCheck = function(gang) 160 | if type(gang) == 'table' then 161 | gang = gang[PlayerData.gang.name] 162 | if gang and PlayerData.gang.grade.level >= gang then 163 | return true 164 | end 165 | elseif gang == 'all' or gang == PlayerData.gang.name then 166 | return true 167 | end 168 | return false 169 | end 170 | 171 | CitizenCheck = function(citizenid) 172 | return citizenid == PlayerData.citizenid or citizenid[PlayerData.citizenid] 173 | end 174 | 175 | RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() 176 | PlayerData = QBCore.Functions.GetPlayerData() 177 | SpawnPeds() 178 | end) 179 | 180 | RegisterNetEvent('QBCore:Client:OnPlayerUnload', function() 181 | PlayerData = {} 182 | DeletePeds() 183 | end) 184 | 185 | RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo) 186 | PlayerData.job = JobInfo 187 | end) 188 | 189 | RegisterNetEvent('QBCore:Client:OnGangUpdate', function(GangInfo) 190 | PlayerData.gang = GangInfo 191 | end) 192 | 193 | RegisterNetEvent('QBCore:Player:SetPlayerData', function(val) 194 | PlayerData = val 195 | end) 196 | end 197 | end) 198 | 199 | function CheckOptions(data, entity, distance) 200 | if distance and data.distance and distance > data.distance then return false end 201 | if data.job and not JobCheck(data.job) then return false end 202 | if data.gang and not GangCheck(data.gang) then return false end 203 | if data.item and not ItemCount(data.item) then return false end 204 | if data.citizenid and not CitizenCheck(data.citizenid) then return false end 205 | if data.canInteract and not data.canInteract(entity, distance, data) then return false end 206 | return true 207 | end --------------------------------------------------------------------------------