Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added start items feature #1108

Merged
merged 2 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions [core]/es_extended/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Config.Accounts = {

Config.StartingAccountMoney = { bank = 50000 }

Config.StartingInventoryItems = { -- table/false
["water"] = 1,
}

Config.DefaultSpawns = { -- If you want to have more spawn positions and select them randomly uncomment commented code or add more locations
{ x = 222.2027, y = -864.0162, z = 30.2922, heading = 1.0 },
Expand Down
24 changes: 16 additions & 8 deletions [core]/es_extended/server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ if Config.Multichar then
newPlayer = newPlayer .. ', `firstname` = ?, `lastname` = ?, `dateofbirth` = ?, `sex` = ?, `height` = ?'
end

if Config.StartingInventoryItems then
newPlayer = newPlayer .. ', `inventory` = ?'
end

if Config.Multichar or Config.Identity then
loadPlayer = loadPlayer .. ', `firstname`, `lastname`, `dateofbirth`, `sex`, `height`'
end
Expand Down Expand Up @@ -77,17 +81,21 @@ function createESXPlayer(identifier, playerId, data)
print(('[^2INFO^0] Player ^5%s^0 Has been granted admin permissions via ^5Ace Perms^7.'):format(playerId))
defaultGroup = "admin"
end


local parameters = {}
if not Config.Multichar then
MySQL.prepare(newPlayer, { json.encode(accounts), identifier, defaultGroup }, function()
loadESXPlayer(identifier, playerId, true)
end)
parameters = { json.encode(accounts), identifier, defaultGroup }
else
MySQL.prepare(newPlayer,
{ json.encode(accounts), identifier, defaultGroup, data.firstname, data.lastname, data.dateofbirth, data.sex, data.height }, function()
loadESXPlayer(identifier, playerId, true)
end)
parameters = { json.encode(accounts), identifier, defaultGroup, data.firstname, data.lastname, data.dateofbirth, data.sex, data.height }
end

if Config.StartingInventoryItems then
table.insert(parameters, json.encode(Config.StartingInventoryItems))
end

MySQL.prepare(newPlayer, parameters, function()
loadESXPlayer(identifier, playerId, true)
end)
end

if not Config.Multichar then
Expand Down
Loading