ed
This commit is contained in:
parent
8955836c2c
commit
7b079c6109
4 changed files with 704 additions and 0 deletions
33
resources/[freizeit]/nordi_ai_train/server.lua
Normal file
33
resources/[freizeit]/nordi_ai_train/server.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
-- Geld prüfen
|
||||
QBCore.Functions.CreateCallback('train:server:canAfford', function(source, cb, price)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if Player then
|
||||
local money = Player.PlayerData.money[Config.DefaultCurrency]
|
||||
if money >= price then
|
||||
Player.Functions.RemoveMoney(Config.DefaultCurrency, price)
|
||||
cb(true)
|
||||
else
|
||||
cb(false)
|
||||
end
|
||||
else
|
||||
cb(false)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Journey Log
|
||||
RegisterNetEvent('train:server:logJourney', function(from, to, price)
|
||||
if not Config.DebugOptions.logJourneys then return end
|
||||
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if Player then
|
||||
print(string.format("[TRAIN] %s (%s) - %s → %s ($%d)",
|
||||
Player.PlayerData.charinfo.firstname .. " " .. Player.PlayerData.charinfo.lastname,
|
||||
Player.PlayerData.citizenid,
|
||||
from, to, price
|
||||
))
|
||||
end
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue