翻译成中文保留源代码
ESX = nilTriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
local invaderlist = {}
RegisterNetEvent('lifeinvader:instert')
AddEventHandler('lifeinvader:instert', function(text)
local xPlayer = ESX.GetPlayerFromId(_source)
table.insert(invaderlist, {name = GetPlayerName(_source), text = text })
end)
ESX.RegisterServerCallback('delion_tablet:getstarted', function(src, cb)
local xPlayer = ESX.GetPlayerFromId(src)
local xInfo = {}
local vehicles = 0
local properties = 0
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @identifier', {['@identifier'] = xPlayer.identifier}, function(result1)
for i,k in pairs(result1) do
vehicles = vehicles + 1
end
xInfo.vehicles = vehicles
MySQL.Async.fetchAll('SELECT * FROM owned_properties WHERE owner = @identifier', {['@identifier'] = xPlayer.identifier}, function(result2)
for i,k in pairs(result2) do
properties = properties + 1
end
xInfo.properties = properties
MySQL.Async.fetchAll("SELECT firstname, lastname FROM users WHERE identifier = @identifier", { ["@identifier"] = xPlayer.identifier }, function(result)
xInfo.fullname = result.firstname .. ' ' .. result.lastname
cb(xInfo, serveritems)
end)
end)
end)
end)
ESX.RegisterServerCallback('del_tablet:loadImmos', function(source, cb)
local ownedImmos = {}
local s = source
local x = ESX.GetPlayerFromId(s)
MySQL.Async.fetchAll('SELECT * FROM owned_properties WHERE `owner` = @owner', {['@owner'] = x.identifier}, function(properties)
for _,v in pairs(properties) do
table.insert(ownedImmos, {name = v.name, rented = v.rented, price = v.price})
end
cb(ownedImmos)
end)
end)
ESX.RegisterServerCallback('delion_tablet:loadVehicles', function(source, cb)
local ownedCars = {}
local s = source
local x = ESX.GetPlayerFromId(s)
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE `owner` = @owner', {['@owner'] = x.identifier}, function(vehicles)
for _,v in pairs(vehicles) do
local vehicle = json.decode(v.vehicle)
table.insert(ownedCars, {vehicle = vehicle, stored = v.stored, plate = v.plate})
end
cb(ownedCars)
end)
end)
ESX.RegisterServerCallback('delion_tablet:loadUsers', function(source, cb)
local userlist = {}
local s = source
local x = ESX.GetPlayerFromId(s)
MySQL.Async.fetchAll('SELECT * FROM users WHERE `identifier` = @identifier', {['@identifier'] = x.identifier}, function(result)
table.insert(userlist, {bank = result.bank, firstname = result.firstname, lastname = result.lastname, job = result.job, job_grade = result.job_grade, phone_number = result.phone_number})
end)
Citizen.Wait(1000)
cb(userlist)
end)
ESX.RegisterServerCallback('delion_tablet:invadermessages',function(source,cb)
if invaderlist ~= nil then
cb(invaderlist)
end
end)
ESX.RegisterServerCallback('delion_tablet:getItemAmount', function(source, cb, item)
local xPlayer = ESX.GetPlayerFromId(source)
local qtty = xPlayer.getInventoryItem(item).count
cb(qtty)
end)
RegisterServerEvent('bank:transfer')
AddEventHandler('bank:transfer', function(to, amountt)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local zPlayer = ESX.GetPlayerFromId(to)
local balance = 0
if zPlayer ~= nil and GetPlayerEndpoint(to) ~= nil then
balance = xPlayer.getAccount('bank').money
zbalance = zPlayer.getAccount('bank').money
if tonumber(_source) == tonumber(to) then
TriggerClientEvent(Config.notificationstrigger, _source, Config.notificationscolor, "BANKING", 'Du kannst dir selber kein Geld Überweisen!')
else
if balance <= 0 or balance < tonumber(amountt) or tonumber(amountt) <=
0 then
TriggerClientEvent('notifications', _source, "red", "BANKING", 'Du hast zu wenig Geld!')
else
xPlayer.removeAccountMoney('bank', tonumber(amountt))
zPlayer.addAccountMoney('bank', tonumber(amountt))
TriggerClientEvent(Config.notificationstrigger, _source, Config.notificationscolor, "BANKING", 'Du überwest ' ..amountt.. '$ zur ID:' ..to.. '' )
TriggerClientEvent(Config.notificationstrigger, to, Config.notificationscolor, "BANKING", 'Du bekommst ' ..amountt.. '$ von ' .._source.. '' )
end
end
end
end)
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
local invaderlist = {}
RegisterNetEvent('lifeinvader:instert')
AddEventHandler('lifeinvader:instert', function(text)
local xPlayer = ESX.GetPlayerFromId(_source)
table.insert(invaderlist, {name = GetPlayerName(_source), text = text })
end)
ESX.RegisterServerCallback('delion_tablet:getstarted', function(src, cb)
local xPlayer = ESX.GetPlayerFromId(src)
local xInfo = {}
local vehicles = 0
local properties = 0
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @identifier', { = xPlayer.identifier}, function(result1)
for i,k in pairs(result1) do
vehicles = vehicles + 1
end
xInfo.vehicles = vehicles
MySQL.Async.fetchAll('SELECT * FROM owned_properties WHERE owner = @identifier', { = xPlayer.identifier}, function(result2)
for i,k in pairs(result2) do
properties = properties + 1
end
xInfo.properties = properties
MySQL.Async.fetchAll("SELECT firstname, lastname FROM users WHERE identifier = @identifier", {= xPlayer.identifier }, function(result)
xInfo.fullname = result.firstname .. ' ' .. result.lastname
cb(xInfo, serveritems)
end)
end)
end)
end)
ESX.RegisterServerCallback('del_tablet:loadImmos', function(source, cb)
local ownedImmos = {}
local s = source
local x = ESX.GetPlayerFromId(s)
MySQL.Async.fetchAll('SELECT * FROM owned_properties WHERE `owner` = @owner', { = x.identifier}, function(properties)
for _,v in pairs(properties) do
table.insert(ownedImmos, {name = v.name, rented = v.rented, price = v.price})
end
cb(ownedImmos)
end)
end)
ESX.RegisterServerCallback('delion_tablet:loadVehicles', function(source, cb)
local ownedCars = {}
local s = source
local x = ESX.GetPlayerFromId(s)
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE `owner` = @owner', { = x.identifier}, function(vehicles)
for _,v in pairs(vehicles) do
local vehicle = json.decode(v.vehicle)
table.insert(ownedCars, {vehicle = vehicle, stored = v.stored, plate = v.plate})
end
cb(ownedCars)
end)
end)
ESX.RegisterServerCallback('delion_tablet:loadUsers', function(source, cb)
local userlist = {}
local s = source
local x = ESX.GetPlayerFromId(s)
MySQL.Async.fetchAll('SELECT * FROM users WHERE `identifier` = @identifier', { = x.identifier}, function(result)
table.insert(userlist, {bank = result.bank, firstname = result.firstname, lastname = result.lastname, job = result.job, job_grade = result.job_grade, phone_number = result.phone_number})
end)
Citizen.Wait(1000)
cb(userlist)
end)
ESX.RegisterServerCallback('delion_tablet:invadermessages',function(source,cb)
if invaderlist ~= nil then
cb(invaderlist)
end
end)
ESX.RegisterServerCallback('delion_tablet:getItemAmount', function(source, cb, item)
local xPlayer = ESX.GetPlayerFromId(source)
local qtty = xPlayer.getInventoryItem(item).count
cb(qtty)
end)
RegisterServerEvent('bank:transfer')
AddEventHandler('bank:transfer', function(to, amountt)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local zPlayer = ESX.GetPlayerFromId(to)
local balance = 0
if zPlayer ~= nil and GetPlayerEndpoint(to) ~= nil then
balance = xPlayer.getAccount('bank').money
zbalance = zPlayer.getAccount('bank').money
if tonumber(_source) == tonumber(to) then
TriggerClientEvent(Config.notificationstrigger, _source, Config.notificationscolor, "BANKING", '你不能给自己转账!')
else
if balance
以上是代码的中文翻译,保留了源代码。请注意,代码中有一些语法错误(例如,`{ = xPlayer.identifier}`),需要根据实际情况进行修正。
页:
[1]