Skip to content

Commit

Permalink
Fix cmd console return info
Browse files Browse the repository at this point in the history
  • Loading branch information
RedAlex committed Feb 5, 2020
1 parent 2ec5eef commit 4880c61
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 24 deletions.
6 changes: 6 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Config.TextFr = {
banlistloaded = "La BanList a ete charger avec succes.",
historyloaded = "La BanListHistory a ete charger avec succes.",
loaderror = "ERREUR : La BanList n a pas été charger.",
cmdban = "/sqlban (ID) (Durée en jours) (Raison)",
cmdbanoff = "/sqlbanoffline (Permid) (Durée en jours) (Raison)",
cmdhistory = "/sqlbanhistory (Steam name) ou /sqlbanhistory 1,2,2,4......",
noreason = "Raison Inconnue",
during = " pendant : ",
noresult = "Il n'y a pas autant de résultats !",
Expand Down Expand Up @@ -59,6 +62,9 @@ Config.TextEn = {
banlistloaded = "BanList loaded successfully.",
historyloaded = "BanListHistory loaded successfully.",
loaderror = "ERROR: The BanList failed to load.",
cmdban = "/sqlban (ID) (Duration in days) (Ban reason)",
cmdbanoff = "/sqlbanoffline (Permid) (Duration in days) (Steam name)",
cmdhistory = "/sqlbanhistory (Steam name) or /sqlbanhistory 1,2,2,4......",
forcontinu = " days. To continue, execute /sqlreason [reason]",
noreason = "No reason provided.",
during = " during: ",
Expand Down
59 changes: 35 additions & 24 deletions server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ TriggerEvent('es:addGroupCommand', 'sqlunban', Config.permission, function (sour
function ()
loadBanList()
if Config.EnableDiscordLink then
local sourceplayername = GetPlayerName(source)
local sourceplayername = ""
if source ~= 0 then
sourceplayername = GetPlayerName(source)
else
sourceplayername = "Console"
end
local message = (data[1].targetplayername .. Text.isunban .." ".. Text.by .." ".. sourceplayername)
sendToDiscord(Config.webhookunban, message)
end
Expand All @@ -151,7 +156,7 @@ TriggerEvent('es:addGroupCommand', 'sqlunban', Config.permission, function (sour

end)
else
TriggerEvent('bansql:sendMessage', source, Text.cmdunban)
TriggerEvent('bansql:sendMessage', source, Text.invalidname)
end
end, function(source, args, user)
TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM ', 'Insufficient Permissions.' } })
Expand All @@ -172,8 +177,13 @@ TriggerEvent('es:addGroupCommand', 'sqlban', Config.permission, function (source

if ping and ping > 0 then
if duree and duree < 365 then
local sourceplayername = GetPlayerName(source)
local targetplayername = GetPlayerName(target)
local sourceplayername = ""
if source ~= 0 then
sourceplayername = GetPlayerName(source)
else
sourceplayername = "Console"
end
for k,v in ipairs(GetPlayerIdentifiers(target))do
if string.sub(v, 1, string.len("license:")) == "license:" then
license = v
Expand Down Expand Up @@ -272,30 +282,26 @@ AddEventHandler('BanSql:ICheat', function(reason,servertarget)
end)

TriggerEvent('es:addGroupCommand', 'sqlsearch', Config.permission, function (source, args, user)
if args ~= "" then
local target = table.concat(args, " ")
if target ~= "" then
MySQL.Async.fetchAll('SELECT * FROM baninfo WHERE playername like @playername',
{
['@playername'] = ("%"..target.."%")
}, function(data)
if data[1] then
if #data < 50 then
for i=1, #data, 1 do
TriggerEvent('bansql:sendMessage', source, data[i].id.." "..data[i].playername)
end
else
TriggerEvent('bansql:sendMessage', source, Text.toomanyresult)
local target = table.concat(args, " ")
if target ~= "" then
MySQL.Async.fetchAll('SELECT * FROM baninfo WHERE playername like @playername',
{
['@playername'] = ("%"..target.."%")
}, function(data)
if data[1] then
if #data < 50 then
for i=1, #data, 1 do
TriggerEvent('bansql:sendMessage', source, data[i].id.." "..data[i].playername)
end
else
TriggerEvent('bansql:sendMessage', source, Text.invalidname)
TriggerEvent('bansql:sendMessage', source, Text.toomanyresult)
end
end)
else
TriggerEvent('bansql:sendMessage', source, Text.invalidname)
end
else
TriggerEvent('bansql:sendMessage', source, Text.invalidname)
end
end)
else
TriggerEvent('bansql:sendMessage', source, Text.cmdbanoff)
TriggerEvent('bansql:sendMessage', source, Text.invalidname)
end
end, function(source, args, user)
TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM ', 'Insufficient Permissions.' } })
Expand All @@ -306,7 +312,12 @@ TriggerEvent('es:addGroupCommand', 'sqlbanoffline', Config.permission, function
local target = tonumber(args[1])
local duree = tonumber(args[2])
local reason = table.concat(args, " ",3)
local sourceplayername = GetPlayerName(source)
local sourceplayername = ""
if source ~= 0 then
sourceplayername = GetPlayerName(source)
else
sourceplayername = "Console"
end

if duree ~= "" then
if target ~= "" then
Expand Down

0 comments on commit 4880c61

Please sign in to comment.