Releases: Necroso/VCMP-Lua
Releases · Necroso/VCMP-Lua
Lua Plugin (2.9 Beta)
Release Notes - Lua Plugin Update
The Lua Plugin has been updated to support the latest VC-MP version, bringing new gameplay functions, vehicle controls, and server features.
This release also introduces PostgreSQL support with a new database implementation and improved query handling.
Special thanks to Matheus Lima for contributing the new VC-MP gameplay and server functions added in this update.
Database Migration
The plugin now uses PostgreSQL instead of MySQL.
Improvements
- Replaced MySQL backend with PostgreSQL
- Added automatic reconnect and connection validation
- Added parameterized queries support
- Added native JSON / JSONB support
- Added automatic Lua table ↔ JSON conversion
- Improved query safety and stability
- Better handling for integers, floats, booleans, NULL values, and arrays
PostgreSQL Usage Guide
Creating an Account
local account = PostgreSQL.createAccount("127.0.0.1", "postgres", "password", "database_name", 5432)Creating a Connection
local db = PostgreSQL.createConnection(account)Execute Queries
db:execute("INSERT INTO players(name, score) VALUES($1, $2)", "player_name", 100)Query Data
local result = db:query("SELECT * FROM players WHERE id = $1", 1)
for _, row in ipairs(result) do
print(row.name, row.score)
endJSON Support
Lua tables are automatically converted to PostgreSQL JSON.
local inventory = {
weapons = {
"M4",
"Shotgun"
},
money = 5000
}
db:execute("INSERT INTO users(data) VALUES($1)", inventory)JSON and JSONB fields are automatically converted back to Lua tables when queried.
New Player Functions
Added new player-related API methods:
player:kill()player:set3DArrowToPlayer(Player targetPlayer, bool state)player:get3DArrowToPlayer(Player targetPlayer)player:setDrunkHandling(int drunkLevel)player:getDrunkHandling()player:setDrunkVisuals(int drunkVisual)player:getDrunkVisuals()
New Vehicle Functions
Added new vehicle-related API methods:
vehicle:set3DArrowToPlayer(Player player, bool state)vehicle:get3DArrowToPlayer(Player targetPlayer)
Vehicle Options
Available Options
- Engine
- Boot
- Bonnet
New Server Options
Available Options
disableCrouchbleeding
General Improvements
- Updated compatibility with the latest VC-MP build
- Internal API improvements and refactoring
- Improved synchronization and gameplay control support
- Improved database abstraction layer