Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dig/onset-data
https://github.com/dig/onset-data
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dig/onset-data
- Owner: dig
- License: mit
- Created: 2019-12-21T18:09:47.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-21T19:34:54.000Z (almost 5 years ago)
- Last Synced: 2024-06-20T16:08:40.453Z (5 months ago)
- Language: Lua
- Size: 24.4 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-onset - data - A library which adds weapons/vehicles class names and useful functions. (Packages and Plugins / Libraries)
README
# onset-data
Authors: DigitalFeel free to submit pull requests, I plan on adding all class names for objects, vehicles, doors, weapons and clothing.
### Features
* Adds all weapon class names, WEAPON_COLT, WEAPON_DEAGLE, etc.
* Adds all vehicle class names, VEHICLE_GARBAGE_TRUCK, VEHICLE_NASCAR, etc.
* Useful functions for vehicles & weapons.
* All names are in fictional names instead of class names like the base game is. (Pistol01 -> Deagle)### Installation
Download all files from this repository and place them inside your package in a folder called data.
```packages/mypackage/data/```
Add the following to your client_scripts in package.json,
```json
"data/util.lua",
"data/clothing.lua",
"data/doors.lua",
"data/objects.lua",
"data/vehicles.lua",
"data/weapons.lua"
```
Add the following to your server_scripts in package.json,
```json
"data/util.lua",
"data/clothing.lua",
"data/doors.lua",
"data/objects.lua",
"data/vehicles.lua",
"data/weapons.lua"
```### Example
```lua
-- Display weapon WEAPON_COLT's name.
AddPlayerChat(GetWeaponName(WEAPON_COLT)) -- or GetWeaponName(5)-- Find a weapon ID by its name.
local _myWeaponID = GetWeaponByName('Deagle')
AddPlayerChat(_myWeaponID)
```### Functions
#### GetVehicleName
Find a vehicle's name from its ID.
```lua
GetVehicleName(vehicleID)
```
* **vehicleID** A vehicle ID. Example: 5
Returns a string, if vehicle cannot be found then false will be returned.#### GetVehicleByName
Find a vehicle ID by its name or alias.
```lua
GetVehicleByName(vehicleName)
```
* **vehicleName** The vehicle name you are looking for. Example: Ambulance
Returns a vehicle ID integer, if vehicle cannot be found then 0 will be returned.#### GetWeaponName
Find a weapon's name from its ID.
```lua
GetWeaponName(weaponID)
```
* **weaponID** A weapon ID. Example: 5
Returns a string, if weapon cannot be found then false will be returned.#### GetWeaponByName
Find a weapon ID by its name or alias.
```lua
GetWeaponByName(weaponName)
```
* **weaponName** The weapon name you are looking for. Example: Deagle
Returns a weapon ID integer, if weapon cannot be found then 0 will be returned.