This commit is contained in:
Mycroft
2021-04-28 21:42:12 +01:00
parent bac6cbbb7e
commit 4b2d95059c
8 changed files with 59 additions and 30 deletions
+5 -8
View File
@@ -20,6 +20,7 @@ end, true, {help = _U('command_setjob'), validate = true, arguments = {
}})
ESX.RegisterCommand('car', 'admin', function(xPlayer, args, showError)
if not args.car then args.car = "baller2" end
xPlayer.triggerEvent('esx:spawnVehicle', args.car)
end, false, {help = _U('command_car'), validate = false, arguments = {
{name = 'car', help = _U('command_car_car'), type = 'any'}
@@ -124,6 +125,8 @@ end, true, {help = _U('command_clearloadout'), validate = true, arguments = {
}})
ESX.RegisterCommand('setgroup', 'admin', function(xPlayer, args, showError)
if not args.playerId then args.playerId = xPlayer.source end
if Config.DisableSuperadmin and args.group == "superadmin" then args.group = "admin" end
args.playerId.setGroup(args.group)
end, true, {help = _U('command_setgroup'), validate = true, arguments = {
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
@@ -141,19 +144,13 @@ ESX.RegisterCommand('saveall', 'admin', function(xPlayer, args, showError)
end, true, {help = _U('command_saveall')})
ESX.RegisterCommand('currentgroup', {"user", "admin"}, function(xPlayer, args, showError)
TriggerClientEvent('chatMessage', xPlayer.source, "You are currently: "..xPlayer.getGroup()))
print("You are currently: ".. xPlayer.getGroup())
end, true)
ESX.RegisterCommand('getcoords', "admin", function(xPlayer, args, showError)
print("".. xPlayer.getName().. ": "xPlayer.getCoords(true))
print("".. xPlayer.getName().. ": ".. xPlayer.getCoords(true))
end, true)
ESX.RegisterCommand('tpm', "admin", function(xPlayer, args, showError)
TriggerEvent("esx:admin:tpm", xPlayer.source, args.playerid)
end, true, {help = _U('command_save'), validate = true, arguments = {
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}
}}))
ESX.RegisterCommand('getplayers', "admin", function(xPlayer, args, showError)
local xAll = ESX.GetPlayers()
print("^2"..#xAll.." ^3online player(s)^0")
+9
View File
@@ -284,3 +284,12 @@ ESX.DoesJobExist = function(job, grade)
return false
end
ESX.GetPlayerIdentifier = function(playerId)
local identifiers = GetPlayerIdentifiers(playerId)
for _,id in ipairs(identifiers) do
if id:find(Config.IdentifierPrefix) then
return id:gsub(string.format("%s:","licence"),"")
end
end
end
+24 -11
View File
@@ -1,6 +1,6 @@
Citizen.CreateThread(function()
SetMapName('San Andreas')
SetGameType('Roleplay')
SetGameType('ESX Roleplay')
end)
RegisterNetEvent('esx:onPlayerJoined')
@@ -10,13 +10,23 @@ AddEventHandler('esx:onPlayerJoined', function()
end
end)
if Config.UseMulticharacter then
AddEventHandler("esx:overwriteIdentifierMethod",function(ref)
ESX.GetPlayerIdentifier = ref
end)
end
function onPlayerJoined(playerId)
local identifier
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
if Config.UseMulticharacter then
local identifier = ESX.GetPlayerIdentifier(playerId)
else
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
end
end
end
@@ -63,13 +73,17 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
local playerId, identifier = source
Citizen.Wait(100)
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
if Config.UseMulticharacter then
local identifier = ESX.GetPlayerIdentifier(playerId)
else
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
end
end
end
if identifier then
if ESX.GetPlayerFromIdentifier(identifier) then
deferrals.done(('There was an error loading your character!\nError code: identifier-active\n\nThis error is caused by a player on this server who has the same identifier as you have. Make sure you are not playing on the same Rockstar account.\n\nYour Rockstar identifier: %s'):format(identifier))
@@ -81,7 +95,6 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
end
end)
function loadESXPlayer(identifier, playerId)
local tasks = {}