📑Miscellaneous Guides
Extra guides and tools are listed here
Keymapping
example
RegisterKeyMapping('togglelocks', 'Toggle Vehicle Locks', 'keyboard', 'L')
The purpose of this system is so that players can completely customize their experience on the server and not be subjected to hard-coded key binds.
Weapon License
By default only a citizen ID and drivers license is redeemable from City Hall. For a player to get a weapons license he needs to see a police officer who will do /grantlicense [id] weapon
for that player to be "granted" access in City Hall.
Police can also do /revoke [id] [licenseType]
to revoke a players ability to purchase a hard copy of the specified license. Revoking the license will not remove the hard copy from the players' inventory if they have one, it will simply remove the ability for them to purchase a new one.
If you would like the players to be granted by default look for this set of code in qb-core/server/player.lua
and change ["weapon"] = false
to ["weapon"] = true
Once a player has been granted a weapons license they will be able to purchase weapons from gun stores that have the requiresLicense
variable set to true
. To restrict weapon sales to individuals with a weapons license see the example config below from qb-shops/config.lua
Onesync-infinity
Onesync-infinity should be enabled by default but if you ever need to enable it you would just put set onesync on
in your server.cfg
Getting the Players
To get a list of players on the server we must use either a native that is like this
Using the QB function you can do it like this
Spawning A Vehicle At A Distance
If you have a script that requires you to create a vehicle at a distance that is outside the infinity scope, you must use the code like below on the SERVER side
This will spawn the entity and callback the entity id which you can then use on the client side to check if the entity exists. It will NOT exist until a client(player) gets within range of it! While a client is NOT in range, the server “owns” the entity. So whenever a client gets into infinity range it then takes ownership of that entity and can be used by them. I know this one is a bit confusing but there’s no good way to explain it.
Database Connection
txAdmin does this automatically already but if needed then in your server.cfg put this and fill it in with the correct information. For the database wrapper oxmysql
Installation
Download the latest build of oxmysql (not the source code).
Extract the contents of the archive to your resources folder.
Start the resource near the top of your resources in your
server.cfg
.If you have a lot of streamed assets, load them first to prevent timing out the connection.
Configuration
You can change the configuration settings by using convars inside your server.cfg
. Reference the following for an idea of how to set your connection options. You must include one of the following lines, adjusted for your connection and database settings.
Certain special characters are reserved or blocked and may cause issues when used in your password. For more optional settings (such as multiple statements) you can reference pool.d.ts and connection.d.ts.
You can also add the following convars if you require extra information when testing queries.
Using the UI
Before using the UI first you have to make sure you have the mysql_ui
convar set to true:
Also make sure that you have command
ace permission access, then you should be able to use the mysql
command in game to open up the UI and see your query data.
Server.cfg
Setting up your server.cfg is really simple and is already completed upon a successful txAdmin recipe install! You can also find additional information on server configuration files here. In case of a manual install then here's a template to use
GitHub Pull Request
Visit the resource you would like to propose changes on
Navigate to the exact file within that resource
Click on the pencil icon and you will be able to make edits to the code
Once you are satisfied with your edits, scroll down to the box labeled "Propose Changes"
Write a title and short description of what the changes are
Once that's filled out, press the green "Propose Changes" button
You will see a screen showing your edits compared to the existing code
If you are satisfied with the edits shown, press the green "Create Pull Request" button
Fill in the title and description if necessary
Click on the green "Create Pull Request" button and it's finished!
If you have email notifications enabled, you will get any updates on the pull request by email
Last updated