From 678b84f315d5be6cd0fe52096a790ef5c021f8a6 Mon Sep 17 00:00:00 2001 From: "DESKTOP-B8MI20L\\aluca" Date: Thu, 25 Apr 2024 17:10:14 -0300 Subject: [PATCH] dygeras QBCORE V1 --- .../.github/ISSUE_TEMPLATE/bug_report.md | 32 + .../.github/ISSUE_TEMPLATE/feature-request.md | 20 + [qb]/qb-vineyard/.github/auto_assign.yml | 17 + [qb]/qb-vineyard/.github/contributing.md | 201 ++++ .../.github/pull_request_template.md | 10 + [qb]/qb-vineyard/.github/workflows/lint.yml | 23 + [qb]/qb-vineyard/LICENSE | 674 +++++++++++++ [qb]/qb-vineyard/README.md | 25 + [qb]/qb-vineyard/client.lua | 332 +++++++ [qb]/qb-vineyard/config.lua | 44 + [qb]/qb-vineyard/fxmanifest.lua | 27 + [qb]/qb-vineyard/locales/de.lua | 28 + [qb]/qb-vineyard/locales/en.lua | 33 + [qb]/qb-vineyard/locales/es.lua | 36 + [qb]/qb-vineyard/locales/fi.lua | 28 + [qb]/qb-vineyard/locales/fr.lua | 36 + [qb]/qb-vineyard/locales/ge.lua | 28 + [qb]/qb-vineyard/locales/it.lua | 28 + [qb]/qb-vineyard/locales/nl.lua | 36 + [qb]/qb-vineyard/locales/pt.lua | 36 + [qb]/qb-vineyard/locales/sv.lua | 28 + [qb]/qb-vineyard/locales/tr.lua | 36 + [qb]/qb-vineyard/server.lua | 70 ++ .../.github/ISSUE_TEMPLATE/bug_report.md | 32 + .../.github/ISSUE_TEMPLATE/feature-request.md | 20 + [qb]/qb-weapons/.github/auto_assign.yml | 17 + [qb]/qb-weapons/.github/contributing.md | 201 ++++ .../.github/pull_request_template.md | 10 + [qb]/qb-weapons/.github/workflows/lint.yml | 23 + [qb]/qb-weapons/LICENSE | 674 +++++++++++++ [qb]/qb-weapons/README.md | 20 + [qb]/qb-weapons/client/main.lua | 246 +++++ [qb]/qb-weapons/config.lua | 920 ++++++++++++++++++ [qb]/qb-weapons/fxmanifest.lua | 22 + [qb]/qb-weapons/locales/ar.lua | 35 + [qb]/qb-weapons/locales/da.lua | 35 + [qb]/qb-weapons/locales/de.lua | 35 + [qb]/qb-weapons/locales/en.lua | 35 + [qb]/qb-weapons/locales/es.lua | 35 + [qb]/qb-weapons/locales/et.lua | 35 + [qb]/qb-weapons/locales/fr.lua | 35 + [qb]/qb-weapons/locales/it.lua | 35 + [qb]/qb-weapons/locales/lt.lua | 35 + [qb]/qb-weapons/locales/nl.lua | 35 + [qb]/qb-weapons/locales/pt.lua | 35 + [qb]/qb-weapons/locales/ro.lua | 35 + [qb]/qb-weapons/locales/sv.lua | 35 + [qb]/qb-weapons/locales/tr.lua | 35 + [qb]/qb-weapons/server/main.lua | 787 +++++++++++++++ [qb]/qb-weapons/weaponsnspistol.meta | 331 +++++++ .../.github/ISSUE_TEMPLATE/bug_report.md | 32 + .../.github/ISSUE_TEMPLATE/feature-request.md | 20 + [qb]/qb-weathersync/.github/auto_assign.yml | 17 + [qb]/qb-weathersync/.github/contributing.md | 201 ++++ .../.github/pull_request_template.md | 10 + .../qb-weathersync/.github/workflows/lint.yml | 23 + [qb]/qb-weathersync/LICENSE | 674 +++++++++++++ [qb]/qb-weathersync/README.md | 200 ++++ [qb]/qb-weathersync/client/client.lua | 109 +++ [qb]/qb-weathersync/config.lua | 31 + [qb]/qb-weathersync/fxmanifest.lua | 17 + [qb]/qb-weathersync/locales/da.lua | 65 ++ [qb]/qb-weathersync/locales/de.lua | 64 ++ [qb]/qb-weathersync/locales/en.lua | 60 ++ [qb]/qb-weathersync/locales/es.lua | 63 ++ [qb]/qb-weathersync/locales/fr.lua | 63 ++ [qb]/qb-weathersync/locales/hu.lua | 63 ++ [qb]/qb-weathersync/locales/it.lua | 66 ++ [qb]/qb-weathersync/locales/lt.lua | 63 ++ [qb]/qb-weathersync/locales/nl.lua | 63 ++ [qb]/qb-weathersync/locales/pt.lua | 65 ++ [qb]/qb-weathersync/locales/tr.lua | 64 ++ [qb]/qb-weathersync/server/server.lua | 326 +++++++ .../.github/ISSUE_TEMPLATE/bug_report.md | 32 + .../.github/ISSUE_TEMPLATE/feature-request.md | 20 + [qb]/qb-weed/.github/auto_assign.yml | 17 + [qb]/qb-weed/.github/contributing.md | 201 ++++ [qb]/qb-weed/.github/pull_request_template.md | 10 + [qb]/qb-weed/.github/workflows/lint.yml | 23 + [qb]/qb-weed/LICENSE | 674 +++++++++++++ [qb]/qb-weed/README.md | 20 + [qb]/qb-weed/client/main.lua | 315 ++++++ [qb]/qb-weed/config.lua | 105 ++ [qb]/qb-weed/fxmanifest.lua | 21 + [qb]/qb-weed/locales/en.lua | 31 + [qb]/qb-weed/locales/es.lua | 34 + [qb]/qb-weed/locales/fr.lua | 34 + [qb]/qb-weed/qb-weed.sql | 15 + [qb]/qb-weed/server/main.lua | 192 ++++ 89 files changed, 9724 insertions(+) create mode 100644 [qb]/qb-vineyard/.github/ISSUE_TEMPLATE/bug_report.md create mode 100644 [qb]/qb-vineyard/.github/ISSUE_TEMPLATE/feature-request.md create mode 100644 [qb]/qb-vineyard/.github/auto_assign.yml create mode 100644 [qb]/qb-vineyard/.github/contributing.md create mode 100644 [qb]/qb-vineyard/.github/pull_request_template.md create mode 100644 [qb]/qb-vineyard/.github/workflows/lint.yml create mode 100644 [qb]/qb-vineyard/LICENSE create mode 100644 [qb]/qb-vineyard/README.md create mode 100644 [qb]/qb-vineyard/client.lua create mode 100644 [qb]/qb-vineyard/config.lua create mode 100644 [qb]/qb-vineyard/fxmanifest.lua create mode 100644 [qb]/qb-vineyard/locales/de.lua create mode 100644 [qb]/qb-vineyard/locales/en.lua create mode 100644 [qb]/qb-vineyard/locales/es.lua create mode 100644 [qb]/qb-vineyard/locales/fi.lua create mode 100644 [qb]/qb-vineyard/locales/fr.lua create mode 100644 [qb]/qb-vineyard/locales/ge.lua create mode 100644 [qb]/qb-vineyard/locales/it.lua create mode 100644 [qb]/qb-vineyard/locales/nl.lua create mode 100644 [qb]/qb-vineyard/locales/pt.lua create mode 100644 [qb]/qb-vineyard/locales/sv.lua create mode 100644 [qb]/qb-vineyard/locales/tr.lua create mode 100644 [qb]/qb-vineyard/server.lua create mode 100644 [qb]/qb-weapons/.github/ISSUE_TEMPLATE/bug_report.md create mode 100644 [qb]/qb-weapons/.github/ISSUE_TEMPLATE/feature-request.md create mode 100644 [qb]/qb-weapons/.github/auto_assign.yml create mode 100644 [qb]/qb-weapons/.github/contributing.md create mode 100644 [qb]/qb-weapons/.github/pull_request_template.md create mode 100644 [qb]/qb-weapons/.github/workflows/lint.yml create mode 100644 [qb]/qb-weapons/LICENSE create mode 100644 [qb]/qb-weapons/README.md create mode 100644 [qb]/qb-weapons/client/main.lua create mode 100644 [qb]/qb-weapons/config.lua create mode 100644 [qb]/qb-weapons/fxmanifest.lua create mode 100644 [qb]/qb-weapons/locales/ar.lua create mode 100644 [qb]/qb-weapons/locales/da.lua create mode 100644 [qb]/qb-weapons/locales/de.lua create mode 100644 [qb]/qb-weapons/locales/en.lua create mode 100644 [qb]/qb-weapons/locales/es.lua create mode 100644 [qb]/qb-weapons/locales/et.lua create mode 100644 [qb]/qb-weapons/locales/fr.lua create mode 100644 [qb]/qb-weapons/locales/it.lua create mode 100644 [qb]/qb-weapons/locales/lt.lua create mode 100644 [qb]/qb-weapons/locales/nl.lua create mode 100644 [qb]/qb-weapons/locales/pt.lua create mode 100644 [qb]/qb-weapons/locales/ro.lua create mode 100644 [qb]/qb-weapons/locales/sv.lua create mode 100644 [qb]/qb-weapons/locales/tr.lua create mode 100644 [qb]/qb-weapons/server/main.lua create mode 100644 [qb]/qb-weapons/weaponsnspistol.meta create mode 100644 [qb]/qb-weathersync/.github/ISSUE_TEMPLATE/bug_report.md create mode 100644 [qb]/qb-weathersync/.github/ISSUE_TEMPLATE/feature-request.md create mode 100644 [qb]/qb-weathersync/.github/auto_assign.yml create mode 100644 [qb]/qb-weathersync/.github/contributing.md create mode 100644 [qb]/qb-weathersync/.github/pull_request_template.md create mode 100644 [qb]/qb-weathersync/.github/workflows/lint.yml create mode 100644 [qb]/qb-weathersync/LICENSE create mode 100644 [qb]/qb-weathersync/README.md create mode 100644 [qb]/qb-weathersync/client/client.lua create mode 100644 [qb]/qb-weathersync/config.lua create mode 100644 [qb]/qb-weathersync/fxmanifest.lua create mode 100644 [qb]/qb-weathersync/locales/da.lua create mode 100644 [qb]/qb-weathersync/locales/de.lua create mode 100644 [qb]/qb-weathersync/locales/en.lua create mode 100644 [qb]/qb-weathersync/locales/es.lua create mode 100644 [qb]/qb-weathersync/locales/fr.lua create mode 100644 [qb]/qb-weathersync/locales/hu.lua create mode 100644 [qb]/qb-weathersync/locales/it.lua create mode 100644 [qb]/qb-weathersync/locales/lt.lua create mode 100644 [qb]/qb-weathersync/locales/nl.lua create mode 100644 [qb]/qb-weathersync/locales/pt.lua create mode 100644 [qb]/qb-weathersync/locales/tr.lua create mode 100644 [qb]/qb-weathersync/server/server.lua create mode 100644 [qb]/qb-weed/.github/ISSUE_TEMPLATE/bug_report.md create mode 100644 [qb]/qb-weed/.github/ISSUE_TEMPLATE/feature-request.md create mode 100644 [qb]/qb-weed/.github/auto_assign.yml create mode 100644 [qb]/qb-weed/.github/contributing.md create mode 100644 [qb]/qb-weed/.github/pull_request_template.md create mode 100644 [qb]/qb-weed/.github/workflows/lint.yml create mode 100644 [qb]/qb-weed/LICENSE create mode 100644 [qb]/qb-weed/README.md create mode 100644 [qb]/qb-weed/client/main.lua create mode 100644 [qb]/qb-weed/config.lua create mode 100644 [qb]/qb-weed/fxmanifest.lua create mode 100644 [qb]/qb-weed/locales/en.lua create mode 100644 [qb]/qb-weed/locales/es.lua create mode 100644 [qb]/qb-weed/locales/fr.lua create mode 100644 [qb]/qb-weed/qb-weed.sql create mode 100644 [qb]/qb-weed/server/main.lua diff --git a/[qb]/qb-vineyard/.github/ISSUE_TEMPLATE/bug_report.md b/[qb]/qb-vineyard/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..62f702f --- /dev/null +++ b/[qb]/qb-vineyard/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,32 @@ +--- +name: Bug report +about: Create a report to help us improve or fix something +title: "[BUG]" +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. A stranger to qbcore should be able to read your bug report and understand how to reproduce it themselves and understand how the feature should work normally. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Use this item '....' (item's name from shared.lua if applicable) +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Questions (please complete the following information):** + - When you last updated: [e.g. last week] + - Are you using custom resource? which ones? [e.g. zdiscord, qb-target] + - Have you renamed `qb-` to something custom? [e.g. yes/no] + +**Additional context** +Add any other context about the problem here. diff --git a/[qb]/qb-vineyard/.github/ISSUE_TEMPLATE/feature-request.md b/[qb]/qb-vineyard/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000..9e9bf3e --- /dev/null +++ b/[qb]/qb-vineyard/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,20 @@ +--- +name: Feature Request +about: Suggest an idea for QBCore +title: "[SUGGESTION]" +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. + +**Describe the feature you'd like** +A clear and concise description of what you want to happen. and with as much detail as possible how it would function in your opinion. Please try to keep it unique. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered for people to have in mind just in case the main idea isn't liked but a derivative is. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/[qb]/qb-vineyard/.github/auto_assign.yml b/[qb]/qb-vineyard/.github/auto_assign.yml new file mode 100644 index 0000000..2a80921 --- /dev/null +++ b/[qb]/qb-vineyard/.github/auto_assign.yml @@ -0,0 +1,17 @@ +# Set to true to add reviewers to pull requests +addReviewers: true + +# Set to true to add assignees to pull requests +addAssignees: author + +# A list of reviewers to be added to pull requests (GitHub user name) +reviewers: + - /maintenance + +# A list of keywords to be skipped the process that add reviewers if pull requests include it +skipKeywords: + - wip + +# A number of reviewers added to the pull request +# Set 0 to add all the reviewers (default: 0) +numberOfReviewers: 0 \ No newline at end of file diff --git a/[qb]/qb-vineyard/.github/contributing.md b/[qb]/qb-vineyard/.github/contributing.md new file mode 100644 index 0000000..21fb806 --- /dev/null +++ b/[qb]/qb-vineyard/.github/contributing.md @@ -0,0 +1,201 @@ +# Contributing to QBCore + +First of all, thank you for taking the time to contribute! + +These guidelines will help you help us in the best way possible regardless of your skill level. We ask that you try to read everything related to the way you'd like to contribute and try and use your best judgement for anything not covered. + +### Table of Contents + +[Code of Conduct](#code-of-conduct) + +[I don't want to read this whole thing, I just have a question!!!](#i-dont-want-to-read-this-whole-thing-i-just-have-a-question) + +[How Can I Contribute?](#how-can-i-contribute) + * [Reporting Bugs](#reporting-bugs) + * [Suggesting Features / Enhancements](#suggesting-features--enhancements) + * [Your First Code Contribution](#your-first-code-contribution) + * [Pull Requests](#pull-requests) + +[Styleguides](#styleguides) + * [Git Commit Messages](#git-commit-messages) + * [Lua Styleguide](#lua-styleguide) + * [JavaScript Styleguide](#javascript-styleguide) + + + +## Code of Conduct + +- Refrain from using languages other than English. +- Refrain from discussing any politically charged or inflammatory topics. +- Uphold mature conversations and respect each other; excessive profanity, hate speech or any kind of harassment will not be tolerated. +- No advertising of any kind. +- Follow these guidelines. +- Do not mention members of github unless a question is directed at them and can't be answered by anyone else. +- Do not mention any of the development team for any reason. We will read things as we get to them. + +## I don't want to read this whole thing I just have a question!!! + +> **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below. + +* [QBCore Website](https://qbcore.org) +* [QBCore Discord](https://discord.gg/qbcore) +* [FiveM Discord - #qbcore channel](https://discord.gg/fivem) + + + + + + + + + + +## How Can I Contribute? + +### Reporting Bugs + +The easiest way to contribute for most people is just to report bugs you find cause if nobody reports it there's a chance we'll never know it exists and then we'll never fix it. + +Before creating bug reports, please check [this list](#before-submitting-a-bug-report) as you might find out that you don't need to create one. When you are creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out the bug-report template with the information it asks for helps us resolve issues faster. + +> **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one. + +#### Before Submitting A Bug Report + +* **Check the docs** There's a chance what you see as a bug might just work differently than you expect and if you think it could work better consider a feature enhancement report instead. +* **Search the [discord](https://discord.gg/qbcore)** to see if anyone else has run into the issue and see if it was solved through user error or code changes. (if the code change isn't pending a PR and you know what you're doing consider submitting one following [Pull Requests](#pull-requests) ) +* **Determine which resource the problem should be reported in**. If the bug is related to the inventory for example report this bug under qb-inventory rather than under qb-core or some other resource. +* **Perform a [cursory search](https://github.com/search?q=+is%3Aissue+user%3Aqbcore-framework)** to see if the problem has already been reported. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one. + +#### How Do I Submit A (Good) Bug Report? + +Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). After you've determined which resource your bug is related to, create an issue on that repository and provide the following information by filling in bug-report template. + +Explain the problem and include additional details to help maintainers reproduce the problem: + +* **Use a clear and descriptive title** for the issue to identify the problem. +* **Describe the exact steps which reproduce the problem** in as many details as possible. +* **Provide specific examples to demonstrate the steps**. If something happened with only a specific group or single item but not others, specify that. +* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior. +* **Explain which behavior you expected to see instead and why.** +* **Include screenshots** which show the specific bug in action or before and after. +* **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below. + +Provide more context by answering these questions if possible: + +* **Did the problem start happening recently** (e.g. after updating to a new version of QBCore?) or was this always a problem? +* If the problem started happening recently, **can you reproduce the problem in an older version of QBCore?** What's the most recent commit in which the problem doesn't happen? +* **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens. + +Include details about your setup: + +* **When was your QBCore last updated?** +* **What OS is the server running on**? +* **Which *extra* resources do you have installed?** + + +--- + + +### Suggesting Features / Enhancements + +This section guides you through submitting an enhancement suggestion for QBCore, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion. + +Before creating enhancement suggestions, please check [this list](#before-submitting-an-enhancement-suggestion) as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-enhancement-suggestion). Fill in feature request template, including the steps that you imagine you would take if the feature you're requesting existed. + +#### Before Submitting An Enhancement Suggestion + +* **Make sure it doesn't already exist.** Sounds silly, but there's a lot of features built in to qbcore that people don't realize so take a look through the docs and stuff to make sure it's not already there. +* **Check if there's already PR which provides that enhancement.** +* **Determine which resource the enhancement should be suggested in.** if it fits with another resource suggest it in that resource. if it would be it's own resource suggest it in the main qb-core repository. +* **Perform a [cursory search](https://github.com/search?q=+is%3Aissue+user%3Aqbcore-framework)** to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. + +#### How Do I Submit A (Good) Enhancement Suggestion? + +Enhancement suggestions are tracked as [GitHub issues](https://guides.github.com/features/issues/). After you've determined which resource your enhancement suggestion is related to, create an issue on that repository and provide the following information: + +* **Use a clear and descriptive title** for the issue to identify the suggestion. +* **Provide a step-by-step description of the suggested enhancement** in as many details as possible. +* **Provide specific examples to demonstrate the steps**. Include copy/pasteable snippets which you use in those examples, as [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines). +* **Describe the current behavior** and **explain which behavior you expected to see instead** and why. +* **Include screenshots and animated GIFs** which help you demonstrate the steps or point out the part of QBCore which the suggestion is related to. +* **Explain why this enhancement would be useful.** +* **Be creative and unique.** Stealing ideas from popular servers 1:1 detail isn't going to get accepted. + + +--- + + + +### Your First Code Contribution + +Unsure where to begin contributing to QBCore? You can start by looking through these `beginner` and `help-wanted` issues. + + + +--- + + +### Pull Requests + +The process described here has several goals: + +- Maintain QBCore's quality. +- Fix problems that are important to users. +- Engage the community in working toward the best possible QBCore. +- Enable a sustainable system for QBCore's maintainers to review contributions. + +Please follow these steps to have your contribution considered by the maintainers: + +1. Follow all instructions in The Pull Request template. +2. Follow the [styleguides](#styleguides). +3. Await review by the reviewer(s). + +While the prerequisites above must be satisfied prior to having your pull request reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted. + + +--- + +## Styleguides + +### Git Commit Messages + +* Limit the first line to 72 characters or less. +* Reference issues and pull requests liberally after the first line. +* Consider starting the commit message with an applicable emoji: + * :art: `:art:` when improving the format/structure of the code + * :racehorse: `:racehorse:` when improving performance + * :memo: `:memo:` when writing docs + * :bug: `:bug:` when fixing a bug + * :fire: `:fire:` when removing code or files + * :white_check_mark: `:white_check_mark:` when adding tests + * :lock: `:lock:` when dealing with security + * :arrow_up: `:arrow_up:` when upgrading dependencies + * :arrow_down: `:arrow_down:` when downgrading dependencies + * :shirt: `:shirt:` when removing linter warnings + +### Lua Styleguide + +All lua code should be done using all the best practices of proper lua using the easiest to read yet fastest/most optimized methods of execution. + +- Use 4 Space indentation +- Aim for lua 5.4 (include `lua54 'yes'` in the fxmanifest.lua) +- Use `PlayerPedId()` instead of `GetPlayerPed(-1)` +- Use `#(vector3 - vector3)` instead of `GetDistanceBetweenCoords()` +- Don't create unnecessary threads. always try to find a better method of triggering events +- Don't repeat yourself.. if you're using the same operations in many different places convert them into a function with flexible variables +- For distance checking loops set longer waits if you're outside of a range +- Job specific loops should only run for players with that job, don't waste cycles +- When possible don't trust the client, esspecially with transactions +- Balance security and optimizations +- [Consider this Lua Performance guide](https://springrts.com/wiki/Lua_Performance) +- Use local varriables everywhere possible +- Make use of config options where it makes sense making features optional or customizable +- Instead of `table.insert(myTable, "Value")` use `myTable[#myTable + 1] = "Value"` +- Instead of `table.insert(ages, "bob", 30)` use `ages["bob"] = 30` + + +### JavaScript Styleguide + +- Use 4 Space indentation +- Don't repeat yourself.. if you're using the same operations in many different places convert them into a function with flexible variables. diff --git a/[qb]/qb-vineyard/.github/pull_request_template.md b/[qb]/qb-vineyard/.github/pull_request_template.md new file mode 100644 index 0000000..000f0f9 --- /dev/null +++ b/[qb]/qb-vineyard/.github/pull_request_template.md @@ -0,0 +1,10 @@ +**Describe Pull request** +First, make sure you've read and are following the contribution guidelines and style guide and your code reflects that. +Write up a clear and concise description of what your pull request adds or fixes and if it's an added feature explain why you think it should be included in the core. + +If your PR is to fix an issue mention that issue here + +**Questions (please complete the following information):** +- Have you personally loaded this code into an updated qbcore project and checked all it's functionality? [yes/no] (Be honest) +- Does your code fit the style guidelines? [yes/no] +- Does your PR fit the contribution guidelines? [yes/no] diff --git a/[qb]/qb-vineyard/.github/workflows/lint.yml b/[qb]/qb-vineyard/.github/workflows/lint.yml new file mode 100644 index 0000000..fb74fd6 --- /dev/null +++ b/[qb]/qb-vineyard/.github/workflows/lint.yml @@ -0,0 +1,23 @@ +name: Lint +on: [push, pull_request_target] +jobs: + lint: + name: Lint Resource + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Lint + uses: iLLeniumStudios/fivem-lua-lint-action@v2 + with: + capture: "junit.xml" + args: "-t --formatter JUnit" + extra_libs: mysql+polyzone+qblocales + - name: Generate Lint Report + if: always() + uses: mikepenz/action-junit-report@v3 + with: + report_paths: "**/junit.xml" + check_name: Linting Report + fail_on_failure: false \ No newline at end of file diff --git a/[qb]/qb-vineyard/LICENSE b/[qb]/qb-vineyard/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/[qb]/qb-vineyard/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/[qb]/qb-vineyard/README.md b/[qb]/qb-vineyard/README.md new file mode 100644 index 0000000..c0297dc --- /dev/null +++ b/[qb]/qb-vineyard/README.md @@ -0,0 +1,25 @@ +# qb-vineyard +Vineyard Job For QB-Core +## Dependencies + +* [qb-core](https://github.com/qbcore-framework/qb-core) +* [PolyZone](https://github.com/mkafrin/PolyZone) + +# License + + QBCore Framework + Copyright (C) 2021 Joshua Eger + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + diff --git a/[qb]/qb-vineyard/client.lua b/[qb]/qb-vineyard/client.lua new file mode 100644 index 0000000..e21fd7a --- /dev/null +++ b/[qb]/qb-vineyard/client.lua @@ -0,0 +1,332 @@ +local QBCore = exports['qb-core']:GetCoreObject() +local PlayerJob = {} + +AddEventHandler('onResourceStart', function(resourceName) + if resourceName == GetCurrentResourceName() then + QBCore.Functions.GetPlayerData(function(PlayerData) + PlayerJob = PlayerData.job + end) + end +end) +RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() + QBCore.Functions.GetPlayerData(function(PlayerData) + PlayerJob = PlayerData.job + end) +end) + +RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo) + PlayerJob = JobInfo +end) + +local tasking = false +local startVineyard = false +local random = 0 +local pickedGrapes = 0 +local blip = 0 +local winetimer = Config.wineTimer +local loadIngredients = false +local wineStarted = false +local finishedWine = false + +local grapeLocations = { + [1] = vector3(-1875.41, 2100.37, 138.86), + [2] = vector3(-1908.69, 2107.48, 131.31), + [3] = vector3(-1866.04, 2112.64, 134.41), + [4] = vector3(-1907.76, 2125.35, 124.03), + [5] = vector3(-1850.31, 2142.95, 122.30), + [6] = vector3(-1888.22, 2164.51, 114.81), + [7] = vector3(-1835.52, 2180.59, 104.88), + [8] = vector3(-1891.98, 2208.35, 94.56), + [9] = vector3(-1720.37, 2182.03, 106.18), + [10] = vector3(-1808.52, 2173.14, 107.63), + [11] = vector3(-1784.22, 2222.80, 92.86), + [12] = vector3(-1889.13, 2250.05, 79.63), + [13] = vector3(-1861.16, 2254.32, 81.04), + [14] = vector3(-1886.75, 2272.45, 70.81), + [15] = vector3(-1845.49, 2274.63, 73.33), + [16] = vector3(-1687.28, 2195.76, 97.87), + [17] = vector3(-1741.18, 2173.22, 114.39), + [18] = vector3(-1743.17, 2141.11, 121.18), + [19] = vector3(-1813.84, 2089.57, 134.21), + [20] = vector3(-1698.71, 2150.65, 110.41), +} + +local function log(debugMessage) + print(('^6[^3qb-vineyard^6]^0 %s'):format(debugMessage)) +end + +local function CreateBlip() + if tasking then + blip = AddBlipForCoord(grapeLocations[random].x,grapeLocations[random].y,grapeLocations[random].z) + end + SetBlipSprite(blip, 465) + SetBlipScale(blip, 1.0) + SetBlipAsShortRange(blip, false) + BeginTextCommandSetBlipName("STRING") + AddTextComponentString("Drop Off") + EndTextCommandSetBlipName(blip) +end + +local function nextTask() + if tasking then + return + end + random = math.random(#grapeLocations) + tasking = true + CreateBlip() +end + +local function startVinyard() + local amount = math.random(Config.PickAmount.min, Config.PickAmount.max) + QBCore.Functions.Notify(Lang:t("text.start_shift")) + while startVineyard do + if tasking then + Wait(5000) + else + nextTask() + pickedGrapes = pickedGrapes + 1 + if pickedGrapes == amount then + nextTask() + Wait(20000) + startVineyard = false + pickedGrapes = 0 + QBCore.Functions.Notify(Lang:t("text.end_shift")) + end + end + Wait(5) + end +end + +local function DeleteBlip() + if DoesBlipExist(blip) then + RemoveBlip(blip) + end +end + +local function pickProcess() + QBCore.Functions.Progressbar("pick_grape", Lang:t("progress.pick_grapes"), math.random(6000,8000), false, true, { + disableMovement = true, + disableCarMovement = true, + disableMouse = false, + disableCombat = true, + }, {}, {}, {}, function() -- Done + tasking = false + TriggerServerEvent("qb-vineyard:server:getGrapes") + DeleteBlip() + ClearPedTasks(PlayerPedId()) + end, function() -- Cancel + ClearPedTasks(PlayerPedId()) + QBCore.Functions.Notify(Lang:t("task.cancel_task"), "error") + end) +end + +local function LoadAnim(dict) + while not HasAnimDictLoaded(dict) do + RequestAnimDict(dict) + Wait(1) + end +end + +local function PickAnim() + local ped = PlayerPedId() + LoadAnim('amb@prop_human_bum_bin@idle_a') + TaskPlayAnim(ped, 'amb@prop_human_bum_bin@idle_a', 'idle_a', 6.0, -6.0, -1, 47, 0, 0, 0, 0) +end + +local grapeZones = {} +for k=1, #grapeLocations do + local label = ("GrapeZone-%s"):format(k) + grapeZones[k] = { + isInside = false, + zone = BoxZone:Create(grapeLocations[k], 1.75, 3, { + name=label, + minZ = grapeLocations[k].z-1.0, + maxZ = grapeLocations[k].z+1.0, + debugPoly=Config.Debug, + }) + } + grapeZones[k].zone:onPlayerInOut(function(isPointInside) + grapeZones[k].isInside = isPointInside + if grapeZones[k].isInside then + if Config.Debug then + log(Lang:t("text.zone_entered",{zone=label})) + if k == random then log(Lang:t("text.valid_zone")) else log(Lang:t("text.invalid_zone")) end + end + + if k==random then + CreateThread(function() + while grapeZones[k].isInside and k==random do + exports['qb-core']:DrawText(Lang:t("task.start_task"),'right') + if not IsPedInAnyVehicle(PlayerPedId()) and IsControlJustReleased(0,38) then + PickAnim() + pickProcess() + exports['qb-core']:HideText() + random = 0 + end + Wait(1) + end + end) + end + else + if Config.Debug then log(Lang:t("text.zone_exited",{zone=label})) end + exports['qb-core']:HideText() + end + end) +end + +local function StartWineProcess() + CreateThread(function() + wineStarted = true + while winetimer > 0 do + winetimer = winetimer - 1 + Wait(1000) + end + wineStarted = false + finishedWine = true + winetimer = Config.wineTimer + end) +end + + +local function PrepareAnim() + local ped = PlayerPedId() + LoadAnim('amb@code_human_wander_rain@male_a@base') + TaskPlayAnim(ped, 'amb@code_human_wander_rain@male_a@base', 'static', 6.0, -6.0, -1, 47, 0, 0, 0, 0) +end + +local function grapeJuiceProcess() + QBCore.Functions.Progressbar("grape_juice", Lang:t("progress.process_grapes"), math.random(15000,20000), false, true, { + disableMovement = true, + disableCarMovement = true, + disableMouse = false, + disableCombat = true, + }, {}, {}, {}, function() -- Done + TriggerServerEvent("qb-vineyard:server:receiveGrapeJuice") + ClearPedTasks(PlayerPedId()) + end, function() -- Cancel + ClearPedTasks(PlayerPedId()) + QBCore.Functions.Notify(Lang:t("task.cancel_task"), "error") + end) +end + +local Zones = {} +Zones[1] = { + isInside = false, + zone = PolyZone:Create(Config.Vineyard.start.zones, { + name="Vineyard-Start", + minZ = Config.Vineyard.start.minZ, + maxZ = Config.Vineyard.start.maxZ, + debugPoly = Config.Debug + }) +} +Zones[1].zone:onPlayerInOut(function(isPointInside) + Zones[1].isInside = isPointInside + if isPointInside then + if Config.Debug then log(Lang:t("text.zone_entered",{zone="Start"})) end + if not startVineyard and PlayerJob.name == "vineyard" then + exports['qb-core']:DrawText(Lang:t("task.start_task"),'right') + CreateThread(function() + while Zones[1].isInside do + if IsControlJustReleased(0,38) and not startVineyard then + startVineyard = true + startVinyard() + end + Wait(1) + end + end) + + end + else + if Config.Debug then log(Lang:t("text.zone_exited",{zone="Start"})) end + exports['qb-core']:HideText() + end +end) + +Zones[2] = { + isInside = false, + zone = PolyZone:Create(Config.Vineyard.wine.zones, { + name="Vineyard-Wine", + minZ = Config.Vineyard.wine.minZ, + maxZ = Config.Vineyard.wine.maxZ, + debugPoly = Config.Debug + }) +} +Zones[2].zone:onPlayerInOut(function(isPointInside) + Zones[2].isInside = isPointInside + if isPointInside then + if Config.Debug then log(Lang:t("text.zone_entered",{zone="Wine"})) end + + if not startVineyard and PlayerJob.name == "vineyard" then + CreateThread(function() + while Zones[2].isInside do + if not wineStarted then + if not loadIngredients then + exports['qb-core']:DrawText(Lang:t("task.load_ingrediants"),'right') + if IsControlJustPressed(0, 38) and not LocalPlayer.state.inv_busy then + QBCore.Functions.TriggerCallback('qb-vineyard:server:loadIngredients', function(result) + if result then loadIngredients = true end + end) + + end + else + if not finishedWine then + exports['qb-core']:DrawText(Lang:t("task.wine_process"),'right') + if IsControlJustPressed(0, 38) and not LocalPlayer.state.inv_busy then + StartWineProcess() + end + else + exports['qb-core']:DrawText(Lang:t("task.get_wine"),'right') + if IsControlJustPressed(0, 38) and not LocalPlayer.state.inv_busy then + TriggerServerEvent("qb-vineyard:server:receiveWine") + finishedWine = false + loadIngredients = false + wineStarted = false + end + end + end + else + exports['qb-core']:DrawText(Lang:t("task.countdown",{time=winetimer}),'right') + Wait(999) + end + Wait(1) + end + end) + + end + else + if Config.Debug then log(Lang:t("text.zone_exited",{zone="Wine"})) end + exports['qb-core']:HideText() + end +end) + +Zones[3] = { + isInside = false, + zone = PolyZone:Create(Config.Vineyard.grapejuice.zones, { + name="Vineyard-GrapeJuice", + minZ = Config.Vineyard.grapejuice.minZ, + maxZ = Config.Vineyard.grapejuice.maxZ, + debugPoly = Config.Debug + }) +} +Zones[3].zone:onPlayerInOut(function(isPointInside) + Zones[3].isInside = isPointInside + if isPointInside then + if Config.Debug then log(Lang:t("text.zone_entered",{zone="Juice"})) end + if not startVineyard and PlayerJob.name == "vineyard" then + CreateThread(function() + while Zones[3].isInside do + exports['qb-core']:DrawText(Lang:t("task.make_grape_juice"),'right') + if IsControlJustPressed(0, 38) and not LocalPlayer.state.inv_busy then + QBCore.Functions.TriggerCallback('qb-vineyard:server:grapeJuice', function(result) + if result then PrepareAnim() grapeJuiceProcess() end + end) + end + Wait(1) + end + end) + end + else + if Config.Debug then log(Lang:t("text.zone_exited",{zone="Juice"})) end + exports['qb-core']:HideText() + end +end) \ No newline at end of file diff --git a/[qb]/qb-vineyard/config.lua b/[qb]/qb-vineyard/config.lua new file mode 100644 index 0000000..232fbef --- /dev/null +++ b/[qb]/qb-vineyard/config.lua @@ -0,0 +1,44 @@ +Config = { + Debug = false, + PickAmount = {min = 8, max = 12}, + GrapeAmount = {min = 8, max = 12}, + GrapeJuiceAmount = {min = 6, max = 10}, + WineAmount = {min = 6, max = 10}, + wineTimer = 180, + Vineyard = { + start ={ + coords = vector3(-1928.81, 2059.53, 140.84), + zones = { + vector2(-1926.19, 2059.13), + vector2(-1925.46, 2062.16), + vector2(-1930.47, 2063.81), + vector2(-1931.35, 2060.37), + }, + minZ=140.24, + maxZ=141.44 + }, + wine ={ + coords = vector3(-1879.54, 2062.55, 135.92), + zones = { + vector2(-1873.85, 2063.01), + vector2(-1876.35, 2059.48), + vector2(-1883.02, 2062.11), + vector2(-1882.03, 2064.85), + vector2(-1880.51, 2065.44) + }, + minZ=135.42, + maxZ=136.42 + }, + grapejuice = { + coords = vector3(828.76, 2191.16, 52.37), + zones = { + vector2(830.91, 2194.49), + vector2(827.81, 2196.07), + vector2(824.6, 2189.71), + vector2(827.54, 2188.28), + }, + minZ=51.85, + maxZ=52.74 + } + } +} \ No newline at end of file diff --git a/[qb]/qb-vineyard/fxmanifest.lua b/[qb]/qb-vineyard/fxmanifest.lua new file mode 100644 index 0000000..96dead9 --- /dev/null +++ b/[qb]/qb-vineyard/fxmanifest.lua @@ -0,0 +1,27 @@ +fx_version 'cerulean' +game 'gta5' + +description 'QB-Vineyard' +version '1.2.0' + +shared_scripts { + '@qb-core/shared/locale.lua', + 'locales/en.lua', + 'locales/*.lua', + 'config.lua' +} + +server_script 'server.lua' + +client_scripts { + '@PolyZone/client.lua', + '@PolyZone/BoxZone.lua', + 'client.lua' +} + +dependencies { + 'qb-core', + 'PolyZone' +} + +lua54 'yes' diff --git a/[qb]/qb-vineyard/locales/de.lua b/[qb]/qb-vineyard/locales/de.lua new file mode 100644 index 0000000..8071f53 --- /dev/null +++ b/[qb]/qb-vineyard/locales/de.lua @@ -0,0 +1,28 @@ +local Translations = { + error = { + ["invalid_job"] = "Ich denke ich Arbeite hier nicht...", + ["invalid_items"] = "Du hast nicht die korrekten Gegenstände!", + ["no_items"] = "Du hast keine Gegenstände!", + }, + progress = { + ["pick_grapes"] = "Sammle Weintrauben ..", + ["process_grapes"] = "Verarbeite Weintrauben ..", + }, + task = { + ["start_task"] = "[E] zum Starten", + ["load_ingrediants"] = "[E] Zutaten Laden", + ["wine_process"] = "[E] Starte den Wein Prozess", + ["get_wine"] = "[E] Wein Holen", + ["make_grape_juice"] = "[E] Mache Wein Saft", + ["countdown"] = "Zeit übrig %{time}", + ['cancel_task'] = "Du hast deine Aufgabe Abgebrochen" + } +} + +if GetConvar('qb_locale', 'en') == 'de' then + Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true, + fallbackLang = Lang, + }) +end diff --git a/[qb]/qb-vineyard/locales/en.lua b/[qb]/qb-vineyard/locales/en.lua new file mode 100644 index 0000000..60bcc76 --- /dev/null +++ b/[qb]/qb-vineyard/locales/en.lua @@ -0,0 +1,33 @@ +local Translations = { + error = { + ["invalid_job"] = "I dont think I work here...", + ["invalid_items"] = "You do not have the correct items!", + ["no_items"] = "You do not have any items!", + }, + progress = { + ["pick_grapes"] = "Picking Grapes ..", + ["process_grapes"] = "Processing Grapes ..", + }, + task = { + ["start_task"] = "[E] To Start", + ["load_ingrediants"] = "[E] Load Ingredients", + ["wine_process"] = "[E] Start WineProcess", + ["get_wine"] = "[E] Get Wine", + ["make_grape_juice"] = "[E] Make Grape Juice", + ["countdown"] = "Time Remaining %{time}s", + ['cancel_task'] = "You have cancelled the task" + }, + text = { + ["start_shift"] = "You have started your shift at the vineyard!", + ["end_shift"] = "Your shift at the vineyard has ended!", + ["valid_zone"] = "Valid Zone!", + ["invalid_zone"] = "Invalid Zone!", + ["zone_entered"] = "%{zone} Zone Entered", + ["zone_exited"] = "%{zone} Zone Exited", + } +} + +Lang = Lang or Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-vineyard/locales/es.lua b/[qb]/qb-vineyard/locales/es.lua new file mode 100644 index 0000000..b0afa35 --- /dev/null +++ b/[qb]/qb-vineyard/locales/es.lua @@ -0,0 +1,36 @@ +local Translations = { + error = { + ["invalid_job"] = "No creo que trabaje aquí...", + ["invalid_items"] = "¡No tienes el item correcto!", + ["no_items"] = "No tienes ningun item", + }, + progress = { + ["pick_grapes"] = "Recogiendo uvas..", + ["process_grapes"] = "Procesando uvas.. ..", + }, + task = { + ["start_task"] = "[E] Para empezar", + ["load_ingrediants"] = "[E] Cargar Ingredientes", + ["wine_process"] = "[E] Comenzar la elaboracion del vino", + ["get_wine"] = "[E] Obtener Vino", + ["make_grape_juice"] = "[E] Hacer zumo de uva (Mosto)", + ["countdown"] = "Tiempo restante %{time}s", + ['cancel_task'] = "Has cancelado la tarea" + }, + text = { + ["start_shift"] = "¡Has comenzado tu turno en el viñedo!", + ["end_shift"] = "¡Has finalizado tu turno en el viñedo!", + ["valid_zone"] = "Zona Valida!", + ["invalid_zone"] = "Zona NO Valida!", + ["zone_entered"] = "%{zone} Entrando en zona", + ["zone_exited"] = "%{zone} Saliendo de zona", + } +} + +if GetConvar('qb_locale', 'en') == 'es' then + Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true, + fallbackLang = Lang, + }) +end diff --git a/[qb]/qb-vineyard/locales/fi.lua b/[qb]/qb-vineyard/locales/fi.lua new file mode 100644 index 0000000..645eeb6 --- /dev/null +++ b/[qb]/qb-vineyard/locales/fi.lua @@ -0,0 +1,28 @@ +local Translations = { + error = { + ["invalid_job"] = "Et taida olla töissä täällä...", + ["invalid_items"] = "Sinulla ei ole oikeita esineitä!", + ["no_items"] = "Sinulla ei ole esineitä!", + }, + progress = { + ["pick_grapes"] = "Kerätään rypäleitä ..", + ["process_grapes"] = "Prosessoidaan rypäleitä ..", + }, + task = { + ["start_task"] = "Paina [E] aloittaaksesi", + ["load_ingrediants"] = "[E] Lastaa ainesosat", + ["wine_process"] = "[E] Aloita viininteko", + ["get_wine"] = "[E] Tee viiniä", + ["make_grape_juice"] = "[E] Tee rypälemehua", + ["countdown"] = "Aikaa jäljellä %{time}s", + ['cancel_task'] = "Olet peruuttanut tehtävän!" + } +} + +if GetConvar('qb_locale', 'en') == 'fi' then + Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true, + fallbackLang = Lang, + }) +end diff --git a/[qb]/qb-vineyard/locales/fr.lua b/[qb]/qb-vineyard/locales/fr.lua new file mode 100644 index 0000000..a064c5f --- /dev/null +++ b/[qb]/qb-vineyard/locales/fr.lua @@ -0,0 +1,36 @@ +local Translations = { + error = { + ["invalid_job"] = "Je ne pense pas que je travaille ici...", + ["invalid_items"] = "Vous n'avez pas les bons items !", + ["no_items"] = "Vous n'avez aucun item !", + }, + progress = { + ["pick_grapes"] = "Vendange...", + ["process_grapes"] = "Traitement des raisins...", + }, + task = { + ["start_task"] = "[E] pour Démarrer", + ["load_ingrediants"] = "[E] Chargement des ingredients", + ["wine_process"] = "[E] Démarrage du traitement du vin", + ["get_wine"] = "[E] Récupérer vin", + ["make_grape_juice"] = "[E] Faire du jus de raisin", + ["countdown"] = "Temps restant %{time}s", + ['cancel_task'] = "Vous avez annulé la tâche" + }, + text = { + ["start_shift"] = "Vous avez commencé votre shift au vignoble !", + ["end_shift"] = "Votre shift au vignoble est fini !", + ["valid_zone"] = "Zone Valide !", + ["invalid_zone"] = "Zone Invalide!", + ["zone_entered"] = "%{zone} Entrée de zone", + ["zone_exited"] = "%{zone} Sortie de zone", + } +} + +if GetConvar('qb_locale', 'en') == 'fr' then + Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true, + fallbackLang = Lang + }) +end diff --git a/[qb]/qb-vineyard/locales/ge.lua b/[qb]/qb-vineyard/locales/ge.lua new file mode 100644 index 0000000..f536c56 --- /dev/null +++ b/[qb]/qb-vineyard/locales/ge.lua @@ -0,0 +1,28 @@ +local Translations = { + error = { + ["invalid_job"] = "არამგონია აქ ვიმუშაო...", + ["invalid_items"] = "თქვენ არ გაქვთ სწორი ნივთები!", + ["no_items"] = "თქვენ არ გაქვთ რაიმე ნივთი!", + }, + progress = { + ["pick_grapes"] = "ყურძნის კრეფა ..", + ["process_grapes"] = "ყურძნის გადამუშავება..", + }, + task = { + ["start_task"] = "[E] Დაწყება", + ["load_ingrediants"] = "[E] ჩატვირთეთ ინგრედიენტები", + ["wine_process"] = "[E] დაიწყეთ ღვინის პროცესი", + ["get_wine"] = "[E] მიიღეთ ღვინო", + ["make_grape_juice"] = "[E] მოამზადეთ ყურძნის წვენი", + ["countdown"] = "Დარჩენილი დრო %{time}s", + ['cancel_task'] = "თქვენ გააუქმეთ დავალება" + } +} + +if GetConvar('qb_locale', 'en') == 'ge' then + Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true, + fallbackLang = Lang, + }) +end diff --git a/[qb]/qb-vineyard/locales/it.lua b/[qb]/qb-vineyard/locales/it.lua new file mode 100644 index 0000000..f1c4278 --- /dev/null +++ b/[qb]/qb-vineyard/locales/it.lua @@ -0,0 +1,28 @@ +local Translations = { + error = { + ["invalid_job"] = "Non penso di lavorare qui...", + ["invalid_items"] = "Non hai gli oggetti corretti!", + ["no_items"] = "Non hai nessun oggetto!", + }, + progress = { + ["pick_grapes"] = "Raccogliendo l'uva ..", + ["process_grapes"] = "Lavorando l'uva ..", + }, + task = { + ["start_task"] = "[E] Per Cominciare", + ["load_ingrediants"] = "[E] Inserisci Ingredienti", + ["wine_process"] = "[E] Avvia lavorazione vino", + ["get_wine"] = "[E] Prendi il vino", + ["make_grape_juice"] = "[E] Fai succo d'uva", + ["countdown"] = "Tempo rimasto %{time}s", + ['cancel_task'] = "Hai cancellato il compito" + } +} + +if GetConvar('qb_locale', 'en') == 'it' then + Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true, + fallbackLang = Lang, + }) +end diff --git a/[qb]/qb-vineyard/locales/nl.lua b/[qb]/qb-vineyard/locales/nl.lua new file mode 100644 index 0000000..fbedf21 --- /dev/null +++ b/[qb]/qb-vineyard/locales/nl.lua @@ -0,0 +1,36 @@ +local Translations = { + error = { + ["invalid_job"] = "Ik denk niet dat ik hier werk...", + ["invalid_items"] = "Je hebt niet de juiste items!", + ["no_items"] = "Je hebt geen items!", + }, + progress = { + ["pick_grapes"] = "Druiven plukken ..", + ["process_grapes"] = "Druiven Verwerken ..", + }, + task = { + ["start_task"] = "[E] Beginnen", + ["load_ingrediants"] = "[E] Ingrediënten laden", + ["wine_process"] = "[E] Wijnproces Starten", + ["get_wine"] = "[E] Pak Wijn", + ["make_grape_juice"] = "[E] Druivensap maken", + ["countdown"] = "Resterende tijd %{time}s", + ['cancel_task'] = "Je hebt de taak geannuleerd" + }, + text = { + ["start_shift"] = "Je bent begonnen met je dienst in de wijngaard!", + ["end_shift"] = "Je dienst bij de wijngaard zit erop!", + ["valid_zone"] = "Geldige Zone!", + ["invalid_zone"] = "Ongeldige Zone!", + ["zone_entered"] = "%{zone} Zone Ingelopen", + ["zone_exited"] = "%{zone} Zone Verlaten", + } +} + +if GetConvar('qb_locale', 'en') == 'nl' then + Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true, + fallbackLang = Lang, + }) +end diff --git a/[qb]/qb-vineyard/locales/pt.lua b/[qb]/qb-vineyard/locales/pt.lua new file mode 100644 index 0000000..a49e823 --- /dev/null +++ b/[qb]/qb-vineyard/locales/pt.lua @@ -0,0 +1,36 @@ +local Translations = { + error = { + ["invalid_job"] = "Acho que não trabalho aqui..", + ["invalid_items"] = "Não tens os items corretos!", + ["no_items"] = "Não tens os items necessários!", + }, + progress = { + ["pick_grapes"] = "A Apanhar Uvas..", + ["process_grapes"] = "A Processar Uvas..", + }, + task = { + ["start_task"] = "[E] Para Começar", + ["load_ingrediants"] = "[E] Preparar Ingredientes", + ["wine_process"] = "[E] Começar Processo Do Vinho", + ["get_wine"] = "[E] Obter Vinho", + ["make_grape_juice"] = "[E] Fazer Sumo De Uva", + ["countdown"] = "Tempo Restante %{time}s", + ['cancel_task'] = "Cancelaste a tarefa" + }, + text = { + ["start_shift"] = "O teu turno nas vinhas começou!", + ["end_shift"] = "O teu turno nas vinhas terminou!", + ["valid_zone"] = "Zona Válida!", + ["invalid_zone"] = "Zona Inválida!", + ["zone_entered"] = "Entraste Na Zona %{zone}", + ["zone_exited"] = "Saíste Da Zona %{zone}", + } +} + +if GetConvar('qb_locale', 'en') == 'pt' then + Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true, + fallbackLang = Lang, + }) +end diff --git a/[qb]/qb-vineyard/locales/sv.lua b/[qb]/qb-vineyard/locales/sv.lua new file mode 100644 index 0000000..5c02053 --- /dev/null +++ b/[qb]/qb-vineyard/locales/sv.lua @@ -0,0 +1,28 @@ +local Translations = { + error = { + ["invalid_job"] = "Jag tror inte att du jobbar här...", + ["invalid_items"] = "Du har inte rätt prylar!", + ["no_items"] = "Du har inga prylar!", + }, + progress = { + ["pick_grapes"] = "Plockar vindruvor..", + ["process_grapes"] = "Proccesserar vindruvor..", + }, + task = { + ["start_task"] = "[E] För att starta", + ["load_ingrediants"] = "[E] Blanda i ingredienser", + ["wine_process"] = "[E] Starta jäsningsprocessen", + ["get_wine"] = "[E] Ta vinet", + ["make_grape_juice"] = "[E] Göra druvjuice", + ["countdown"] = "Tid kvar: %{time}s", + ['cancel_task'] = "Du avbröt en uppgift" + } +} + +if GetConvar('qb_locale', 'en') == 'sv' then + Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true, + fallbackLang = Lang, + }) +end diff --git a/[qb]/qb-vineyard/locales/tr.lua b/[qb]/qb-vineyard/locales/tr.lua new file mode 100644 index 0000000..4ad4f83 --- /dev/null +++ b/[qb]/qb-vineyard/locales/tr.lua @@ -0,0 +1,36 @@ +local Translations = { + error = { + ["invalid_job"] = "Burada çalıştığımı sanmıyorum...", + ["invalid_items"] = "Doğru itemlere sahip değilsin!", + ["no_items"] = "Herhangi bir iteminiz yok!", + }, + progress = { + ["pick_grapes"] = "Üzüm toplanıyor ..", + ["process_grapes"] = "Üzüm İşleniyor ..", + }, + task = { + ["start_task"] = "[E] Başla", + ["load_ingrediants"] = "[E] Malzemeleri Yükle", + ["wine_process"] = "[E] Şarap İşlemeye Başla", + ["get_wine"] = "[E] Şarap Al", + ["make_grape_juice"] = "[E] Üzüm Suyu Yap", + ["countdown"] = "Kalan süre %{time}s", + ['cancel_task'] = "Görevi iptal ettiniz" + }, + text = { + ["start_shift"] = "Bağda mesaiye başladın!", + ["end_shift"] = "Bağdaki vardiyanız sona erdi!", + ["valid_zone"] = "Geçerli Bölge!", + ["invalid_zone"] = "Geçersiz Bölge!", + ["zone_entered"] = "%{zone} Bölgesine Girildi", + ["zone_exited"] = "%{zone} Bölgesinden Çıkıldı", + } +} + +if GetConvar('qb_locale', 'en') == 'tr' then + Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true, + fallbackLang = Lang, + }) +end diff --git a/[qb]/qb-vineyard/server.lua b/[qb]/qb-vineyard/server.lua new file mode 100644 index 0000000..1d387dc --- /dev/null +++ b/[qb]/qb-vineyard/server.lua @@ -0,0 +1,70 @@ +local QBCore = exports['qb-core']:GetCoreObject() + +RegisterNetEvent('qb-vineyard:server:getGrapes', function() + local Player = QBCore.Functions.GetPlayer(source) + local amount = math.random(Config.GrapeAmount.min, Config.GrapeAmount.max) + Player.Functions.AddItem("grape", amount) + TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['grape'], "add") +end) + +QBCore.Functions.CreateCallback('qb-vineyard:server:loadIngredients', function(source, cb) + local src = source + local Player = QBCore.Functions.GetPlayer(src) + local grape = Player.Functions.GetItemByName('grapejuice') + if Player.PlayerData.items ~= nil then + if grape ~= nil then + if grape.amount >= 23 then + Player.Functions.RemoveItem("grapejuice", 23, false) + TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['grapejuice'], "remove") + cb(true) + else + TriggerClientEvent('QBCore:Notify', source, Lang:t("error.invalid_items"), 'error') + cb(false) + end + else + TriggerClientEvent('QBCore:Notify', source, Lang:t("error.invalid_items"), 'error') + cb(false) + end + else + TriggerClientEvent('QBCore:Notify', source, Lang:t("error.no_items"), "error") + cb(false) + end +end) + +QBCore.Functions.CreateCallback('qb-vineyard:server:grapeJuice', function(source, cb) + local src = source + local Player = QBCore.Functions.GetPlayer(src) + local grape = Player.Functions.GetItemByName('grape') + if Player.PlayerData.items ~= nil then + if grape ~= nil then + if grape.amount >= 16 then + Player.Functions.RemoveItem("grape", 16, false) + TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['grape'], "remove") + cb(true) + else + TriggerClientEvent('QBCore:Notify', source, Lang:t("error.invalid_items"), 'error') + cb(false) + end + else + TriggerClientEvent('QBCore:Notify', source, Lang:t("error.invalid_items"), 'error') + cb(false) + end + else + TriggerClientEvent('QBCore:Notify', source, Lang:t("error.no_items"), "error") + cb(false) + end +end) + +RegisterNetEvent('qb-vineyard:server:receiveWine', function() + local Player = QBCore.Functions.GetPlayer(tonumber(source)) + local amount = math.random(Config.WineAmount.min, Config.WineAmount.max) + Player.Functions.AddItem("wine", amount, false) + TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['wine'], "add") +end) + +RegisterNetEvent('qb-vineyard:server:receiveGrapeJuice', function() + local Player = QBCore.Functions.GetPlayer(tonumber(source)) + local amount = math.random(Config.GrapeJuiceAmount.min, Config.GrapeJuiceAmount.max) + Player.Functions.AddItem("grapejuice", amount, false) + TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['grapejuice'], "add") +end) diff --git a/[qb]/qb-weapons/.github/ISSUE_TEMPLATE/bug_report.md b/[qb]/qb-weapons/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..62f702f --- /dev/null +++ b/[qb]/qb-weapons/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,32 @@ +--- +name: Bug report +about: Create a report to help us improve or fix something +title: "[BUG]" +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. A stranger to qbcore should be able to read your bug report and understand how to reproduce it themselves and understand how the feature should work normally. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Use this item '....' (item's name from shared.lua if applicable) +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Questions (please complete the following information):** + - When you last updated: [e.g. last week] + - Are you using custom resource? which ones? [e.g. zdiscord, qb-target] + - Have you renamed `qb-` to something custom? [e.g. yes/no] + +**Additional context** +Add any other context about the problem here. diff --git a/[qb]/qb-weapons/.github/ISSUE_TEMPLATE/feature-request.md b/[qb]/qb-weapons/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000..9e9bf3e --- /dev/null +++ b/[qb]/qb-weapons/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,20 @@ +--- +name: Feature Request +about: Suggest an idea for QBCore +title: "[SUGGESTION]" +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. + +**Describe the feature you'd like** +A clear and concise description of what you want to happen. and with as much detail as possible how it would function in your opinion. Please try to keep it unique. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered for people to have in mind just in case the main idea isn't liked but a derivative is. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/[qb]/qb-weapons/.github/auto_assign.yml b/[qb]/qb-weapons/.github/auto_assign.yml new file mode 100644 index 0000000..2a80921 --- /dev/null +++ b/[qb]/qb-weapons/.github/auto_assign.yml @@ -0,0 +1,17 @@ +# Set to true to add reviewers to pull requests +addReviewers: true + +# Set to true to add assignees to pull requests +addAssignees: author + +# A list of reviewers to be added to pull requests (GitHub user name) +reviewers: + - /maintenance + +# A list of keywords to be skipped the process that add reviewers if pull requests include it +skipKeywords: + - wip + +# A number of reviewers added to the pull request +# Set 0 to add all the reviewers (default: 0) +numberOfReviewers: 0 \ No newline at end of file diff --git a/[qb]/qb-weapons/.github/contributing.md b/[qb]/qb-weapons/.github/contributing.md new file mode 100644 index 0000000..21fb806 --- /dev/null +++ b/[qb]/qb-weapons/.github/contributing.md @@ -0,0 +1,201 @@ +# Contributing to QBCore + +First of all, thank you for taking the time to contribute! + +These guidelines will help you help us in the best way possible regardless of your skill level. We ask that you try to read everything related to the way you'd like to contribute and try and use your best judgement for anything not covered. + +### Table of Contents + +[Code of Conduct](#code-of-conduct) + +[I don't want to read this whole thing, I just have a question!!!](#i-dont-want-to-read-this-whole-thing-i-just-have-a-question) + +[How Can I Contribute?](#how-can-i-contribute) + * [Reporting Bugs](#reporting-bugs) + * [Suggesting Features / Enhancements](#suggesting-features--enhancements) + * [Your First Code Contribution](#your-first-code-contribution) + * [Pull Requests](#pull-requests) + +[Styleguides](#styleguides) + * [Git Commit Messages](#git-commit-messages) + * [Lua Styleguide](#lua-styleguide) + * [JavaScript Styleguide](#javascript-styleguide) + + + +## Code of Conduct + +- Refrain from using languages other than English. +- Refrain from discussing any politically charged or inflammatory topics. +- Uphold mature conversations and respect each other; excessive profanity, hate speech or any kind of harassment will not be tolerated. +- No advertising of any kind. +- Follow these guidelines. +- Do not mention members of github unless a question is directed at them and can't be answered by anyone else. +- Do not mention any of the development team for any reason. We will read things as we get to them. + +## I don't want to read this whole thing I just have a question!!! + +> **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below. + +* [QBCore Website](https://qbcore.org) +* [QBCore Discord](https://discord.gg/qbcore) +* [FiveM Discord - #qbcore channel](https://discord.gg/fivem) + + + + + + + + + + +## How Can I Contribute? + +### Reporting Bugs + +The easiest way to contribute for most people is just to report bugs you find cause if nobody reports it there's a chance we'll never know it exists and then we'll never fix it. + +Before creating bug reports, please check [this list](#before-submitting-a-bug-report) as you might find out that you don't need to create one. When you are creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out the bug-report template with the information it asks for helps us resolve issues faster. + +> **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one. + +#### Before Submitting A Bug Report + +* **Check the docs** There's a chance what you see as a bug might just work differently than you expect and if you think it could work better consider a feature enhancement report instead. +* **Search the [discord](https://discord.gg/qbcore)** to see if anyone else has run into the issue and see if it was solved through user error or code changes. (if the code change isn't pending a PR and you know what you're doing consider submitting one following [Pull Requests](#pull-requests) ) +* **Determine which resource the problem should be reported in**. If the bug is related to the inventory for example report this bug under qb-inventory rather than under qb-core or some other resource. +* **Perform a [cursory search](https://github.com/search?q=+is%3Aissue+user%3Aqbcore-framework)** to see if the problem has already been reported. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one. + +#### How Do I Submit A (Good) Bug Report? + +Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). After you've determined which resource your bug is related to, create an issue on that repository and provide the following information by filling in bug-report template. + +Explain the problem and include additional details to help maintainers reproduce the problem: + +* **Use a clear and descriptive title** for the issue to identify the problem. +* **Describe the exact steps which reproduce the problem** in as many details as possible. +* **Provide specific examples to demonstrate the steps**. If something happened with only a specific group or single item but not others, specify that. +* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior. +* **Explain which behavior you expected to see instead and why.** +* **Include screenshots** which show the specific bug in action or before and after. +* **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below. + +Provide more context by answering these questions if possible: + +* **Did the problem start happening recently** (e.g. after updating to a new version of QBCore?) or was this always a problem? +* If the problem started happening recently, **can you reproduce the problem in an older version of QBCore?** What's the most recent commit in which the problem doesn't happen? +* **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens. + +Include details about your setup: + +* **When was your QBCore last updated?** +* **What OS is the server running on**? +* **Which *extra* resources do you have installed?** + + +--- + + +### Suggesting Features / Enhancements + +This section guides you through submitting an enhancement suggestion for QBCore, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion. + +Before creating enhancement suggestions, please check [this list](#before-submitting-an-enhancement-suggestion) as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-enhancement-suggestion). Fill in feature request template, including the steps that you imagine you would take if the feature you're requesting existed. + +#### Before Submitting An Enhancement Suggestion + +* **Make sure it doesn't already exist.** Sounds silly, but there's a lot of features built in to qbcore that people don't realize so take a look through the docs and stuff to make sure it's not already there. +* **Check if there's already PR which provides that enhancement.** +* **Determine which resource the enhancement should be suggested in.** if it fits with another resource suggest it in that resource. if it would be it's own resource suggest it in the main qb-core repository. +* **Perform a [cursory search](https://github.com/search?q=+is%3Aissue+user%3Aqbcore-framework)** to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. + +#### How Do I Submit A (Good) Enhancement Suggestion? + +Enhancement suggestions are tracked as [GitHub issues](https://guides.github.com/features/issues/). After you've determined which resource your enhancement suggestion is related to, create an issue on that repository and provide the following information: + +* **Use a clear and descriptive title** for the issue to identify the suggestion. +* **Provide a step-by-step description of the suggested enhancement** in as many details as possible. +* **Provide specific examples to demonstrate the steps**. Include copy/pasteable snippets which you use in those examples, as [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines). +* **Describe the current behavior** and **explain which behavior you expected to see instead** and why. +* **Include screenshots and animated GIFs** which help you demonstrate the steps or point out the part of QBCore which the suggestion is related to. +* **Explain why this enhancement would be useful.** +* **Be creative and unique.** Stealing ideas from popular servers 1:1 detail isn't going to get accepted. + + +--- + + + +### Your First Code Contribution + +Unsure where to begin contributing to QBCore? You can start by looking through these `beginner` and `help-wanted` issues. + + + +--- + + +### Pull Requests + +The process described here has several goals: + +- Maintain QBCore's quality. +- Fix problems that are important to users. +- Engage the community in working toward the best possible QBCore. +- Enable a sustainable system for QBCore's maintainers to review contributions. + +Please follow these steps to have your contribution considered by the maintainers: + +1. Follow all instructions in The Pull Request template. +2. Follow the [styleguides](#styleguides). +3. Await review by the reviewer(s). + +While the prerequisites above must be satisfied prior to having your pull request reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted. + + +--- + +## Styleguides + +### Git Commit Messages + +* Limit the first line to 72 characters or less. +* Reference issues and pull requests liberally after the first line. +* Consider starting the commit message with an applicable emoji: + * :art: `:art:` when improving the format/structure of the code + * :racehorse: `:racehorse:` when improving performance + * :memo: `:memo:` when writing docs + * :bug: `:bug:` when fixing a bug + * :fire: `:fire:` when removing code or files + * :white_check_mark: `:white_check_mark:` when adding tests + * :lock: `:lock:` when dealing with security + * :arrow_up: `:arrow_up:` when upgrading dependencies + * :arrow_down: `:arrow_down:` when downgrading dependencies + * :shirt: `:shirt:` when removing linter warnings + +### Lua Styleguide + +All lua code should be done using all the best practices of proper lua using the easiest to read yet fastest/most optimized methods of execution. + +- Use 4 Space indentation +- Aim for lua 5.4 (include `lua54 'yes'` in the fxmanifest.lua) +- Use `PlayerPedId()` instead of `GetPlayerPed(-1)` +- Use `#(vector3 - vector3)` instead of `GetDistanceBetweenCoords()` +- Don't create unnecessary threads. always try to find a better method of triggering events +- Don't repeat yourself.. if you're using the same operations in many different places convert them into a function with flexible variables +- For distance checking loops set longer waits if you're outside of a range +- Job specific loops should only run for players with that job, don't waste cycles +- When possible don't trust the client, esspecially with transactions +- Balance security and optimizations +- [Consider this Lua Performance guide](https://springrts.com/wiki/Lua_Performance) +- Use local varriables everywhere possible +- Make use of config options where it makes sense making features optional or customizable +- Instead of `table.insert(myTable, "Value")` use `myTable[#myTable + 1] = "Value"` +- Instead of `table.insert(ages, "bob", 30)` use `ages["bob"] = 30` + + +### JavaScript Styleguide + +- Use 4 Space indentation +- Don't repeat yourself.. if you're using the same operations in many different places convert them into a function with flexible variables. diff --git a/[qb]/qb-weapons/.github/pull_request_template.md b/[qb]/qb-weapons/.github/pull_request_template.md new file mode 100644 index 0000000..000f0f9 --- /dev/null +++ b/[qb]/qb-weapons/.github/pull_request_template.md @@ -0,0 +1,10 @@ +**Describe Pull request** +First, make sure you've read and are following the contribution guidelines and style guide and your code reflects that. +Write up a clear and concise description of what your pull request adds or fixes and if it's an added feature explain why you think it should be included in the core. + +If your PR is to fix an issue mention that issue here + +**Questions (please complete the following information):** +- Have you personally loaded this code into an updated qbcore project and checked all it's functionality? [yes/no] (Be honest) +- Does your code fit the style guidelines? [yes/no] +- Does your PR fit the contribution guidelines? [yes/no] diff --git a/[qb]/qb-weapons/.github/workflows/lint.yml b/[qb]/qb-weapons/.github/workflows/lint.yml new file mode 100644 index 0000000..fb74fd6 --- /dev/null +++ b/[qb]/qb-weapons/.github/workflows/lint.yml @@ -0,0 +1,23 @@ +name: Lint +on: [push, pull_request_target] +jobs: + lint: + name: Lint Resource + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Lint + uses: iLLeniumStudios/fivem-lua-lint-action@v2 + with: + capture: "junit.xml" + args: "-t --formatter JUnit" + extra_libs: mysql+polyzone+qblocales + - name: Generate Lint Report + if: always() + uses: mikepenz/action-junit-report@v3 + with: + report_paths: "**/junit.xml" + check_name: Linting Report + fail_on_failure: false \ No newline at end of file diff --git a/[qb]/qb-weapons/LICENSE b/[qb]/qb-weapons/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/[qb]/qb-weapons/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/[qb]/qb-weapons/README.md b/[qb]/qb-weapons/README.md new file mode 100644 index 0000000..abd8e70 --- /dev/null +++ b/[qb]/qb-weapons/README.md @@ -0,0 +1,20 @@ +# qb-weapons +Weapon Logic Script For QB-Core + +# License + + QBCore Framework + Copyright (C) 2021 Joshua Eger + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see diff --git a/[qb]/qb-weapons/client/main.lua b/[qb]/qb-weapons/client/main.lua new file mode 100644 index 0000000..9d3a0a3 --- /dev/null +++ b/[qb]/qb-weapons/client/main.lua @@ -0,0 +1,246 @@ +-- Variables +local QBCore = exports['qb-core']:GetCoreObject() +local PlayerData = QBCore.Functions.GetPlayerData() +local CurrentWeaponData, CanShoot, MultiplierAmount = {}, true, 0 + +-- Handlers + +AddEventHandler('QBCore:Client:OnPlayerLoaded', function() + PlayerData = QBCore.Functions.GetPlayerData() + QBCore.Functions.TriggerCallback("weapons:server:GetConfig", function(RepairPoints) + for k, data in pairs(RepairPoints) do + Config.WeaponRepairPoints[k].IsRepairing = data.IsRepairing + Config.WeaponRepairPoints[k].RepairingData = data.RepairingData + end + end) +end) + +RegisterNetEvent('QBCore:Client:OnPlayerUnload', function() + for k in pairs(Config.WeaponRepairPoints) do + Config.WeaponRepairPoints[k].IsRepairing = false + Config.WeaponRepairPoints[k].RepairingData = {} + end +end) + +-- Functions + +local function DrawText3Ds(x, y, z, text) + SetTextScale(0.35, 0.35) + SetTextFont(4) + SetTextProportional(1) + SetTextColour(255, 255, 255, 215) + SetTextEntry("STRING") + SetTextCentre(true) + AddTextComponentString(text) + SetDrawOrigin(x,y,z, 0) + DrawText(0.0, 0.0) + local factor = (string.len(text)) / 370 + DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75) + ClearDrawOrigin() +end + +-- Events + +RegisterNetEvent("weapons:client:SyncRepairShops", function(NewData, key) + Config.WeaponRepairPoints[key].IsRepairing = NewData.IsRepairing + Config.WeaponRepairPoints[key].RepairingData = NewData.RepairingData +end) + +RegisterNetEvent("addAttachment", function(component) + local ped = PlayerPedId() + local weapon = GetSelectedPedWeapon(ped) + local WeaponData = QBCore.Shared.Weapons[weapon] + GiveWeaponComponentToPed(ped, GetHashKey(WeaponData.name), GetHashKey(component)) +end) + +RegisterNetEvent('weapons:client:EquipTint', function(tint) + local player = PlayerPedId() + local weapon = GetSelectedPedWeapon(player) + SetPedWeaponTintIndex(player, weapon, tint) +end) + +RegisterNetEvent('weapons:client:SetCurrentWeapon', function(data, bool) + if data ~= false then + CurrentWeaponData = data + else + CurrentWeaponData = {} + end + CanShoot = bool +end) + +RegisterNetEvent('weapons:client:SetWeaponQuality', function(amount) + if CurrentWeaponData and next(CurrentWeaponData) then + TriggerServerEvent("weapons:server:SetWeaponQuality", CurrentWeaponData, amount) + end +end) + +RegisterNetEvent('weapons:client:AddAmmo', function(type, amount, itemData) + local ped = PlayerPedId() + local weapon = GetSelectedPedWeapon(ped) + if CurrentWeaponData then + if QBCore.Shared.Weapons[weapon]["name"] ~= "weapon_unarmed" and QBCore.Shared.Weapons[weapon]["ammotype"] == type:upper() then + local total = GetAmmoInPedWeapon(ped, weapon) + local _, maxAmmo = GetMaxAmmo(ped, weapon) + if total < maxAmmo then + QBCore.Functions.Progressbar("taking_bullets", Lang:t('info.loading_bullets'), Config.ReloadTime, false, true, { + disableMovement = false, + disableCarMovement = false, + disableMouse = false, + disableCombat = true, + }, {}, {}, {}, function() -- Done + if QBCore.Shared.Weapons[weapon] then + AddAmmoToPed(ped,weapon,amount) + TaskReloadWeapon(ped) + TriggerServerEvent("weapons:server:UpdateWeaponAmmo", CurrentWeaponData, total + amount) + TriggerServerEvent('weapons:server:removeWeaponAmmoItem', itemData) + TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[itemData.name], "remove") + TriggerEvent('QBCore:Notify', Lang:t('success.reloaded'), "success") + end + end, function() + QBCore.Functions.Notify(Lang:t('error.canceled'), "error") + end) + else + QBCore.Functions.Notify(Lang:t('error.max_ammo'), "error") + end + else + QBCore.Functions.Notify(Lang:t('error.no_weapon'), "error") + end + else + QBCore.Functions.Notify(Lang:t('error.no_weapon'), "error") + end +end) + +RegisterNetEvent("weapons:client:EquipAttachment", function(ItemData, attachment) + local ped = PlayerPedId() + local weapon = GetSelectedPedWeapon(ped) + local WeaponData = QBCore.Shared.Weapons[weapon] + if weapon ~= `WEAPON_UNARMED` then + WeaponData.name = WeaponData.name:upper() + if WeaponAttachments[WeaponData.name] then + if WeaponAttachments[WeaponData.name][attachment]['item'] == ItemData.name then + TriggerServerEvent("weapons:server:EquipAttachment", ItemData, CurrentWeaponData, WeaponAttachments[WeaponData.name][attachment]) + else + QBCore.Functions.Notify(Lang:t('error.no_support_attachment'), "error") + end + end + else + QBCore.Functions.Notify(Lang:t('error.no_weapon_in_hand'), "error") + end +end) + +-- Threads + +CreateThread(function() + SetWeaponsNoAutoswap(true) +end) + +CreateThread(function() + while true do + local ped = PlayerPedId() + if IsPedArmed(ped, 7) == 1 and (IsControlJustReleased(0, 24) or IsDisabledControlJustReleased(0, 24)) then + local weapon = GetSelectedPedWeapon(ped) + local ammo = GetAmmoInPedWeapon(ped, weapon) + TriggerServerEvent("weapons:server:UpdateWeaponAmmo", CurrentWeaponData, tonumber(ammo)) + if MultiplierAmount > 0 then + TriggerServerEvent("weapons:server:UpdateWeaponQuality", CurrentWeaponData, MultiplierAmount) + MultiplierAmount = 0 + end + end + Wait(0) + end +end) + +CreateThread(function() + while true do + if LocalPlayer.state.isLoggedIn then + local ped = PlayerPedId() + if CurrentWeaponData and next(CurrentWeaponData) then + if IsPedShooting(ped) or IsControlJustPressed(0, 24) then + local weapon = GetSelectedPedWeapon(ped) + if CanShoot then + if weapon and weapon ~= 0 and QBCore.Shared.Weapons[weapon] then + QBCore.Functions.TriggerCallback('prison:server:checkThrowable', function(result) + if result or GetAmmoInPedWeapon(ped, weapon) <= 0 then return end + MultiplierAmount += 1 + end, weapon) + Wait(200) + end + else + if weapon ~= `WEAPON_UNARMED` then + TriggerEvent('inventory:client:CheckWeapon', QBCore.Shared.Weapons[weapon]["name"]) + QBCore.Functions.Notify(Lang:t('error.weapon_broken'), "error") + MultiplierAmount = 0 + end + end + end + end + end + Wait(0) + end +end) + +CreateThread(function() + while true do + if LocalPlayer.state.isLoggedIn then + local inRange = false + local ped = PlayerPedId() + local pos = GetEntityCoords(ped) + for k, data in pairs(Config.WeaponRepairPoints) do + local distance = #(pos - data.coords) + if distance < 10 then + inRange = true + if distance < 1 then + if data.IsRepairing then + if data.RepairingData.CitizenId ~= PlayerData.citizenid then + DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.repairshop_not_usable')) + else + if not data.RepairingData.Ready then + DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.weapon_will_repair')) + else + DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.take_weapon_back')) + end + end + else + if CurrentWeaponData and next(CurrentWeaponData) then + if not data.RepairingData.Ready then + local WeaponData = QBCore.Shared.Weapons[GetHashKey(CurrentWeaponData.name)] + local WeaponClass = (QBCore.Shared.SplitStr(WeaponData.ammotype, "_")[2]):lower() + DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.repair_weapon_price', { value = Config.WeaponRepairCosts[WeaponClass] })) + if IsControlJustPressed(0, 38) then + QBCore.Functions.TriggerCallback('weapons:server:RepairWeapon', function(HasMoney) + if HasMoney then + CurrentWeaponData = {} + end + end, k, CurrentWeaponData) + end + else + if data.RepairingData.CitizenId ~= PlayerData.citizenid then + DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.repairshop_not_usable')) + else + DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.take_weapon_back')) + if IsControlJustPressed(0, 38) then + TriggerServerEvent('weapons:server:TakeBackWeapon', k, data) + end + end + end + else + if data.RepairingData.CitizenId == nil then + DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('error.no_weapon_in_hand')) + elseif data.RepairingData.CitizenId == PlayerData.citizenid then + DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.take_weapon_back')) + if IsControlJustPressed(0, 38) then + TriggerServerEvent('weapons:server:TakeBackWeapon', k, data) + end + end + end + end + end + end + end + if not inRange then + Wait(1000) + end + end + Wait(0) + end +end) diff --git a/[qb]/qb-weapons/config.lua b/[qb]/qb-weapons/config.lua new file mode 100644 index 0000000..a3deac3 --- /dev/null +++ b/[qb]/qb-weapons/config.lua @@ -0,0 +1,920 @@ +Config = Config or {} + +Config.ReloadTime = math.random(4000, 6000) + +Config.DurabilityBlockedWeapons = { + "weapon_stungun", + "weapon_nightstick", + "weapon_flashlight", + "weapon_unarmed", +} + +Config.Throwables = { + "ball", + "bzgas", + "flare", + "grenade", + "molotov", + "pipebomb", + "proxmine", + "smokegrenade", + "snowball", + "stickybomb", +} + +Config.DurabilityMultiplier = { + -- Melee + -- ['weapon_unarmed'] = 0.15, + ['weapon_dagger'] = 0.15, + ['weapon_bat'] = 0.15, + ['weapon_bottle'] = 0.15, + ['weapon_crowbar'] = 0.15, + ['weapon_candycane'] = 0.15, + -- ['weapon_flashlight'] = 0.15, + ['weapon_golfclub'] = 0.15, + ['weapon_hammer'] = 0.15, + ['weapon_hatchet'] = 0.15, + ['weapon_knuckle'] = 0.15, + ['weapon_knife'] = 0.15, + ['weapon_machete'] = 0.15, + ['weapon_switchblade'] = 0.15, + -- ['weapon_nightstick'] = 0.15, + ['weapon_wrench'] = 0.15, + ['weapon_battleaxe'] = 0.15, + ['weapon_poolcue'] = 0.15, + ['weapon_briefcase'] = 0.15, + ['weapon_briefcase_02'] = 0.15, + ['weapon_garbagebag'] = 0.15, + ['weapon_handcuffs'] = 0.15, + ['weapon_bread'] = 0.15, + ['weapon_stone_hatchet'] = 0.15, + + -- Handguns + ['weapon_pistol'] = 0.15, + ['weapon_pistol_mk2'] = 0.15, + ['weapon_combatpistol'] = 0.15, + ['weapon_appistol'] = 0.15, + -- ['weapon_stungun'] = 0.15, + -- ['weapon_stungun_mp'] = 0.15, + ['weapon_pistol50'] = 0.15, + ['weapon_snspistol'] = 0.15, + ['weapon_heavypistol'] = 0.15, + ['weapon_vintagepistol'] = 0.15, + ['weapon_flaregun'] = 0.15, + ['weapon_marksmanpistol'] = 0.15, + ['weapon_revolver'] = 0.15, + ['weapon_revolver_mk2'] = 0.15, + ['weapon_doubleaction'] = 0.15, + ['weapon_snspistol_mk2'] = 0.15, + ['weapon_raypistol'] = 0.15, + ['weapon_ceramicpistol'] = 0.15, + ['weapon_navyrevolver'] = 0.15, + ['weapon_gadgetpistol'] = 0.15, + ['weapon_pistolxm3'] = 0.15, + + -- Submachine Guns + ['weapon_microsmg'] = 0.15, + ['weapon_smg'] = 0.15, + ['weapon_smg_mk2'] = 0.15, + ['weapon_assaultsmg'] = 0.15, + ['weapon_combatpdw'] = 0.15, + ['weapon_machinepistol'] = 0.15, + ['weapon_minismg'] = 0.15, + ['weapon_raycarbine'] = 0.15, + + -- Shotguns + ['weapon_pumpshotgun'] = 0.15, + ['weapon_sawnoffshotgun'] = 0.15, + ['weapon_assaultshotgun'] = 0.15, + ['weapon_bullpupshotgun'] = 0.15, + ['weapon_musket'] = 0.15, + ['weapon_heavyshotgun'] = 0.15, + ['weapon_dbshotgun'] = 0.15, + ['weapon_autoshotgun'] = 0.15, + ['weapon_pumpshotgun_mk2'] = 0.15, + ['weapon_combatshotgun'] = 0.15, + + -- Assault Rifles + ['weapon_assaultrifle'] = 0.15, + ['weapon_assaultrifle_mk2'] = 0.15, + ['weapon_carbinerifle'] = 0.15, + ['weapon_carbinerifle_mk2'] = 0.15, + ['weapon_advancedrifle'] = 0.15, + ['weapon_specialcarbine'] = 0.15, + ['weapon_bullpuprifle'] = 0.15, + ['weapon_compactrifle'] = 0.15, + ['weapon_specialcarbine_mk2'] = 0.15, + ['weapon_bullpuprifle_mk2'] = 0.15, + ['weapon_militaryrifle'] = 0.15, + ['weapon_heavyrifle'] = 0.15, + + -- Light Machine Guns + ['weapon_mg'] = 0.15, + ['weapon_combatmg'] = 0.15, + ['weapon_gusenberg'] = 0.15, + ['weapon_combatmg_mk2'] = 0.15, + + -- Sniper Rifles + ['weapon_sniperrifle'] = 0.15, + ['weapon_heavysniper'] = 0.15, + ['weapon_marksmanrifle'] = 0.15, + ['weapon_remotesniper'] = 0.15, + ['weapon_heavysniper_mk2'] = 0.15, + ['weapon_marksmanrifle_mk2'] = 0.15, + + -- Heavy Weapons + ['weapon_rpg'] = 0.15, + ['weapon_grenadelauncher'] = 0.15, + ['weapon_grenadelauncher_smoke'] = 0.15, + ['weapon_emplauncher'] = 0.15, + ['weapon_minigun'] = 0.15, + ['weapon_firework'] = 0.15, + ['weapon_railgun'] = 0.15, + ['weapon_hominglauncher'] = 0.15, + ['weapon_compactlauncher'] = 0.15, + ['weapon_rayminigun'] = 0.15, + ['weapon_railgunxm3'] = 0.15, + + -- Throwables + ['weapon_grenade'] = 0.15, + ['weapon_bzgas'] = 0.15, + ['weapon_molotov'] = 0.15, + ['weapon_stickybomb'] = 0.15, + ['weapon_proxmine'] = 0.15, + ['weapon_snowball'] = 0.15, + ['weapon_pipebomb'] = 0.15, + ['weapon_ball'] = 0.15, + ['weapon_smokegrenade'] = 0.15, + ['weapon_flare'] = 0.15, + + -- Miscellaneous + ['weapon_petrolcan'] = 0.15, + ['weapon_fireextinguisher'] = 0.15, + ['weapon_hazardcan'] = 0.15, + ['weapon_fertilizercan'] = 0.15, +} + +Config.WeaponRepairPoints = { + [1] = { + coords = vector3(964.02, -1267.41, 34.97), + IsRepairing = false, + RepairingData = {}, + } +} + +Config.WeaponRepairCosts = { + ["pistol"] = 1000, + ["smg"] = 3000, + ["mg"] = 4000, + ["rifle"] = 5000, + ["sniper"] = 7000, + ["shotgun"] = 6000 +} + +WeaponAttachments = { + -- PISTOLS + ['WEAPON_PISTOL'] = { + ['defaultclip'] = { + component = 'COMPONENT_PISTOL_CLIP_01', + item = 'pistol_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_PISTOL_CLIP_02', + item = 'pistol_extendedclip', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_PI_FLSH', + item = 'pistol_flashlight', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_PI_SUPP_02', + item = 'pistol_suppressor', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_PISTOL_VARMOD_LUXE', + item = 'pistol_luxuryfinish', + }, + }, + ['WEAPON_COMBATPISTOL'] = { + ['defaultclip'] = { + component = 'COMPONENT_COMBATPISTOL_CLIP_01', + item = 'combatpistol_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_COMBATPISTOL_CLIP_02', + item = 'combatpistol_extendedclip', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_PI_FLSH', + item = 'pistol_flashlight', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_PI_SUPP', + item = 'pistol_suppressor', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_COMBATPISTOL_VARMOD_LOWRIDER', + item = 'combatpistol_luxuryfinish', + }, + }, + ['WEAPON_APPISTOL'] = { + ['defaultclip'] = { + component = 'COMPONENT_APPISTOL_CLIP_01', + item = 'appistol_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_APPISTOL_CLIP_02', + item = 'appistol_extendedclip', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_PI_FLSH', + item = 'pistol_flashlight', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_PI_SUPP', + item = 'pistol_suppressor', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_APPISTOL_VARMOD_LUXE', + item = 'appistol_luxuryfinish', + }, + }, + ['WEAPON_PISTOL50'] = { + ['defaultclip'] = { + component = 'COMPONENT_PISTOL50_CLIP_01', + item = 'pistol50_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_PISTOL50_CLIP_02', + item = 'pistol50_extendedclip', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_PI_FLSH', + item = 'pistol_flashlight', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP_02', + item = 'pistol_suppressor', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_PISTOL50_VARMOD_LUXE', + item = 'pistol50_luxuryfinish', + }, + }, + ['WEAPON_REVOLVER'] = { + ['defaultclip'] = { + component = 'COMPONENT_REVOLVER_CLIP_01', + item = 'revolver_defaultclip', + }, + ['vipvariant'] = { + component = 'COMPONENT_REVOLVER_VARMOD_GOON', + item = 'revolver_vipvariant', + type = 'skin', + }, + ['bodyguardvariant'] = { + component = 'COMPONENT_REVOLVER_VARMOD_BOSS', + item = 'revolver_bodyguardvariant', + type = 'skin', + }, + }, + ['WEAPON_SNSPISTOL'] = { + ['defaultclip'] = { + component = 'COMPONENT_SNSPISTOL_CLIP_01', + item = 'snspistol_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_SNSPISTOL_CLIP_02', + item = 'snspistol_extendedclip', + type = 'clip', + }, + ['grip'] = { + component = 'COMPONENT_SNSPISTOL_VARMOD_LOWRIDER', + item = 'snspistol_grip', + }, + }, + ['WEAPON_HEAVYPISTOL'] = { + ['defaultclip'] = { + component = 'COMPONENT_HEAVYPISTOL_CLIP_01', + item = 'heavypistol_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_HEAVYPISTOL_CLIP_02', + item = 'heavypistol_extendedclip', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_PI_FLSH', + item = 'pistol_flashlight', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_PI_SUPP', + item = 'pistol_suppressor', + }, + ['grip'] = { + component = 'COMPONENT_HEAVYPISTOL_VARMOD_LUXE', + item = 'heavypistol_grip', + }, + }, + ['WEAPON_VINTAGEPISTOL'] = { + ['defaultclip'] = { + component = 'COMPONENT_VINTAGEPISTOL_CLIP_01', + item = 'vintagepistol_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_VINTAGEPISTOL_CLIP_02', + item = 'vintagepistol_extendedclip', + type = 'clip', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_PI_SUPP', + item = 'pistol_suppressor', + type = 'silencer', + }, + }, + -- SMG'S + ['WEAPON_MICROSMG'] = { + ['defaultclip'] = { + component = 'COMPONENT_MICROSMG_CLIP_01', + item = 'microsmg_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_MICROSMG_CLIP_02', + item = 'microsmg_extendedclip', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_PI_FLSH', + item = 'pistol_flashlight', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_MACRO', + item = 'microsmg_scope', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP_02', + item = 'smg_suppressor', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_MICROSMG_VARMOD_LUXE', + item = 'microsmg_luxuryfinish', + }, + }, + ['WEAPON_SMG'] = { + ['defaultclip'] = { + component = 'COMPONENT_SMG_CLIP_01', + item = 'smg_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_SMG_CLIP_02', + item = 'smg_extendedclip', + type = 'clip', + }, + ['drum'] = { + component = 'COMPONENT_SMG_CLIP_03', + item = 'smg_drum', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_MACRO_02', + item = 'smg_scope', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_PI_SUPP', + item = 'pistol_suppressor', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_SMG_VARMOD_LUXE', + item = 'smg_luxuryfinish', + }, + }, + ['WEAPON_ASSAULTSMG'] = { + ['defaultclip'] = { + component = 'COMPONENT_ASSAULTSMG_CLIP_01', + item = 'assaultsmg_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_ASSAULTSMG_CLIP_02', + item = 'assaultsmg_extendedclip', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_MACRO', + item = 'microsmg_scope', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP_02', + item = 'smg_suppressor', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_ASSAULTSMG_VARMOD_LOWRIDER', + item = 'assaultsmg_luxuryfinish', + }, + }, + ['WEAPON_MINISMG'] = { + ['defaultclip'] = { + component = 'COMPONENT_MINISMG_CLIP_01', + item = 'minismg_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_MINISMG_CLIP_02', + item = 'minismg_extendedclip', + type = 'clip', + }, + }, + ['WEAPON_MACHINEPISTOL'] = { + ['defaultclip'] = { + component = 'COMPONENT_MACHINEPISTOL_CLIP_01', + item = 'machinepistol_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_MACHINEPISTOL_CLIP_02', + item = 'machinepistol_extendedclip', + type = 'clip', + }, + ['drum'] = { + component = 'COMPONENT_MACHINEPISTOL_CLIP_03', + item = 'machinepistol_drum', + type = 'clip', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_PI_SUPP', + item = 'pistol_suppressor', + }, + }, + ['WEAPON_COMBATPDW'] = { + ['defaultclip'] = { + component = 'COMPONENT_COMBATPDW_CLIP_01', + item = 'combatpdw_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_COMBATPDW_CLIP_02', + item = 'combatpdw_extendedclip', + type = 'clip', + }, + ['drum'] = { + component = 'COMPONENT_COMBATPDW_CLIP_03', + item = 'combatpdw_drum', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['grip'] = { + component = 'COMPONENT_AT_AR_AFGRIP', + item = 'combatpdw_grip', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_SMALL', + item = 'combatpdw_scope', + }, + }, + -- SHOTGUNS + ['WEAPON_PUMPSHOTGUN'] = { + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_SR_SUPP', + item = 'shotgun_suppressor', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_PUMPSHOTGUN_VARMOD_LOWRIDER', + item = 'pumpshotgun_luxuryfinish', + }, + }, + ['WEAPON_SAWNOFFSHOTGUN'] = { + ['luxuryfinish'] = { + component = 'COMPONENT_SAWNOFFSHOTGUN_VARMOD_LUXE', + item = 'sawnoffshotgun_luxuryfinish', + }, + }, + ['WEAPON_ASSAULTSHOTGUN'] = { + ['defaultclip'] = { + component = 'COMPONENT_ASSAULTSHOTGUN_CLIP_01', + item = 'assaultshotgun_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_ASSAULTSHOTGUN_CLIP_02', + item = 'assaultshotgun_extendedclip', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP', + item = 'rifle_suppressor', + }, + ['grip'] = { + component = 'COMPONENT_AT_AR_AFGRIP', + item = 'rifle_grip', + }, + }, + ['WEAPON_BULLPUPSHOTGUN'] = { + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP_02', + item = 'smg_suppressor', + }, + ['grip'] = { + component = 'COMPONENT_AT_AR_AFGRIP', + item = 'rifle_grip', + }, + }, + ['WEAPON_HEAVYSHOTGUN'] = { + ['defaultclip'] = { + component = 'COMPONENT_HEAVYSHOTGUN_CLIP_01', + item = 'heavyshotgun_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_HEAVYSHOTGUN_CLIP_02', + item = 'heavyshotgun_extendedclip', + type = 'clip', + }, + ['drum'] = { + component = 'COMPONENT_HEAVYSHOTGUN_CLIP_03', + item = 'heavyshotgun_drum', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP_02', + item = 'smg_suppressor', + }, + ['grip'] = { + component = 'COMPONENT_AT_AR_AFGRIP', + item = 'rifle_grip', + }, + }, + ['WEAPON_COMBATSHOTGUN'] = { + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP', + item = 'rifle_suppressor', + }, + }, + -- RIFLES + ['WEAPON_ASSAULTRIFLE'] = { + ['defaultclip'] = { + component = 'COMPONENT_ASSAULTRIFLE_CLIP_01', + item = 'assaultrifle_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_ASSAULTRIFLE_CLIP_02', + item = 'assaultrifle_extendedclip', + type = 'clip', + }, + ['drum'] = { + component = 'COMPONENT_ASSAULTRIFLE_CLIP_03', + item = 'assaultrifle_drum', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_MACRO', + item = 'microsmg_scope', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP_02', + item = 'rifle_suppressor', + }, + ['grip'] = { + component = 'COMPONENT_AT_AR_AFGRIP', + item = 'rifle_grip', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_ASSAULTRIFLE_VARMOD_LUXE', + item = 'assaultrifle_luxuryfinish', + }, + }, + ['WEAPON_CARBINERIFLE'] = { + ['defaultclip'] = { + component = 'COMPONENT_CARBINERIFLE_CLIP_01', + item = 'carbinerifle_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_CARBINERIFLE_CLIP_02', + item = 'carbinerifle_extendedclip', + type = 'clip', + }, + ['drum'] = { + component = 'COMPONENT_CARBINERIFLE_CLIP_03', + item = 'carbinerifle_drum', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_MEDIUM', + item = 'carbinerifle_scope', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP', + item = 'rifle_suppressor', + }, + ['grip'] = { + component = 'COMPONENT_AT_AR_AFGRIP', + item = 'rifle_grip', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_CARBINERIFLE_VARMOD_LUXE', + item = 'carbinerifle_luxuryfinish', + }, + }, + ['WEAPON_ADVANCEDRIFLE'] = { + ['defaultclip'] = { + component = 'COMPONENT_ADVANCEDRIFLE_CLIP_01', + item = 'advancedrifle_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_ADVANCEDRIFLE_CLIP_02', + item = 'advancedrifle_extendedclip', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_SMALL', + item = 'combatpdw_scope', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP', + item = 'rifle_suppressor', + }, + ['grip'] = { + component = 'COMPONENT_AT_AR_AFGRIP', + item = 'rifle_grip', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_ADVANCEDRIFLE_VARMOD_LUXE', + item = 'advancedrifle_luxuryfinish', + }, + }, + ['WEAPON_SPECIALCARBINE'] = { + ['defaultclip'] = { + component = 'COMPONENT_SPECIALCARBINE_CLIP_01', + item = 'specialcarbine_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_SPECIALCARBINE_CLIP_02', + item = 'specialcarbine_extendedclip', + type = 'clip', + }, + ['drum'] = { + component = 'COMPONENT_SPECIALCARBINE_CLIP_03', + item = 'specialcarbine_drum', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_MEDIUM', + item = 'carbinerifle_scope', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP_02', + item = 'smg_suppressor', + }, + ['grip'] = { + component = 'COMPONENT_AT_AR_AFGRIP', + item = 'rifle_grip', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_SPECIALCARBINE_VARMOD_LOWRIDER', + item = 'specialcarbine_luxuryfinish', + }, + }, + ['WEAPON_BULLPUPRIFLE'] = { + ['defaultclip'] = { + component = 'COMPONENT_BULLPUPRIFLE_CLIP_01', + item = 'bullpuprifle_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_BULLPUPRIFLE_CLIP_02', + item = 'bullpuprifle_extendedclip', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_SMALL', + item = 'combatpdw_scope', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP', + item = 'rifle_suppressor', + }, + ['grip'] = { + component = 'COMPONENT_AT_AR_AFGRIP', + item = 'rifle_grip', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_BULLPUPRIFLE_VARMOD_LOW', + item = 'bullpuprifle_luxuryfinish', + }, + }, + ['WEAPON_COMPACTRIFLE'] = { + ['defaultclip'] = { + component = 'COMPONENT_COMPACTRIFLE_CLIP_01', + item = 'compactrifle_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_COMPACTRIFLE_CLIP_02', + item = 'compactrifle_extendedclip', + type = 'clip', + }, + ['drum'] = { + component = 'COMPONENT_COMPACTRIFLE_CLIP_03', + item = 'compactrifle_drum', + type = 'clip', + }, + }, + ['WEAPON_HEAVYRIFLE'] = { + ['defaultclip'] = { + component = 'COMPONENT_HEAVYRIFLE_CLIP_01', + item = 'bullpuprifle_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_HEAVYRIFLE_CLIP_02', + item = 'bullpuprifle_extendedclip', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_MEDIUM', + item = 'carbinerifle_scope', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP', + item = 'rifle_suppressor', + }, + ['grip'] = { + component = 'COMPONENT_AT_AR_AFGRIP', + item = 'rifle_grip', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_BULLPUPRIFLE_VARMOD_LOW', + item = 'bullpuprifle_luxuryfinish', + }, + }, + -- MACHINE GUNS + ['WEAPON_GUSENBERG'] = { + ['defaultclip'] = { + component = 'COMPONENT_GUSENBERG_CLIP_01', + item = 'gusenberg_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_GUSENBERG_CLIP_02', + item = 'gusenberg_extendedclip', + type = 'clip', + }, + }, + -- LAUNCHERS + ['WEAPON_EMPLAUNCHER'] = { + ['defaultclip'] = { + component = 'COMPONENT_EMPLAUNCHER_CLIP_01', + item = 'emplauncher_defaultclip', + type = 'clip', + }, + }, + -- SNIPERS + ['WEAPON_SNIPERRIFLE'] = { + ['defaultclip'] = { + component = 'COMPONENT_SNIPERRIFLE_CLIP_01', + item = 'sniperrifle_defaultclip', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP_02', + item = 'smg_suppressor', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_LARGE', + item = 'sniper_scope', + type = 'scope', + }, + ['advancedscope'] = { + component = 'COMPONENT_AT_SCOPE_MAX', + item = 'snipermax_scope', + type = 'scope', + }, + ['grip'] = { + component = 'COMPONENT_SNIPERRIFLE_VARMOD_LUXE', + item = 'sniper_grip', + }, + }, + ['WEAPON_HEAVYSNIPER'] = { + ['defaultclip'] = { + component = 'COMPONENT_HEAVYSNIPER_CLIP_01', + item = 'heavysniper_defaultclip', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_LARGE', + item = 'sniper_scope', + type = 'scope', + }, + ['advancedscope'] = { + component = 'COMPONENT_AT_SCOPE_MAX', + item = 'snipermax_scope', + type = 'scope', + }, + }, + ['WEAPON_MARKSMANRIFLE'] = { + ['defaultclip'] = { + component = 'COMPONENT_MARKSMANRIFLE_CLIP_01', + item = 'marksmanrifle_defaultclip', + type = 'clip', + }, + ['extendedclip'] = { + component = 'COMPONENT_MARKSMANRIFLE_CLIP_02', + item = 'marksmanrifle_extendedclip', + type = 'clip', + }, + ['flashlight'] = { + component = 'COMPONENT_AT_AR_FLSH', + item = 'rifle_flashlight', + }, + ['scope'] = { + component = 'COMPONENT_AT_SCOPE_LARGE_FIXED_ZOOM', + item = 'marksmanrifle_scope', + }, + ['suppressor'] = { + component = 'COMPONENT_AT_AR_SUPP', + item = 'rifle_suppressor', + }, + ['grip'] = { + component = 'COMPONENT_AT_AR_AFGRIP', + item = 'rifle_grip', + }, + ['luxuryfinish'] = { + component = 'COMPONENT_MARKSMANRIFLE_VARMOD_LUXE', + item = 'marksmanrifle_luxuryfinish', + }, + }, +} + +local function getConfigWeaponAttachments(weapon) + return WeaponAttachments[weapon] +end + +exports('getConfigWeaponAttachments', getConfigWeaponAttachments) diff --git a/[qb]/qb-weapons/fxmanifest.lua b/[qb]/qb-weapons/fxmanifest.lua new file mode 100644 index 0000000..979fd30 --- /dev/null +++ b/[qb]/qb-weapons/fxmanifest.lua @@ -0,0 +1,22 @@ +fx_version 'cerulean' +game 'gta5' + +description 'QB-Weapons' +version '1.2.1' + +shared_scripts { + '@qb-core/shared/locale.lua', + 'locales/en.lua', + 'config.lua', +} + +server_script 'server/main.lua' +client_script 'client/main.lua' + +files { + 'weaponsnspistol.meta' +} + +data_file 'WEAPONINFO_FILE_PATCH' 'weaponsnspistol.meta' + +lua54 'yes' diff --git a/[qb]/qb-weapons/locales/ar.lua b/[qb]/qb-weapons/locales/ar.lua new file mode 100644 index 0000000..0e1f1fb --- /dev/null +++ b/[qb]/qb-weapons/locales/ar.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'الغيت', + max_ammo = 'اقصى عدد ل الذخيرة', + no_weapon = 'ليس لديك سلاح', + no_support_attachment = 'هذا السلاح لا يدعم هذه الاضافة', + no_weapon_in_hand = 'أنت لا تملك سلاح في يدك', + weapon_broken = 'هذا السلاح مكسور و لا يمكن استخدامه', + no_damage_on_weapon = 'هذا السلاح غير مكسور', + weapon_broken_need_repair = 'تم كسر سلاحك و تحتاج إلى إصلاحه قبل أن لا تتمكن من استخدامه مرة أخرى', + attachment_already_on_weapon = 'في سلاحك %{value} لديك من قبل' + }, + success = { + reloaded = 'إعادة التحميل' + }, + info = { + loading_bullets = 'تحميل الرصاص', + repairshop_not_usable = 'ﻖﻠﻐﻣ ﺔﻈﺤﻠﻟﺍ ﻩﺬﻫ ﻲﻓ ﺢﻴﻠﺼﺘﻟﺍ ﺮﺠﺘﻣ', -- you need font arabic + weapon_will_repair = 'ﻚﺣﻼﺳ ﺡﻼﺻﺇ ﻢﺘﻴﺳ', + take_weapon_back = '~g~E~w~ - ﻚﺣﻼﺳ ﺪﺧ', + repair_weapon_price = '~g~E~w~ - ~g~$%{value}~w~ ﺢﻴﻠﺼﺗ', + removed_attachment = 'من سلاحك %{value} نزعت', + hp_of_weapon = 'متانة سلاحك' + }, + mail = { + sender = 'عامل', + subject = 'متجر التصليح', + message = '%{value} تم إصلاحه يمكنك استلامه في الموقع

باي باي' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/da.lua b/[qb]/qb-weapons/locales/da.lua new file mode 100644 index 0000000..7b70f30 --- /dev/null +++ b/[qb]/qb-weapons/locales/da.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'Afbrudt', + max_ammo = 'Maks ammo kapacitet', + no_weapon = 'Du har intet våben.', + no_support_attachment = 'Denne våben har ingen tilføjelser.', + no_weapon_in_hand = 'Du har intet våben i dine hænder.', + weapon_broken = 'Dette våben er beskadigt og kan ikke bruges.', + no_damage_on_weapon = 'Dette våben er ikke beskadigt..', + weapon_broken_need_repair = 'Dit våben er beskadigt, du skal reparere det før du kan bruge det.', + attachment_already_on_weapon = 'Du har allerede en %{value} på dit våben.' + }, + success = { + reloaded = 'Ladet' + }, + info = { + loading_bullets = 'Lader patroner', + repairshop_not_usable = 'Denne shop for reparationer er ~r~IKKE~w~ en mulighed.', + weapon_will_repair = 'Dit våben vil blive repareret.', + take_weapon_back = '[E] - Tag våben tilbage', + repair_weapon_price = '[E] Reparer for ~g~%{value} DKK~w~', + removed_attachment = 'Du fjernede %{value} fra dit våben!', + hp_of_weapon = 'HP på dit våben' + }, + mail = { + sender = 'Tyrone', + subject = 'Reparer', + message = 'Din %{value} er repareret, du kan hente det på følgende lokation.

Peace out madafaka' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/de.lua b/[qb]/qb-weapons/locales/de.lua new file mode 100644 index 0000000..d078476 --- /dev/null +++ b/[qb]/qb-weapons/locales/de.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'Abgebrochen', + max_ammo = 'Maximale Muntions Kapazität', + no_weapon = 'Du hast keine Waffen.', + no_support_attachment = 'Diese waffe untersützt diesen komponenten nicht.', + no_weapon_in_hand = 'Du hast keine Waffe in der Hand.', + weapon_broken = 'Diese Waffe ist Kapputt! Du kannst sie nicht Benutzen!.', + no_damage_on_weapon = 'Die Waffe hat keine Schäden..', + weapon_broken_need_repair = 'Deine Waffe ist Kapput Repariere sie bevor du sie nutzen Kannst.', + attachment_already_on_weapon = 'Du hast %{value} Bereits auf deiner Waffe.' + }, + success = { + reloaded = 'Nachgeladen' + }, + info = { + loading_bullets = 'Lade Kugeln', + repairshop_not_usable = 'Der ReparierShop ist im moment ~r~NICHT~w~ Nutzbar.', + weapon_will_repair = 'Deine Waffe wird Repariert.', + take_weapon_back = '[E] - Nehme deine Waffe', + repair_weapon_price = '[E] Repariere die waffe Für:, ~g~$%{value}~w~', + removed_attachment = 'Du hast %{value} von deiner Waffe Entfernt!', + hp_of_weapon = 'Status der Waffe' + }, + mail = { + sender = 'Tyrone', + subject = 'Reperatur', + message = 'Dein %{value} du kannst es bei der Position abholen.

Peace out madafaka' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/en.lua b/[qb]/qb-weapons/locales/en.lua new file mode 100644 index 0000000..7607d53 --- /dev/null +++ b/[qb]/qb-weapons/locales/en.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'Canceled', + max_ammo = 'Max Ammo Capacity', + no_weapon = 'You have no weapon.', + no_support_attachment = 'This weapon does not support this attachment.', + no_weapon_in_hand = 'You dont have a weapon in your hand.', + weapon_broken = 'This weapon is broken and can not be used.', + no_damage_on_weapon = 'This weapon is not damaged..', + weapon_broken_need_repair = 'Your weapon is broken, you need to repair it before you can use it again.', + attachment_already_on_weapon = 'You already have a %{value} on your weapon.' + }, + success = { + reloaded = 'Reloaded' + }, + info = { + loading_bullets = 'Loading Bullets', + repairshop_not_usable = 'The repairshop in this moment is ~r~NOT~w~ usable.', + weapon_will_repair = 'Your weapon will be repaired.', + take_weapon_back = '[E] - Take Weapon Back', + repair_weapon_price = '[E] Repair Weapon, ~g~$%{value}~w~', + removed_attachment = 'You removed %{value} from your weapon!', + hp_of_weapon = 'Durability of your weapon' + }, + mail = { + sender = 'Tyrone', + subject = 'Repair', + message = 'Your %{value} is repaired u can pick it up at the location.

Peace out madafaka' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/es.lua b/[qb]/qb-weapons/locales/es.lua new file mode 100644 index 0000000..f1ed739 --- /dev/null +++ b/[qb]/qb-weapons/locales/es.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'Cancelado', + max_ammo = 'Munición al máximo', + no_weapon = 'No tienes ningún arma.', + no_support_attachment = 'Este arma no puede llevar este accesorio.', + no_weapon_in_hand = 'No tienes ningún arma en la mano.', + weapon_broken = 'Este arma esta estropeada y no puedes usarla.', + no_damage_on_weapon = 'Este arma no esta dañada..', + weapon_broken_need_repair = 'Tu arma esta estropeada, necesitas repararla antes de poder usarla.', + attachment_already_on_weapon = 'Ya tienes un %{value} en tu arma.' + }, + success = { + reloaded = 'Recargada' + }, + info = { + loading_bullets = 'Cargando Munición', + repairshop_not_usable = 'La tienda de reparación en este momento ~r~NO~w~ puede ser usada.', + weapon_will_repair = 'Tu arma sera reparada.', + take_weapon_back = '[E] - Coger Tu Arma', + repair_weapon_price = '[E] Reparar Arma, ~g~$%{value}~w~', + removed_attachment = 'Has quitado el %{value} de tu arma!', + hp_of_weapon = 'Durabilidad de tu arma' + }, + mail = { + sender = 'Tyrone', + subject = 'Reparación', + message = 'Tu %{value} ha sido reparada puedes recogarla en esta ubicación.

Espavila matao' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/et.lua b/[qb]/qb-weapons/locales/et.lua new file mode 100644 index 0000000..97689d7 --- /dev/null +++ b/[qb]/qb-weapons/locales/et.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'Katkestatud', + max_ammo = 'Maksimaalne laskemoona mahutavus', + no_weapon = 'Sul pole relva.', + no_support_attachment = 'See relv ei toeta seda kinnitust.', + no_weapon_in_hand = 'Sul pole relva käes.', + weapon_broken = 'See relv on katki ja seda ei saa kasutada.', + no_damage_on_weapon = 'See relv ei ole kahjustatud..', + weapon_broken_need_repair = 'Teie relv on katki, peate selle parandama, enne kui saate seda uuesti kasutada.', + attachment_already_on_weapon = 'Teie relv on katki, peate selle parandama, enne kui saate seda uuesti kasutada.' + }, + success = { + reloaded = 'Uuesti laaditud' + }, + info = { + loading_bullets = 'Kuulide laadimine', + repairshop_not_usable = 'Praegune remonditöökoda ~pole~ kasutatav.', + weapon_will_repair = 'Teie relv parandatakse.', + take_weapon_back = '[E] - Võtke relv tagasi', + repair_weapon_price = '[E] Relv parandamine, ~g~$%{value}~w~', + removed_attachment = 'Eemaldasite oma relvast %{value}!', + hp_of_weapon = 'Teie relva vastupidavus' + }, + mail = { + sender = 'Tyrone', + subject = 'Parandus', + message = 'Teie %{value} on parandatud ja saate selle kohapealt kätte saada.

Peace out madafaka' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/fr.lua b/[qb]/qb-weapons/locales/fr.lua new file mode 100644 index 0000000..8e066ee --- /dev/null +++ b/[qb]/qb-weapons/locales/fr.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'Annulé', + max_ammo = 'Capacitée maximale de munition', + no_weapon = 'Vous n\'avez pas d\'arme.', + no_support_attachment = 'Cette arme ne supporte pas cet accessoire.', + no_weapon_in_hand = 'Vous n\'avez pas d\'arme dans vos mains.', + weapon_broken = 'Cette arme est cassée est ne peux donc pas être utilisée.', + no_damage_on_weapon = 'Cette arme n\'est pas endommagée..', + weapon_broken_need_repair = 'Votre arme est cassée, Vous devez la réparée pour vous en reservir.', + attachment_already_on_weapon = 'Vous aviez déjà un %{value} sur votre arme.' + }, + success = { + reloaded = 'Rechargée' + }, + info = { + loading_bullets = 'Charger les munitions', + repairshop_not_usable = 'L\'atelier de réparation n\'est ~r~PAS~w~ utilisable.', + weapon_will_repair = 'Votre arme va être réparée.', + take_weapon_back = '[E] - Récuperer votre arme', + repair_weapon_price = '[E] Réparer l\'arme, ~g~$%{value}~w~', + removed_attachment = 'Vous avez retiré %{value} de votre arme!', + hp_of_weapon = 'Durabilité de votre arme' + }, + mail = { + sender = 'Tyrone', + subject = 'Réparation', + message = 'Votre %{value} Est réparé et vous pouvez venir le récuperer.

Peace out madafaka' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/it.lua b/[qb]/qb-weapons/locales/it.lua new file mode 100644 index 0000000..3c1b62c --- /dev/null +++ b/[qb]/qb-weapons/locales/it.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'Annullato', + max_ammo = 'Capacità massima munizioni', + no_weapon = 'Non hai nessuna arma.', + no_support_attachment = 'Questa arma non supporta questo componente.', + no_weapon_in_hand = 'Non hai un\'arma in mano.', + weapon_broken = 'Questa arma è rotta e non può essere utilizzata.', + no_damage_on_weapon = 'Questa arma non è danneggiata..', + weapon_broken_need_repair = 'La tua arma è rotta, devi ripararla prima di poterla usare di nuovo.', + attachment_already_on_weapon = 'Hai già un %{value} nella tua arma.' + }, + success = { + reloaded = 'Ricaricata' + }, + info = { + loading_bullets = 'Caricando proiettili', + repairshop_not_usable = 'Il negozio di riparazione in questo momento ~r~NON~w~ è aperto.', + weapon_will_repair = 'La tua arma verrà riparata.', + take_weapon_back = '[E] - Prendi arma', + repair_weapon_price = '[E] Ripara arma, ~g~$%{value}~w~', + removed_attachment = 'Hai rimosso %{value} dalla tua arma!', + hp_of_weapon = 'HP of ur weapon' + }, + mail = { + sender = 'Tyrone', + subject = 'Riparazione', + message = 'La tua %{value} è stata riparata e pui prenderla alla posizione.

Peace out madafaka' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/lt.lua b/[qb]/qb-weapons/locales/lt.lua new file mode 100644 index 0000000..3922a6b --- /dev/null +++ b/[qb]/qb-weapons/locales/lt.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'Atšaukta', + max_ammo = 'Maksimali šovinių talpa', + no_weapon = 'Jūs neturite ginklo.', + no_support_attachment = 'Šis ginklas negali turėti šio priedo.', + no_weapon_in_hand = 'Jūs neturite ginklo rankoje.', + weapon_broken = 'Šis ginklas yra sulūžęs ir negali būti naudojamas.', + no_damage_on_weapon = 'Šis ginklas nėra sugadintas...', + weapon_broken_need_repair = 'Jūsų ginklas yra sulūžęs, jums reikia jį sutaisyti, kad naudoti vėl.', + attachment_already_on_weapon = 'Jūs jau turite %{value} ant savo ginklo.' + }, + success = { + reloaded = 'Užtaisytas' + }, + info = { + loading_bullets = 'Užtaisomi šoviniai', + repairshop_not_usable = 'Taisyklos šiuo metu ~r~NEGALIMA~w~ naudoti.', + weapon_will_repair = 'Jūsų ginklas bus sutaisytas.', + take_weapon_back = '[E] - Atgauti ginklą', + repair_weapon_price = '[E] Sutaisyti ginklą, ~g~$%{value}~w~', + removed_attachment = 'Jūs panaikinote %{value} iš savo ginklo!', + hp_of_weapon = 'Jūsų ginklo patvarumas' + }, + mail = { + sender = 'Tironas', + subject = 'Taisymas', + message = 'Jūsų %{value} yra sutaisytas. Galite jį atsiimti vietoje.

Davaice' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/nl.lua b/[qb]/qb-weapons/locales/nl.lua new file mode 100644 index 0000000..2a41689 --- /dev/null +++ b/[qb]/qb-weapons/locales/nl.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'Geannuleerd', + max_ammo = 'Max munitiecapaciteit', + no_weapon = 'Je hebt geen wapen.', + no_support_attachment = 'Dit wapen ondersteunt dit opzetstuk niet.', + no_weapon_in_hand = 'Je hebt geen wapen in je hand.', + weapon_broken = 'Dit wapen is kapot en kan niet worden gebruikt.', + no_damage_on_weapon = 'Dit wapen is niet beschadigd..', + weapon_broken_need_repair = 'Je wapen is kapot, je moet het repareren voordat je het weer kunt gebruiken.', + attachment_already_on_weapon = 'Je hebt al een %{value} op je wapen.' + }, + success = { + reloaded = 'Herladen' + }, + info = { + loading_bullets = 'Kogels laden', + repairshop_not_usable = 'De reparatiewerkplaats is op dit moment NIET bruikbaar.', + weapon_will_repair = 'Je wapen wordt gerepareerd.', + take_weapon_back = '[E] - Wapen terugnemen', + repair_weapon_price = '[E] Wapen repareren, ~g~$%{value}~w~', + removed_attachment = 'Je hebt %{value} van je wapen verwijderd!', + hp_of_weapon = 'Duurzaamheid van je wapen' + }, + mail = { + sender = 'Tyrone', + subject = 'Reparatie', + message = 'Jouw %{value} is gerepareerd en je kunt het ophalen.

Peace out madafaka' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/pt.lua b/[qb]/qb-weapons/locales/pt.lua new file mode 100644 index 0000000..ccdc26e --- /dev/null +++ b/[qb]/qb-weapons/locales/pt.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'Cancelado', + max_ammo = 'Capacidade máxima de munição', + no_weapon = 'Não tens uma arma.', + no_support_attachment = 'Esta arma não suporta este attachment.', + no_weapon_in_hand = 'Não tens uma arma na tua mão.', + weapon_broken = 'Esta arma está destruída e não pode ser utilizada.', + no_damage_on_weapon = 'Esta arma não está danificada..', + weapon_broken_need_repair = 'A tua arma está destruída, precisas de a reparar antes de a usares outra vez.', + attachment_already_on_weapon = 'Tu já tens um %{value} na tua arma.' + }, + success = { + reloaded = 'Recarregado' + }, + info = { + loading_bullets = 'A carregar munição', + repairshop_not_usable = 'A mesa de reparação neste momento não está disponível.', + weapon_will_repair = 'A tua arma vai ser reparada.', + take_weapon_back = '[E] - Pegar na arma de volta', + repair_weapon_price = '[E] Reparar arma, ~g~%{value}€~w~', + removed_attachment = 'Removeste %{value} da tua arma!', + hp_of_weapon = 'HP da tua arma' + }, + mail = { + sender = 'Tyrone', + subject = 'Reparação', + message = 'A teu/tua %{value} está reparado(a). Podes recolher neste local.

Paz madafaka' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/ro.lua b/[qb]/qb-weapons/locales/ro.lua new file mode 100644 index 0000000..fb7de22 --- /dev/null +++ b/[qb]/qb-weapons/locales/ro.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'Anulat', + max_ammo = 'Arma a ajuns la numarul maxim de gloante', + no_weapon = 'Nu ai nici o arma.', + no_support_attachment = 'Arma nu suporta atasamente.', + no_weapon_in_hand = 'Nu ai o arma in mana.', + weapon_broken = 'Arma este stricata si nu o poti folosi.', + no_damage_on_weapon = 'Arma nu este stricata..', + weapon_broken_need_repair = 'Arma ta este stricata, va trebuie sa o repari ca sa o folosesti.', + attachment_already_on_weapon = 'Deja ai atasat: %{value} pe arma.' + }, + success = { + reloaded = 'Reincarcat' + }, + info = { + loading_bullets = 'Reincarci..', + repairshop_not_usable = 'Magazinul de reparat ~r~NU~w~ poate fi folosit in acest moment.', + weapon_will_repair = 'Arma ta va fi reparata.', + take_weapon_back = '[E] - Ia-ti arma inapoi', + repair_weapon_price = '[E] Repara arma, ~g~$%{value}~w~', + removed_attachment = 'Ai scos %{value} de pe arma!', + hp_of_weapon = 'HP-ul armei' + }, + mail = { + sender = 'Tyrone', + subject = 'Repara', + message = 'Arma: %{value} este reparata si o poti lua de la mine.

Du-te dracu bozo' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/sv.lua b/[qb]/qb-weapons/locales/sv.lua new file mode 100644 index 0000000..1857fbf --- /dev/null +++ b/[qb]/qb-weapons/locales/sv.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'Avbruten', + max_ammo = 'Max Ammokapacitet', + no_weapon = 'Du har inget vapen.', + no_support_attachment = 'Det här vapnet tillåter inte detta tillbehör.', + no_weapon_in_hand = 'Du har inget vapen i handen.', + weapon_broken = 'Vapnet är trasigt och kan inte användas.', + no_damage_on_weapon = 'Vapnet är inte trasigt..', + weapon_broken_need_repair = 'Vapnet är trasigt och måste repareras för att kunna användas igen.', + attachment_already_on_weapon = 'Du har redan en %{value} på det här vapnet.' + }, + success = { + reloaded = 'Omladdat' + }, + info = { + loading_bullets = 'Laddar kulor', + repairshop_not_usable = 'Reparation är ~r~INTE~w~ möjligt för tillfället.', + weapon_will_repair = 'Ditt vapen kommer att repareras.', + take_weapon_back = '[E] - Ta tillbaka vapen', + repair_weapon_price = '[E] Reparera vapen, ~g~$%{value}~w~', + removed_attachment = 'Du tp bort %{value} från vapnet!', + hp_of_weapon = 'Ditt vapens HP' + }, + mail = { + sender = 'Viktor', + subject = 'Reparation', + message = 'Din %{value} är fixad, hämta upp det på en gång om du vill ha tillbaka skiten, jag vill inte ha med det att göra längre.

Hörs hej!' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/locales/tr.lua b/[qb]/qb-weapons/locales/tr.lua new file mode 100644 index 0000000..3437d80 --- /dev/null +++ b/[qb]/qb-weapons/locales/tr.lua @@ -0,0 +1,35 @@ +local Translations = { + error = { + canceled = 'İptal edildi', + max_ammo = 'Maks Cephane Kapasitesi', + no_weapon = 'Silahın yok.', + no_support_attachment = 'Bu silah bu eklentiyi desteklemiyor.', + no_weapon_in_hand = 'Elinde silah yok.', + weapon_broken = 'Bu silah kırık ve kullanılamaz.', + no_damage_on_weapon = 'Bu silah hasar görmedi..', + weapon_broken_need_repair = 'Silahınız bozuldu, tekrar kullanabilmeniz için tamir etmeniz gerekiyor..', + attachment_already_on_weapon = 'Silahınızda zaten bir %{value} var.' + }, + success = { + reloaded = 'Şarjör değiştirildi' + }, + info = { + loading_bullets = 'Şarjör değiştiriliyor', + repairshop_not_usable = 'Şu anda tamirhane kullanılabilir DEĞİL.', + weapon_will_repair = 'Silahın tamir edilecek.', + take_weapon_back = '[E] - Silahı Geri Al', + repair_weapon_price = '[E] Silah Tamiri, ~g~$%{value}~w~', + removed_attachment = 'Silahınızdan %{value} çıkardınız!', + hp_of_weapon = 'Silahınızın dayanıklılığı' + }, + mail = { + sender = 'Tyrone', + subject = 'Tamirat', + message = '%{value} onarıldı, aynı yerden geri alabilirsin.

Peace out madafaka' + }, +} + +Lang = Locale:new({ + phrases = Translations, + warnOnMissing = true +}) diff --git a/[qb]/qb-weapons/server/main.lua b/[qb]/qb-weapons/server/main.lua new file mode 100644 index 0000000..fe20fd9 --- /dev/null +++ b/[qb]/qb-weapons/server/main.lua @@ -0,0 +1,787 @@ +local QBCore = exports['qb-core']:GetCoreObject() + +-- Functions + +local function IsWeaponBlocked(WeaponName) + local retval = false + for _, name in pairs(Config.DurabilityBlockedWeapons) do + if name == WeaponName then + retval = true + break + end + end + return retval +end + +local function HasAttachment(component, attachments) + local retval = false + local key = nil + for k, v in pairs(attachments) do + if v.component == component then + key = k + retval = true + end + end + return retval, key +end + +local function GetAttachmentType(attachments) + local attype = nil + for _, v in pairs(attachments) do + attype = v.type + end + return attype +end + +-- Callback + +QBCore.Functions.CreateCallback("weapons:server:GetConfig", function(_, cb) + cb(Config.WeaponRepairPoints) +end) + +QBCore.Functions.CreateCallback("weapon:server:GetWeaponAmmo", function(source, cb, WeaponData) + local Player = QBCore.Functions.GetPlayer(source) + local retval = 0 + if WeaponData then + if Player then + local ItemData = Player.Functions.GetItemBySlot(WeaponData.slot) + if ItemData then + retval = ItemData.info.ammo and ItemData.info.ammo or 0 + end + end + end + cb(retval, WeaponData.name) +end) + +QBCore.Functions.CreateCallback('weapons:server:RemoveAttachment', function(source, cb, AttachmentData, ItemData) + local src = source + local Player = QBCore.Functions.GetPlayer(src) + local Inventory = Player.PlayerData.items + local AttachmentComponent = WeaponAttachments[ItemData.name:upper()][AttachmentData.attachment] + if Inventory[ItemData.slot] then + if Inventory[ItemData.slot].info.attachments and next(Inventory[ItemData.slot].info.attachments) then + local HasAttach, key = HasAttachment(AttachmentComponent.component, Inventory[ItemData.slot].info.attachments) + if HasAttach then + table.remove(Inventory[ItemData.slot].info.attachments, key) + Player.Functions.SetInventory(Player.PlayerData.items, true) + Player.Functions.AddItem(AttachmentComponent.item, 1) + TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[AttachmentComponent.item], "add") + TriggerClientEvent("QBCore:Notify", src, Lang:t('info.removed_attachment', { value = QBCore.Shared.Items[AttachmentComponent.item].label }), "error") + cb(Inventory[ItemData.slot].info.attachments) + else + cb(false) + end + else + cb(false) + end + else + cb(false) + end +end) + +QBCore.Functions.CreateCallback("weapons:server:RepairWeapon", function(source, cb, RepairPoint, data) + local src = source + local Player = QBCore.Functions.GetPlayer(src) + local minute = 60 * 1000 + local Timeout = math.random(5 * minute, 10 * minute) + local WeaponData = QBCore.Shared.Weapons[GetHashKey(data.name)] + local WeaponClass = (QBCore.Shared.SplitStr(WeaponData.ammotype, "_")[2]):lower() + + if Player.PlayerData.items[data.slot] then + if Player.PlayerData.items[data.slot].info.quality then + if Player.PlayerData.items[data.slot].info.quality ~= 100 then + if Player.Functions.RemoveMoney('cash', Config.WeaponRepairCosts[WeaponClass]) then + Config.WeaponRepairPoints[RepairPoint].IsRepairing = true + Config.WeaponRepairPoints[RepairPoint].RepairingData = { + CitizenId = Player.PlayerData.citizenid, + WeaponData = Player.PlayerData.items[data.slot], + Ready = false, + } + if not Player.Functions.RemoveItem(data.name, 1, data.slot) then + return Player.Functions.AddMoney('cash', Config.WeaponRepairCosts[WeaponClass]) + end + TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[data.name], "remove") + TriggerClientEvent("inventory:client:CheckWeapon", src, data.name) + TriggerClientEvent('weapons:client:SyncRepairShops', -1, Config.WeaponRepairPoints[RepairPoint], RepairPoint) + + SetTimeout(Timeout, function() + Config.WeaponRepairPoints[RepairPoint].IsRepairing = false + Config.WeaponRepairPoints[RepairPoint].RepairingData.Ready = true + TriggerClientEvent('weapons:client:SyncRepairShops', -1, Config.WeaponRepairPoints[RepairPoint], RepairPoint) + exports['qb-phone']:sendNewMailToOffline(Player.PlayerData.citizenid, { + sender = Lang:t('mail.sender'), + subject = Lang:t('mail.subject'), + message = Lang:t('mail.message', { value = WeaponData.label }) + }) + SetTimeout(7 * 60000, function() + if Config.WeaponRepairPoints[RepairPoint].RepairingData.Ready then + Config.WeaponRepairPoints[RepairPoint].IsRepairing = false + Config.WeaponRepairPoints[RepairPoint].RepairingData = {} + TriggerClientEvent('weapons:client:SyncRepairShops', -1, Config.WeaponRepairPoints[RepairPoint], RepairPoint) + end + end) + end) + cb(true) + else + cb(false) + end + else + TriggerClientEvent("QBCore:Notify", src, Lang:t('error.no_damage_on_weapon'), "error") + cb(false) + end + else + TriggerClientEvent("QBCore:Notify", src, Lang:t('error.no_damage_on_weapon'), "error") + cb(false) + end + else + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.no_weapon_in_hand'), "error") + TriggerClientEvent('weapons:client:SetCurrentWeapon', src, {}, false) + cb(false) + end +end) + +QBCore.Functions.CreateCallback('prison:server:checkThrowable', function(source, cb, weapon) + local Player = QBCore.Functions.GetPlayer(source) + + if not Player then return cb(false) end + local throwable = false + for _,v in pairs(Config.Throwables) do + if QBCore.Shared.Weapons[weapon].name == 'weapon_'..v then + if not Player.Functions.RemoveItem('weapon_'..v, 1) then return cb(false) end + throwable = true + break + end + end + cb(throwable) +end) + +-- Events + +RegisterNetEvent("weapons:server:UpdateWeaponAmmo", function(CurrentWeaponData, amount) + local src = source + local Player = QBCore.Functions.GetPlayer(src) + amount = tonumber(amount) + if CurrentWeaponData then + if Player.PlayerData.items[CurrentWeaponData.slot] then + Player.PlayerData.items[CurrentWeaponData.slot].info.ammo = amount + end + Player.Functions.SetInventory(Player.PlayerData.items, true) + end +end) + +RegisterNetEvent("weapons:server:TakeBackWeapon", function(k) + local src = source + local Player = QBCore.Functions.GetPlayer(src) + if not Player then return end + local itemdata = Config.WeaponRepairPoints[k].RepairingData.WeaponData + itemdata.info.quality = 100 + Player.Functions.AddItem(itemdata.name, 1, false, itemdata.info) + TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[itemdata.name], "add") + Config.WeaponRepairPoints[k].IsRepairing = false + Config.WeaponRepairPoints[k].RepairingData = {} + TriggerClientEvent('weapons:client:SyncRepairShops', -1, Config.WeaponRepairPoints[k], k) +end) + +RegisterNetEvent("weapons:server:SetWeaponQuality", function(data, hp) + local src = source + local Player = QBCore.Functions.GetPlayer(src) + if not Player then return end + local WeaponSlot = Player.PlayerData.items[data.slot] + WeaponSlot.info.quality = hp + Player.Functions.SetInventory(Player.PlayerData.items, true) +end) + +RegisterNetEvent('weapons:server:UpdateWeaponQuality', function(data, RepeatAmount) + local src = source + local Player = QBCore.Functions.GetPlayer(src) + local WeaponData = QBCore.Shared.Weapons[GetHashKey(data.name)] + local WeaponSlot = Player.PlayerData.items[data.slot] + local DecreaseAmount = Config.DurabilityMultiplier[data.name] + if WeaponSlot then + if not IsWeaponBlocked(WeaponData.name) then + if WeaponSlot.info.quality then + for _ = 1, RepeatAmount, 1 do + if WeaponSlot.info.quality - DecreaseAmount > 0 then + WeaponSlot.info.quality = WeaponSlot.info.quality - DecreaseAmount + else + WeaponSlot.info.quality = 0 + TriggerClientEvent('inventory:client:UseWeapon', src, data, false) + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.weapon_broken_need_repair'), "error") + break + end + end + else + WeaponSlot.info.quality = 100 + for _ = 1, RepeatAmount, 1 do + if WeaponSlot.info.quality - DecreaseAmount > 0 then + WeaponSlot.info.quality = WeaponSlot.info.quality - DecreaseAmount + else + WeaponSlot.info.quality = 0 + TriggerClientEvent('inventory:client:UseWeapon', src, data, false) + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.weapon_broken_need_repair'), "error") + break + end + end + end + end + end + Player.Functions.SetInventory(Player.PlayerData.items, true) +end) + +RegisterNetEvent("weapons:server:EquipAttachment", function(ItemData, CurrentWeaponData, AttachmentData) + local src = source + local Player = QBCore.Functions.GetPlayer(src) + local Inventory = Player.PlayerData.items + local GiveBackItem = nil + if Inventory[CurrentWeaponData.slot] then + if Inventory[CurrentWeaponData.slot].info.attachments and next(Inventory[CurrentWeaponData.slot].info.attachments) then + local currenttype = GetAttachmentType(Inventory[CurrentWeaponData.slot].info.attachments) + local HasAttach, key = HasAttachment(AttachmentData.component, Inventory[CurrentWeaponData.slot].info.attachments) + if not HasAttach then + if AttachmentData.type ~=nil and currenttype == AttachmentData.type then + for _, v in pairs(Inventory[CurrentWeaponData.slot].info.attachments) do + if v.type and v.type == currenttype then + GiveBackItem = tostring(v.item):lower() + table.remove(Inventory[CurrentWeaponData.slot].info.attachments, key) + TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[GiveBackItem], "add") + end + end + end + Inventory[CurrentWeaponData.slot].info.attachments[#Inventory[CurrentWeaponData.slot].info.attachments+1] = { + component = AttachmentData.component, + label = QBCore.Shared.Items[AttachmentData.item].label, + item = AttachmentData.item, + type = AttachmentData.type, + } + TriggerClientEvent("addAttachment", src, AttachmentData.component) + Player.Functions.SetInventory(Player.PlayerData.items, true) + Player.Functions.RemoveItem(ItemData.name, 1) + SetTimeout(1000, function() + TriggerClientEvent('inventory:client:ItemBox', src, ItemData, "remove") + end) + else + TriggerClientEvent("QBCore:Notify", src, Lang:t('error.attachment_already_on_weapon' , { value = QBCore.Shared.Items[AttachmentData.item].label }), "error", 3500) + end + else + Inventory[CurrentWeaponData.slot].info.attachments = {} + Inventory[CurrentWeaponData.slot].info.attachments[#Inventory[CurrentWeaponData.slot].info.attachments+1] = { + component = AttachmentData.component, + label = QBCore.Shared.Items[AttachmentData.item].label, + item = AttachmentData.item, + type = AttachmentData.type, + } + TriggerClientEvent("addAttachment", src, AttachmentData.component) + Player.Functions.SetInventory(Player.PlayerData.items, true) + Player.Functions.RemoveItem(ItemData.name, 1) + SetTimeout(1000, function() + TriggerClientEvent('inventory:client:ItemBox', src, ItemData, "remove") + end) + end + end + if GiveBackItem then + Player.Functions.AddItem(GiveBackItem, 1, false) + end +end) + +RegisterNetEvent('weapons:server:removeWeaponAmmoItem', function(item) + local Player = QBCore.Functions.GetPlayer(source) + + if not Player or type(item) ~= 'table' or not item.name or not item.slot then return end + + Player.Functions.RemoveItem(item.name, 1, item.slot) +end) + +-- Commands + +QBCore.Commands.Add("repairweapon", "Repair Weapon (God Only)", {{name="hp", help=Lang:t('info.hp_of_weapon')}}, true, function(source, args) + TriggerClientEvent('weapons:client:SetWeaponQuality', source, tonumber(args[1])) +end, "god") + +-- Items + +-- AMMO +QBCore.Functions.CreateUseableItem('pistol_ammo', function(source, item) + TriggerClientEvent('weapons:client:AddAmmo', source, 'AMMO_PISTOL', 12, item) +end) + +QBCore.Functions.CreateUseableItem('rifle_ammo', function(source, item) + TriggerClientEvent('weapons:client:AddAmmo', source, 'AMMO_RIFLE', 30, item) +end) + +QBCore.Functions.CreateUseableItem('smg_ammo', function(source, item) + TriggerClientEvent('weapons:client:AddAmmo', source, 'AMMO_SMG', 20, item) +end) + +QBCore.Functions.CreateUseableItem('shotgun_ammo', function(source, item) + TriggerClientEvent('weapons:client:AddAmmo', source, 'AMMO_SHOTGUN', 10, item) +end) + +QBCore.Functions.CreateUseableItem('mg_ammo', function(source, item) + TriggerClientEvent('weapons:client:AddAmmo', source, 'AMMO_MG', 30, item) +end) + +QBCore.Functions.CreateUseableItem('snp_ammo', function(source, item) + TriggerClientEvent('weapons:client:AddAmmo', source, 'AMMO_SNIPER', 10, item) +end) + +QBCore.Functions.CreateUseableItem('emp_ammo', function(source, item) + TriggerClientEvent('weapons:client:AddAmmo', source, 'AMMO_EMPLAUNCHER', 10, item) +end) + +-- TINTS +QBCore.Functions.CreateUseableItem('weapontint_black', function(source) + TriggerClientEvent('weapons:client:EquipTint', source, 0) +end) + +QBCore.Functions.CreateUseableItem('weapontint_green', function(source) + TriggerClientEvent('weapons:client:EquipTint', source, 1) +end) + +QBCore.Functions.CreateUseableItem('weapontint_gold', function(source) + TriggerClientEvent('weapons:client:EquipTint', source, 2) +end) + +QBCore.Functions.CreateUseableItem('weapontint_pink', function(source) + TriggerClientEvent('weapons:client:EquipTint', source, 3) +end) + +QBCore.Functions.CreateUseableItem('weapontint_army', function(source) + TriggerClientEvent('weapons:client:EquipTint', source, 4) +end) + +QBCore.Functions.CreateUseableItem('weapontint_lspd', function(source) + TriggerClientEvent('weapons:client:EquipTint', source, 5) +end) + +QBCore.Functions.CreateUseableItem('weapontint_orange', function(source) + TriggerClientEvent('weapons:client:EquipTint', source, 6) +end) + +QBCore.Functions.CreateUseableItem('weapontint_plat', function(source) + TriggerClientEvent('weapons:client:EquipTint', source, 7) +end) + +-- ATTACHMENTS +QBCore.Functions.CreateUseableItem('pistol_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('pistol_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('pistol_flashlight', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'flashlight') +end) + +QBCore.Functions.CreateUseableItem('pistol_suppressor', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'suppressor') +end) + +QBCore.Functions.CreateUseableItem('pistol_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('combatpistol_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('combatpistol_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('combatpistol_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('appistol_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('appistol_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('appistol_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('pistol50_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('pistol50_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('pistol50_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('heavypistol_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('revolver_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('doubleaction_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('revolver_vipvariant', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'vipvariant') +end) + +QBCore.Functions.CreateUseableItem('revolver_bodyguardvariant', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'bodyguardvariant') +end) + +QBCore.Functions.CreateUseableItem('snspistol_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('snspistol_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('snspistol_grip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'grip') +end) + +QBCore.Functions.CreateUseableItem('heavypistol_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('heavypistol_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('heavypistol_grip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'grip') +end) + +QBCore.Functions.CreateUseableItem('vintagepistol_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('vintagepistol_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('combatpistol_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('microsmg_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('microsmg_scope', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'scope') +end) + +QBCore.Functions.CreateUseableItem('microsmg_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('smg_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('smg_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('smg_suppressor', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'suppressor') +end) + +QBCore.Functions.CreateUseableItem('smg_drum', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'drum') +end) + +QBCore.Functions.CreateUseableItem('smg_scope', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'scope') +end) + +QBCore.Functions.CreateUseableItem('smg_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('assaultsmg_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('assaultsmg_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('pumpshotgun_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('sawnoffshotgun_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('assaultsmg_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('minismg_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('minismg_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('machinepistol_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('machinepistol_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('machinepistol_drum', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'drum') +end) + +QBCore.Functions.CreateUseableItem('combatpdw_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('combatpdw_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('combatpistol_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('emplauncher_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('combatpdw_drum', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'drum') +end) + +QBCore.Functions.CreateUseableItem('combatpdw_grip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'grip') +end) + +QBCore.Functions.CreateUseableItem('combatpdw_scope', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'scope') +end) + +QBCore.Functions.CreateUseableItem('shotgun_suppressor', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'suppressor') +end) + +QBCore.Functions.CreateUseableItem('pumpshotgun_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('sawnoffshotgun_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('sniper_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('assaultshotgun_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('assaultshotgun_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('heavyshotgun_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('heavyshotgun_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('heavyshotgun_drum', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'drum') +end) + +QBCore.Functions.CreateUseableItem('assaultrifle_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('assaultrifle_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('assaultrifle_drum', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'drum') +end) + +QBCore.Functions.CreateUseableItem('rifle_flashlight', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'flashlight') +end) + +QBCore.Functions.CreateUseableItem('rifle_grip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'grip') +end) + +QBCore.Functions.CreateUseableItem('rifle_suppressor', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'suppressor') +end) + +QBCore.Functions.CreateUseableItem('sniperrifle_suppressor', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'suppressor') +end) + +QBCore.Functions.CreateUseableItem('assaultrifle_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('carbinerifle_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('carbinerifle_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('carbinerifle_drum', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'drum') +end) + +QBCore.Functions.CreateUseableItem('combatpdw_grip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'grip') +end) + +QBCore.Functions.CreateUseableItem('carbinerifle_scope', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'scope') +end) + +QBCore.Functions.CreateUseableItem('carbinerifle_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('advancedrifle_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('advancedrifle_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('advancedrifle_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('specialcarbine_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('specialcarbine_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('bullpupshotgun_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('specialcarbine_drum', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'drum') +end) + +QBCore.Functions.CreateUseableItem('specialcarbine_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('bullpuprifle_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('bullpuprifle_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('bullpuprifle_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('compactrifle_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('compactrifle_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('compactrifle_drum', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'drum') +end) + +QBCore.Functions.CreateUseableItem('gusenberg_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('gusenberg_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('microsmg_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('microsmg_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('sniperrifle_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('sniper_scope', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'scope') +end) + +QBCore.Functions.CreateUseableItem('snipermax_scope', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'scope') +end) + +QBCore.Functions.CreateUseableItem('sniper_grip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'grip') +end) + +QBCore.Functions.CreateUseableItem('heavysniper_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('heavysniper_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('marksmanrifle_defaultclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'defaultclip') +end) + +QBCore.Functions.CreateUseableItem('marksmanrifle_extendedclip', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'extendedclip') +end) + +QBCore.Functions.CreateUseableItem('marksmanrifle_scope', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'scope') +end) + +QBCore.Functions.CreateUseableItem('marksmanrifle_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) + +QBCore.Functions.CreateUseableItem('snspistol_luxuryfinish', function(source, item) + TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'luxuryfinish') +end) diff --git a/[qb]/qb-weapons/weaponsnspistol.meta b/[qb]/qb-weapons/weaponsnspistol.meta new file mode 100644 index 0000000..867d378 --- /dev/null +++ b/[qb]/qb-weapons/weaponsnspistol.meta @@ -0,0 +1,331 @@ + + + + + + + + + SLOT_SNSPISTOL + + + + + + + + SLOT_SNSPISTOL + + + + + + + + + SLOT_SNSPISTOL + + + + + + + + + + + + + + + WEAPON_SNSPISTOL + w_pi_sns_pistol + + SLOT_SNSPISTOL + BULLET + + DONTCARE + DONTCARE + DONTCARE + DONTCARE + DONTCARE + DONTCARE + + INSTANT_HIT + WHEEL_PISTOL + GROUP_PISTOL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BONETAG_HEAD + + + + + BONETAG_NECK + + + + + BONETAG_L_THIGH + + + + + BONETAG_R_THIGH + + + + + BONETAG_L_CALF + + + + + BONETAG_R_CALF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WEAPON_EFFECT_GROUP_PISTOL_SMALL + muz_smg + + + + + + + + + eject_pistol + + bullet_tracer + BulletSmall + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DEFAULT_THIRD_PERSON_PED_AIM_CAMERA + DEFAULT_THIRD_PERSON_PED_AIM_IN_COVER_CAMERA + + DEFAULT_THIRD_PERSON_PED_RUN_AND_GUN_CAMERA + DEFAULT_THIRD_PERSON_PED_CINEMATIC_SHOOTING_CAMERA + + + + + + + + + + + + + + + + + + + + + + + + + + PISTOL_RECOIL_SHAKE + FPS_PISTOL_RECOIL_SHAKE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WEAPON_PISTOL + + PICKUP_WEAPON_SNSPISTOL + PICKUP_AMMO_BULLET_MP + WT_SNSPISTOL + MMI_1Handed + SNSPISTOL + + + normal + + + WAPClip + + + COMPONENT_SNSPISTOL_CLIP_01 + + + + COMPONENT_SNSPISTOL_CLIP_02 + + + + + + + Pistol + CarriedInHand Gun CanLockonOnFoot CanLockonInVehicle CanFreeAim AnimReload AnimCrouchFire UsableOnFoot UsableClimbing UsableInCover AllowCloseQuarterKills HasLowCoverReloads HasLowCoverSwaps QuitTransitionToIdleIntroOnWeaponChange DisableLeftHandIkWhenOnFoot TorsoIKForWeaponBlock UseFPSAimIK UseFPSSecondaryMotion + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DLC - 'Saturday Night Special' Pistol + \ No newline at end of file diff --git a/[qb]/qb-weathersync/.github/ISSUE_TEMPLATE/bug_report.md b/[qb]/qb-weathersync/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..62f702f --- /dev/null +++ b/[qb]/qb-weathersync/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,32 @@ +--- +name: Bug report +about: Create a report to help us improve or fix something +title: "[BUG]" +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. A stranger to qbcore should be able to read your bug report and understand how to reproduce it themselves and understand how the feature should work normally. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Use this item '....' (item's name from shared.lua if applicable) +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Questions (please complete the following information):** + - When you last updated: [e.g. last week] + - Are you using custom resource? which ones? [e.g. zdiscord, qb-target] + - Have you renamed `qb-` to something custom? [e.g. yes/no] + +**Additional context** +Add any other context about the problem here. diff --git a/[qb]/qb-weathersync/.github/ISSUE_TEMPLATE/feature-request.md b/[qb]/qb-weathersync/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000..9e9bf3e --- /dev/null +++ b/[qb]/qb-weathersync/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,20 @@ +--- +name: Feature Request +about: Suggest an idea for QBCore +title: "[SUGGESTION]" +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. + +**Describe the feature you'd like** +A clear and concise description of what you want to happen. and with as much detail as possible how it would function in your opinion. Please try to keep it unique. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered for people to have in mind just in case the main idea isn't liked but a derivative is. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/[qb]/qb-weathersync/.github/auto_assign.yml b/[qb]/qb-weathersync/.github/auto_assign.yml new file mode 100644 index 0000000..2a80921 --- /dev/null +++ b/[qb]/qb-weathersync/.github/auto_assign.yml @@ -0,0 +1,17 @@ +# Set to true to add reviewers to pull requests +addReviewers: true + +# Set to true to add assignees to pull requests +addAssignees: author + +# A list of reviewers to be added to pull requests (GitHub user name) +reviewers: + - /maintenance + +# A list of keywords to be skipped the process that add reviewers if pull requests include it +skipKeywords: + - wip + +# A number of reviewers added to the pull request +# Set 0 to add all the reviewers (default: 0) +numberOfReviewers: 0 \ No newline at end of file diff --git a/[qb]/qb-weathersync/.github/contributing.md b/[qb]/qb-weathersync/.github/contributing.md new file mode 100644 index 0000000..21fb806 --- /dev/null +++ b/[qb]/qb-weathersync/.github/contributing.md @@ -0,0 +1,201 @@ +# Contributing to QBCore + +First of all, thank you for taking the time to contribute! + +These guidelines will help you help us in the best way possible regardless of your skill level. We ask that you try to read everything related to the way you'd like to contribute and try and use your best judgement for anything not covered. + +### Table of Contents + +[Code of Conduct](#code-of-conduct) + +[I don't want to read this whole thing, I just have a question!!!](#i-dont-want-to-read-this-whole-thing-i-just-have-a-question) + +[How Can I Contribute?](#how-can-i-contribute) + * [Reporting Bugs](#reporting-bugs) + * [Suggesting Features / Enhancements](#suggesting-features--enhancements) + * [Your First Code Contribution](#your-first-code-contribution) + * [Pull Requests](#pull-requests) + +[Styleguides](#styleguides) + * [Git Commit Messages](#git-commit-messages) + * [Lua Styleguide](#lua-styleguide) + * [JavaScript Styleguide](#javascript-styleguide) + + + +## Code of Conduct + +- Refrain from using languages other than English. +- Refrain from discussing any politically charged or inflammatory topics. +- Uphold mature conversations and respect each other; excessive profanity, hate speech or any kind of harassment will not be tolerated. +- No advertising of any kind. +- Follow these guidelines. +- Do not mention members of github unless a question is directed at them and can't be answered by anyone else. +- Do not mention any of the development team for any reason. We will read things as we get to them. + +## I don't want to read this whole thing I just have a question!!! + +> **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below. + +* [QBCore Website](https://qbcore.org) +* [QBCore Discord](https://discord.gg/qbcore) +* [FiveM Discord - #qbcore channel](https://discord.gg/fivem) + + + + + + + + + + +## How Can I Contribute? + +### Reporting Bugs + +The easiest way to contribute for most people is just to report bugs you find cause if nobody reports it there's a chance we'll never know it exists and then we'll never fix it. + +Before creating bug reports, please check [this list](#before-submitting-a-bug-report) as you might find out that you don't need to create one. When you are creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out the bug-report template with the information it asks for helps us resolve issues faster. + +> **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one. + +#### Before Submitting A Bug Report + +* **Check the docs** There's a chance what you see as a bug might just work differently than you expect and if you think it could work better consider a feature enhancement report instead. +* **Search the [discord](https://discord.gg/qbcore)** to see if anyone else has run into the issue and see if it was solved through user error or code changes. (if the code change isn't pending a PR and you know what you're doing consider submitting one following [Pull Requests](#pull-requests) ) +* **Determine which resource the problem should be reported in**. If the bug is related to the inventory for example report this bug under qb-inventory rather than under qb-core or some other resource. +* **Perform a [cursory search](https://github.com/search?q=+is%3Aissue+user%3Aqbcore-framework)** to see if the problem has already been reported. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one. + +#### How Do I Submit A (Good) Bug Report? + +Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). After you've determined which resource your bug is related to, create an issue on that repository and provide the following information by filling in bug-report template. + +Explain the problem and include additional details to help maintainers reproduce the problem: + +* **Use a clear and descriptive title** for the issue to identify the problem. +* **Describe the exact steps which reproduce the problem** in as many details as possible. +* **Provide specific examples to demonstrate the steps**. If something happened with only a specific group or single item but not others, specify that. +* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior. +* **Explain which behavior you expected to see instead and why.** +* **Include screenshots** which show the specific bug in action or before and after. +* **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below. + +Provide more context by answering these questions if possible: + +* **Did the problem start happening recently** (e.g. after updating to a new version of QBCore?) or was this always a problem? +* If the problem started happening recently, **can you reproduce the problem in an older version of QBCore?** What's the most recent commit in which the problem doesn't happen? +* **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens. + +Include details about your setup: + +* **When was your QBCore last updated?** +* **What OS is the server running on**? +* **Which *extra* resources do you have installed?** + + +--- + + +### Suggesting Features / Enhancements + +This section guides you through submitting an enhancement suggestion for QBCore, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion. + +Before creating enhancement suggestions, please check [this list](#before-submitting-an-enhancement-suggestion) as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-enhancement-suggestion). Fill in feature request template, including the steps that you imagine you would take if the feature you're requesting existed. + +#### Before Submitting An Enhancement Suggestion + +* **Make sure it doesn't already exist.** Sounds silly, but there's a lot of features built in to qbcore that people don't realize so take a look through the docs and stuff to make sure it's not already there. +* **Check if there's already PR which provides that enhancement.** +* **Determine which resource the enhancement should be suggested in.** if it fits with another resource suggest it in that resource. if it would be it's own resource suggest it in the main qb-core repository. +* **Perform a [cursory search](https://github.com/search?q=+is%3Aissue+user%3Aqbcore-framework)** to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. + +#### How Do I Submit A (Good) Enhancement Suggestion? + +Enhancement suggestions are tracked as [GitHub issues](https://guides.github.com/features/issues/). After you've determined which resource your enhancement suggestion is related to, create an issue on that repository and provide the following information: + +* **Use a clear and descriptive title** for the issue to identify the suggestion. +* **Provide a step-by-step description of the suggested enhancement** in as many details as possible. +* **Provide specific examples to demonstrate the steps**. Include copy/pasteable snippets which you use in those examples, as [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines). +* **Describe the current behavior** and **explain which behavior you expected to see instead** and why. +* **Include screenshots and animated GIFs** which help you demonstrate the steps or point out the part of QBCore which the suggestion is related to. +* **Explain why this enhancement would be useful.** +* **Be creative and unique.** Stealing ideas from popular servers 1:1 detail isn't going to get accepted. + + +--- + + + +### Your First Code Contribution + +Unsure where to begin contributing to QBCore? You can start by looking through these `beginner` and `help-wanted` issues. + + + +--- + + +### Pull Requests + +The process described here has several goals: + +- Maintain QBCore's quality. +- Fix problems that are important to users. +- Engage the community in working toward the best possible QBCore. +- Enable a sustainable system for QBCore's maintainers to review contributions. + +Please follow these steps to have your contribution considered by the maintainers: + +1. Follow all instructions in The Pull Request template. +2. Follow the [styleguides](#styleguides). +3. Await review by the reviewer(s). + +While the prerequisites above must be satisfied prior to having your pull request reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted. + + +--- + +## Styleguides + +### Git Commit Messages + +* Limit the first line to 72 characters or less. +* Reference issues and pull requests liberally after the first line. +* Consider starting the commit message with an applicable emoji: + * :art: `:art:` when improving the format/structure of the code + * :racehorse: `:racehorse:` when improving performance + * :memo: `:memo:` when writing docs + * :bug: `:bug:` when fixing a bug + * :fire: `:fire:` when removing code or files + * :white_check_mark: `:white_check_mark:` when adding tests + * :lock: `:lock:` when dealing with security + * :arrow_up: `:arrow_up:` when upgrading dependencies + * :arrow_down: `:arrow_down:` when downgrading dependencies + * :shirt: `:shirt:` when removing linter warnings + +### Lua Styleguide + +All lua code should be done using all the best practices of proper lua using the easiest to read yet fastest/most optimized methods of execution. + +- Use 4 Space indentation +- Aim for lua 5.4 (include `lua54 'yes'` in the fxmanifest.lua) +- Use `PlayerPedId()` instead of `GetPlayerPed(-1)` +- Use `#(vector3 - vector3)` instead of `GetDistanceBetweenCoords()` +- Don't create unnecessary threads. always try to find a better method of triggering events +- Don't repeat yourself.. if you're using the same operations in many different places convert them into a function with flexible variables +- For distance checking loops set longer waits if you're outside of a range +- Job specific loops should only run for players with that job, don't waste cycles +- When possible don't trust the client, esspecially with transactions +- Balance security and optimizations +- [Consider this Lua Performance guide](https://springrts.com/wiki/Lua_Performance) +- Use local varriables everywhere possible +- Make use of config options where it makes sense making features optional or customizable +- Instead of `table.insert(myTable, "Value")` use `myTable[#myTable + 1] = "Value"` +- Instead of `table.insert(ages, "bob", 30)` use `ages["bob"] = 30` + + +### JavaScript Styleguide + +- Use 4 Space indentation +- Don't repeat yourself.. if you're using the same operations in many different places convert them into a function with flexible variables. diff --git a/[qb]/qb-weathersync/.github/pull_request_template.md b/[qb]/qb-weathersync/.github/pull_request_template.md new file mode 100644 index 0000000..000f0f9 --- /dev/null +++ b/[qb]/qb-weathersync/.github/pull_request_template.md @@ -0,0 +1,10 @@ +**Describe Pull request** +First, make sure you've read and are following the contribution guidelines and style guide and your code reflects that. +Write up a clear and concise description of what your pull request adds or fixes and if it's an added feature explain why you think it should be included in the core. + +If your PR is to fix an issue mention that issue here + +**Questions (please complete the following information):** +- Have you personally loaded this code into an updated qbcore project and checked all it's functionality? [yes/no] (Be honest) +- Does your code fit the style guidelines? [yes/no] +- Does your PR fit the contribution guidelines? [yes/no] diff --git a/[qb]/qb-weathersync/.github/workflows/lint.yml b/[qb]/qb-weathersync/.github/workflows/lint.yml new file mode 100644 index 0000000..fb74fd6 --- /dev/null +++ b/[qb]/qb-weathersync/.github/workflows/lint.yml @@ -0,0 +1,23 @@ +name: Lint +on: [push, pull_request_target] +jobs: + lint: + name: Lint Resource + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Lint + uses: iLLeniumStudios/fivem-lua-lint-action@v2 + with: + capture: "junit.xml" + args: "-t --formatter JUnit" + extra_libs: mysql+polyzone+qblocales + - name: Generate Lint Report + if: always() + uses: mikepenz/action-junit-report@v3 + with: + report_paths: "**/junit.xml" + check_name: Linting Report + fail_on_failure: false \ No newline at end of file diff --git a/[qb]/qb-weathersync/LICENSE b/[qb]/qb-weathersync/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/[qb]/qb-weathersync/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/[qb]/qb-weathersync/README.md b/[qb]/qb-weathersync/README.md new file mode 100644 index 0000000..e92497a --- /dev/null +++ b/[qb]/qb-weathersync/README.md @@ -0,0 +1,200 @@ +# qb-weathersync +Synced weather and time for QB-Core Framework :sunrise: + +# License + + QBCore Framework + Copyright (C) 2021 Joshua Eger + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + + +## Dependencies +- [qb-core](https://github.com/qbcore-framework/qb-core) + +## Features +- Syncs the weather for all players + +## Installation +### Manual +- Download the script and put it in the `[qb]` directory. +- Add the following code to your server.cfg/resouces.cfg +``` +ensure qb-core +ensure qb-weathersync +``` + +## Configuration +You can adjust available weather and defaults in `config.lua` +to adjust weather patterns you need to modify nextWeatherStage() in `server/server.lua` + + + +## Commands + +`/freezetime` - Toggle time progression + +`/freezeweather` - Toggle dynamic weather + +`/weather [type]` - Set weather + +`/blackout` - Toggle blackout + +`/morning` - Set time to 9am + +`/noon` - Set time to 12pm + +`/evening` - Set time to 6pm + +`/night` - Set time to 11pm + +`/time [hour] (minute)` - Set time to whatever you want + +## Exports + +### nextWeatherStage +Triggers event to switch weather to next stage +```lua +-- LUA EXAMPLE +local success = exports["qb-weathersync"]:nextWeatherStage(); +``` +```js +// JAVASCRIPT EXAMPLE +const success = global.exports["qb-weathersync"].nextWeatherStage(); +``` + + +### setWeather [type] +Switch to a specified weather type from Config.AvailableWeatherTypes +```lua +-- LUA EXAMPLE +local success = exports["qb-weathersync"]:setWeather("snow"); +``` +```js +// JAVASCRIPT EXAMPLE +const success = global.exports["qb-weathersync"].setWeather("snow"); +``` + + +### setTime [hour] (minute) +Sets sun position based on time to specified +```lua +-- LUA EXAMPLE +local success = exports["qb-weathersync"]:setTime(8, 10); -- 8:10 AM +``` +```js +// JAVASCRIPT EXAMPLE +const success = global.exports["qb-weathersync"].setTime(15, 30); // 3:30PM +``` + + +### setBlackout (true|false) +Sets or toggles blackout state and returns the state +```lua +-- LUA EXAMPLE +local newStatus = exports["qb-weathersync"]:setBlackout(); -- Toggle +``` +```js +// JAVASCRIPT EXAMPLE +const newStatus = global.exports["qb-weathersync"].setBlackout(true); // Enable +``` + + +### setTimeFreeze (true|false) +Sets or toggles time freeze state and returns the state +```lua +-- LUA EXAMPLE +local newStatus = exports["qb-weathersync"]:setTimeFreeze(); -- Toggle +``` +```js +// JAVASCRIPT EXAMPLE +const newStatus = global.exports["qb-weathersync"].setTimeFreeze(true); // Enable +``` + + +### setDynamicWeather (true|false) +Sets or toggles dynamic weather state and returns the state +```lua +-- LUA EXAMPLE +local newStatus = exports["qb-weathersync"]:setDynamicWeather(); -- Toggle +``` +```js +// JAVASCRIPT EXAMPLE +const newStatus = global.exports["qb-weathersync"].setDynamicWeather(true); // Enable +``` + + +### getBlackoutState +Returns if blackout is enabled or disabled +```lua +-- LUA EXAMPLE +local state = exports["qb-weathersync"]:getBlackoutState(); +``` +```js +// JAVASCRIPT EXAMPLE +const state = global.exports["qb-weathersync"].getBlackoutState(); +``` + + +### getTimeFreezeState +Returns if time progression is enabled or disabled +```lua +-- LUA EXAMPLE +local state = exports["qb-weathersync"]:getTimeFreezeState(); +``` +```js +// JAVASCRIPT EXAMPLE +const state = global.exports["qb-weathersync"].getTimeFreezeState(); +``` + + +### getWeatherState +Returns the current weather type +```lua +-- LUA EXAMPLE +local currentWeather = exports["qb-weathersync"]:getWeatherState(); +``` +```js +// JAVASCRIPT EXAMPLE +const currentWeather = global.exports["qb-weathersync"].getWeatherState(); +``` + + +### getDynamicWeather +Returns if time progression is enabled or disabled +```lua +-- LUA EXAMPLE +local state = exports["qb-weathersync"]:getDynamicWeather(); +``` +```js +// JAVASCRIPT EXAMPLE +const state = global.exports["qb-weathersync"].getDynamicWeather(); +``` + + +## Events + + +`qb-weathersync:server:RequestStateSync` - Sync time and weather for everyone + +`qb-weathersync:server:setWeather` [type] - Set Weather type (List in Config) + +`qb-weathersync:server:setTime` [hour] (minute) - Set simulated time + +`qb-weathersync:server:toggleBlackout` (true|false) - Enable, disable or toggle blackout + +`qb-weathersync:server:toggleFreezeTime` (true|false) (minute) - Enable, disable or toggle time progression + +`qb-weathersync:server:toggleDynamicWeather` (true|false) - Enable, disable or toggle dynamic weather + diff --git a/[qb]/qb-weathersync/client/client.lua b/[qb]/qb-weathersync/client/client.lua new file mode 100644 index 0000000..a3d6952 --- /dev/null +++ b/[qb]/qb-weathersync/client/client.lua @@ -0,0 +1,109 @@ +local CurrentWeather = Config.StartWeather +local lastWeather = CurrentWeather +local baseTime = Config.BaseTime +local timeOffset = Config.TimeOffset +local timer = 0 +local freezeTime = Config.FreezeTime +local blackout = Config.Blackout +local blackoutVehicle = Config.BlackoutVehicle +local disable = Config.Disabled + +RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() + disable = false + TriggerServerEvent('qb-weathersync:server:RequestStateSync') +end) + +RegisterNetEvent('qb-weathersync:client:EnableSync', function() + disable = false + TriggerServerEvent('qb-weathersync:server:RequestStateSync') +end) + +RegisterNetEvent('qb-weathersync:client:DisableSync', function() + disable = true + CreateThread(function() + while disable do + SetRainLevel(0.0) + SetWeatherTypePersist('CLEAR') + SetWeatherTypeNow('CLEAR') + SetWeatherTypeNowPersist('CLEAR') + NetworkOverrideClockTime(18, 0, 0) + Wait(5000) + end + end) +end) + +RegisterNetEvent('qb-weathersync:client:SyncWeather', function(NewWeather, newblackout) + CurrentWeather = NewWeather + blackout = newblackout +end) + +RegisterNetEvent('qb-weathersync:client:SyncTime', function(base, offset, freeze) + freezeTime = freeze + timeOffset = offset + baseTime = base +end) + +CreateThread(function() + while true do + if not disable then + if lastWeather ~= CurrentWeather then + lastWeather = CurrentWeather + SetWeatherTypeOverTime(CurrentWeather, 15.0) + Wait(15000) + end + Wait(100) -- Wait 0 seconds to prevent crashing. + SetArtificialLightsState(blackout) + SetArtificialLightsStateAffectsVehicles(blackoutVehicle) + ClearOverrideWeather() + ClearWeatherTypePersist() + SetWeatherTypePersist(lastWeather) + SetWeatherTypeNow(lastWeather) + SetWeatherTypeNowPersist(lastWeather) + if lastWeather == 'XMAS' then + SetForceVehicleTrails(true) + SetForcePedFootstepsTracks(true) + else + SetForceVehicleTrails(false) + SetForcePedFootstepsTracks(false) + end + if lastWeather == 'RAIN' then + SetRainLevel(0.3) + elseif lastWeather == 'THUNDER' then + SetRainLevel(0.5) + else + SetRainLevel(0.0) + end + else + Wait(1000) + end + end +end) + +CreateThread(function() + local hour + local minute = 0 + local second = 0 --Add seconds for shadow smoothness + while true do + if not disable then + Wait(0) + local newBaseTime = baseTime + if GetGameTimer() - 22 > timer then --Generate seconds in client side to avoid communiation + second = second + 1 --Minutes are sent from the server every 2 seconds to keep sync + timer = GetGameTimer() + end + if freezeTime then + timeOffset = timeOffset + baseTime - newBaseTime + second = 0 + end + baseTime = newBaseTime + hour = math.floor(((baseTime+timeOffset)/60)%24) + if minute ~= math.floor((baseTime+timeOffset)%60) then --Reset seconds to 0 when new minute + minute = math.floor((baseTime+timeOffset)%60) + second = 0 + end + NetworkOverrideClockTime(hour, minute, second) --Send hour included seconds to network clock time + else + Wait(1000) + end + end +end) diff --git a/[qb]/qb-weathersync/config.lua b/[qb]/qb-weathersync/config.lua new file mode 100644 index 0000000..70dfa2a --- /dev/null +++ b/[qb]/qb-weathersync/config.lua @@ -0,0 +1,31 @@ +Config = {} +Config.DynamicWeather = true -- Set this to false if you don't want the weather to change automatically every 10 minutes. + +-- On server start +Config.StartWeather = 'EXTRASUNNY' -- Default weather default: 'EXTRASUNNY' +Config.BaseTime = 8 -- Time default: 8 +Config.TimeOffset = 0 -- Time offset default: 0 +Config.FreezeTime = false -- freeze time default: false +Config.Blackout = false -- Set blackout default: false +Config.BlackoutVehicle = false -- Set blackout affects vehicles default: false +Config.NewWeatherTimer = 10 -- Time (in minutes) between each weather change default: 10 +Config.Disabled = false -- Set weather disabled default: false + + +Config.AvailableWeatherTypes = { -- DON'T TOUCH EXCEPT IF YOU KNOW WHAT YOU ARE DOING + 'EXTRASUNNY', + 'CLEAR', + 'NEUTRAL', + 'SMOG', + 'FOGGY', + 'OVERCAST', + 'CLOUDS', + 'CLEARING', + 'RAIN', + 'THUNDER', + 'SNOW', + 'BLIZZARD', + 'SNOWLIGHT', + 'XMAS', + 'HALLOWEEN', +} diff --git a/[qb]/qb-weathersync/fxmanifest.lua b/[qb]/qb-weathersync/fxmanifest.lua new file mode 100644 index 0000000..1a25cf0 --- /dev/null +++ b/[qb]/qb-weathersync/fxmanifest.lua @@ -0,0 +1,17 @@ +fx_version 'cerulean' +game 'gta5' + +description 'vSyncRevamped' +version '2.1.0' + +shared_scripts { + 'config.lua', + '@qb-core/shared/locale.lua', + 'locales/en.lua', + 'locales/*.lua' +} + +server_script 'server/server.lua' +client_script 'client/client.lua' + +lua54 'yes' diff --git a/[qb]/qb-weathersync/locales/da.lua b/[qb]/qb-weathersync/locales/da.lua new file mode 100644 index 0000000..6b8095a --- /dev/null +++ b/[qb]/qb-weathersync/locales/da.lua @@ -0,0 +1,65 @@ +local Translations = { + weather = { + now_frozen = 'Vejret er sat på pause.', + now_unfrozen = 'Vejret er nu normalt igen.', + invalid_syntax = 'Ugyldig syntax, korrekt syntax er: /weather ', + invalid_syntaxc = 'Ugyldig syntax, brug /weather istedet!', + updated = 'Vejeret er blevet opdateret.', + invalid = 'Ugyldig vejrtype, typer du kan bruge er: \nEXTRASUNNY CLEAR NEUTRAL SMOG FOGGY OVERCAST CLOUDS CLEARING RAIN THUNDER SNOW BLIZZARD SNOWLIGHT XMAS HALLOWEEN ', + invalidc = 'Ugyldig vejrtype, typer du kan bruge er: \nEXTRASUNNY CLEAR NEUTRAL SMOG FOGGY OVERCAST CLOUDS CLEARING RAIN THUNDER SNOW BLIZZARD SNOWLIGHT XMAS HALLOWEEN ', + willchangeto = 'Vejret vil ændre sig til: %{value}.', + accessdenied = 'Adgangen til /weather er nægtet.', + }, + + dynamic_weather = { + disabled = 'Dynamisk vejr er slået fra.', + enabled = 'Dynamisk vejr er nu slået til.', + }, + time = { + frozenc = 'Tiden er sat på pause.', + unfrozenc = 'Tiden er nu normal igen.', + now_frozen = 'Tiden er nu sat på pause.', + now_unfrozen = 'Tiden er ikke længere sat på pause.', + console = 'For konsollen, brug \"/time \" command istedet!', + morning = 'Tiden er sat til om morgenen.', + noon = 'Tiden er sat til eftermiddag.', + evening = 'Tiden er sat til aften.', + night = 'Tiden er sat til nat.', + change = 'Tiden er sat til %{value}:%{value2}.', + changec = 'Tiden er ændret til: %{value}!', + invalid = 'Ugyldig syntax, korrekt syntax er: time