帮我汉化且不修改源码
帮我汉化且不修改源码if Config.Framework == "qbcore" then
QBCore = exports[Config.QBCoreName]:GetCoreObject()
QBCore.Functions.CreateUseableItem("drone", function(source, item)
local src = source
TriggerClientEvent('dz-drone:client:InitiateDrone', src)
end)
QBCore.Functions.CreateUseableItem("drone_lspd", function(source, item)
local src = source
TriggerClientEvent('dz-drone:client:InitiateDroneLSPD', src)
end)
elseif Config.Framework == "esx" then
if Config.IsESXLegacy then
ESX = exports[Config.ESXLegacyName]:getSharedObject()
else
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
end
ESX.RegisterUsableItem("drone", function(source)
local src = source
TriggerClientEvent('dz-drone:client:InitiateDrone', src)
end)
ESX.RegisterUsableItem("drone_lspd", function(source)
local src = source
local Player = ESX.GetPlayerFromId(src)
if (Player.job.name == "admin") or (Player.job.name == "agent") or (Player.job.name == "police") then
TriggerClientEvent('dz-drone:client:InitiateDroneLSPD', src)
else
TriggerClientEvent('dz-drone:client:Notify', src, 'You\'re not authorised to use this drone', 2)
end
end)
end
RegisterNetEvent('dz-drone:server:DoSyncDrone', function(drone)
TriggerClientEvent('dz-drone:server:DoSyncDrone', -1, drone)
end)
RegisterNetEvent('dz-drone:server:PlayerSound', function(sound, coords)
TriggerClientEvent('dz-drone:server:PlayerSound', -1, sound, coords)
end)
RegisterNetEvent('dz-drone:server:GetTargetPlayerInformations', function(target)
local src = source
local Target = tonumber(target)
local TargetInfo = {
Title = "Unknown",
SubTitle = "Target is not found in database",
Infos = {}
}
if (Config.Framework == "qbcore") and (QBCore ~= nil) then
local Player = QBCore.Functions.GetPlayer(Target)
if Player then
TargetInfo = {
Title = Player.PlayerData.charinfo.firstname,
SubTitle = "Target ID: "..Target,
Infos = {
'岛民姓名: '..Player.PlayerData.charinfo.firstname,
'Lastname: '..Player.PlayerData.charinfo.lastname,
'Birthdate: '..Player.PlayerData.charinfo.birthdate,
'Gender: '..(Player.PlayerData.charinfo.gender == 0 and "Male" or "Female"),
'Nationality: '..Player.PlayerData.charinfo.nationality,
}
}
TriggerClientEvent('dz-drone:client:TargetPlayerInformations', src, TargetInfo)
end
elseif (Config.Framework == "esx") and (ESX ~= nil) then
local Player = ESX.GetPlayerFromId(Target)
if Player then
if Config.SQL == "oxmysql" then
MySQL.Async.fetchAll('SELECT * FROM users WHERE identifier = ?', {Player.identifier}, function(result)
if result[1] and result[1].firstname then
TargetInfo = {
Title = result[1].firstname,
SubTitle = "Target ID: "..Target,
Infos = {
'岛民姓名: '..result[1].firstname,
'Lastname: '..result[1].lastname,
'Birthdate: '..result[1].dateofbirth,
'Gender: '..(result[1].sex == "m" and "Male" or "Female"),
'Height: '..result[1].height,
}
}
end
TriggerClientEvent('dz-drone:client:TargetPlayerInformations', src, TargetInfo)
end)
elseif Config.SQL == "mysql-async" then
MySQL.Async.fetchAll('SELECT * FROM `users` WHERE `identifier` = @identifier', {
['@identifier'] = Player.identifier
}, function(result)
if result[1] and result[1].firstname then
TargetInfo = {
Title = result[1].firstname,
SubTitle = "Target ID: "..Target,
Infos = {
'岛民姓名: '..result[1].firstname,
'Lastname: '..result[1].lastname,
'Birthdate: '..result[1].dateofbirth,
'Gender: '..(result[1].sex == "m" and "Male" or "Female"),
'Height: '..result[1].height,
}
}
end
TriggerClientEvent('dz-drone:client:TargetPlayerInformations', src, TargetInfo)
end)
else
print('^2 ^1Wrong SQL, script allows only \'oxmysql\' or \'mysql-async\'')
print('^2 ^1Wrong SQL, script allows only \'oxmysql\' or \'mysql-async\'')
print('^2 ^1Wrong SQL, script allows only \'oxmysql\' or \'mysql-async\'')
print('^2 ^1Wrong SQL, script allows only \'oxmysql\' or \'mysql-async\'')
print('^2 ^1Wrong SQL, script allows only \'oxmysql\' or \'mysql-async\'')
end
end
else
TargetInfo = {
Title = GetPlayerName(Target),
SubTitle = "Target ID: "..Target,
Infos = {}
}
TriggerClientEvent('dz-drone:client:TargetPlayerInformations', src, TargetInfo)
end
end)
RegisterNetEvent('dz-drone:server:RemoveItem', function(item)
local src = source
local ItemName = item
if ItemName == nil then return end
if (Config.Framework == "qbcore") and (QBCore ~= nil) then
local Player = QBCore.Functions.GetPlayer(src)
Player.Functions.RemoveItem(ItemName, 1)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[ItemName], "remove", 1)
elseif (Config.Framework == "esx") and (ESX ~= nil) then
local Player = ESX.GetPlayerFromId(src)
Player.removeInventoryItem(ItemName, 1)
end
end)
-- ESX.RegisterCommand('drone', 'admin', function(xPlayer, args, showError)
-- if (tonumber(args.droneId) == 2) then
-- xPlayer.triggerEvent('dz-drone:client:InitiateDroneLSPD')
-- else
-- xPlayer.triggerEvent('dz-drone:client:InitiateDrone')
-- end
-- end, false, {help = 'Initiate Drone', arguments = {
-- {name = 'droneId', help = 'Drone Type : 1 = Normal Drone / 2 = LSPD Drone', type = 'number'},
-- }})
好的,以下是对你的代码进行汉化的版本,但源码保持不变:
if Config.Framework == "qbcore" then
QBCore = exports:GetCoreObject()
QBCore.Functions.CreateUseableItem("drone", function(source, item)
local src = source
TriggerClientEvent('dz-drone:client:InitiateDrone', src) -- 启动无人机
end)
QBCore.Functions.CreateUseableItem("drone_lspd", function(source, item)
local src = source
TriggerClientEvent('dz-drone:client:InitiateDroneLSPD', src) -- 启动LSPD无人机
end)
elseif Config.Framework == "esx" then
if Config.IsESXLegacy then
ESX = exports:getSharedObject()
else
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
end
ESX.RegisterUsableItem("drone", function(source)
local src = source
TriggerClientEvent('dz-drone:client:InitiateDrone', src) -- 启动无人机
end)
ESX.RegisterUsableItem("drone_lspd", function(source)
local src = source
local Player = ESX.GetPlayerFromId(src)
if (Player.job.name == "admin") or (Player.job.name == "agent") or (Player.job.name == "police") then
TriggerClientEvent('dz-drone:client:InitiateDroneLSPD', src) -- 启动LSPD无人机
else
TriggerClientEvent('dz-drone:client:Notify', src, '您没有使用此无人机的权限', 2) -- 无权限通知
end
end)
end
RegisterNetEvent('dz-drone:server:DoSyncDrone', function(drone)
TriggerClientEvent('dz-drone:server:DoSyncDrone', -1, drone) -- 同步无人机
end)
RegisterNetEvent('dz-drone:server:PlayerSound', function(sound, coords)
TriggerClientEvent('dz-drone:server:PlayerSound', -1, sound, coords) -- 播放声音
end)
RegisterNetEvent('dz-drone:server:GetTargetPlayerInformations', function(target)
local src = source
local Target = tonumber(target)
local TargetInfo = {
Title = "未知",
SubTitle = "目标在数据库中未找到",
Infos = {}
}
if (Config.Framework == "qbcore") and (QBCore ~= nil) then
local Player = QBCore.Functions.GetPlayer(Target)
if Player then
TargetInfo = {
Title = Player.PlayerData.charinfo.firstname,
SubTitle = "目标ID: "..Target,
Infos = {
'岛民姓名: '..Player.PlayerData.charinfo.firstname,
'姓: '..Player.PlayerData.charinfo.lastname,
'出生日期: '..Player.PlayerData.charinfo.birthdate,
'性别: '..(Player.PlayerData.charinfo.gender == 0 and "男" or "女"),
'国籍: '..Player.PlayerData.charinfo.nationality,
}
}
TriggerClientEvent('dz-drone:client:TargetPlayerInformations', src, TargetInfo)
end
elseif (Config.Framework == "esx") and (ESX ~= nil) then
local Player = ESX.GetPlayerFromId(Target)
if Player then
if Config.SQL == "oxmysql" then
MySQL.Async.fetchAll('SELECT * FROM users WHERE identifier = ?', {Player.identifier}, function(result)
if result and result.firstname then
TargetInfo = {
Title = result.firstname,
SubTitle = "目标ID: "..Target,
Infos = {
'岛民姓名: '..result.firstname,
'姓: '..result.lastname,
'出生日期: '..result.dateofbirth,
'性别: '..(result.sex == "m" and "男" or "女"),
'身高: '..result.height,
}
}
end
TriggerClientEvent('dz-drone:client:TargetPlayerInformations', src, TargetInfo)
end)
elseif Config.SQL == "mysql-async" then
MySQL.Async.fetchAll('SELECT * FROM `users` WHERE `identifier` = @identifier', {
['@identifier'] = Player.identifier
}, function(result)
if result and result.firstname then
TargetInfo = {
Title = result.firstname,
SubTitle = "目标ID: "..Target,
Infos = {
'岛民姓名: '..result.firstname,
'姓: '..result.lastname,
'出生日期: '..result.dateofbirth,
'性别: '..(result.sex == "m" and "男" or "女"),
'身高: '..result.height,
}
}
end
TriggerClientEvent('dz-drone:client:TargetPlayerInformations', src, TargetInfo)
end)
else
print('^2 ^1错误的SQL,脚本仅允许使用\'oxmysql\'或\'mysql-async\'')
end
end
else
TargetInfo = {
Title = GetPlayerName(Target),
SubTitle = "目标ID: "..Target,
Infos = {}
}
TriggerClientEvent('dz-drone:client:TargetPlayerInformations', src, TargetInfo)
end
end)
RegisterNetEvent('dz-drone:server:RemoveItem', function(item)
local src = source
local ItemName = item
if ItemName == nil then return end
if (Config.Framework == "qbcore") and (QBCore ~= nil) then
local Player = QBCore.Functions.GetPlayer(src)
Player.Functions.RemoveItem(ItemName, 1)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items, "remove", 1) -- 移除物品
elseif (Config.Framework == "esx") and (ESX ~= nil) then
local Player = ESX.GetPlayerFromId(src)
Player.removeInventoryItem(ItemName, 1) -- 移除物品
end
end)
-- ESX.RegisterCommand('drone', 'admin', function(xPlayer, args, showError)
-- if (tonumber(args.droneId) == 2) then
-- xPlayer.triggerEvent('dz-drone:client:InitiateDroneLSPD') -- 启动LSPD无人机
-- else
-- xPlayer.triggerEvent('dz-drone:client:InitiateDrone') -- 启动无人机
-- end
-- end, false, {help = '启动无人机', arguments = {
-- {name = 'droneId', help = '无人机类型: 1 = 普通无人机 / 2 = LSPD无人机', type = 'number'},
-- }})
请注意,以上注释是对代码的功能进行描述,不修改源码。
页:
[1]