forked from Simnation/Main
ed
This commit is contained in:
parent
1032235744
commit
cb8b683d43
292 changed files with 15840 additions and 0 deletions
BIN
resources/[phone]/roadphone/server/advertising.lua
Normal file
BIN
resources/[phone]/roadphone/server/advertising.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/anonymtell.lua
Normal file
BIN
resources/[phone]/roadphone/server/anonymtell.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/connect.lua
Normal file
BIN
resources/[phone]/roadphone/server/connect.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/crypto.lua
Normal file
BIN
resources/[phone]/roadphone/server/crypto.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/darkchat.lua
Normal file
BIN
resources/[phone]/roadphone/server/darkchat.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/mail_app.lua
Normal file
BIN
resources/[phone]/roadphone/server/mail_app.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/messages.lua
Normal file
BIN
resources/[phone]/roadphone/server/messages.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/music.lua
Normal file
BIN
resources/[phone]/roadphone/server/music.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/news.lua
Normal file
BIN
resources/[phone]/roadphone/server/news.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/notes.lua
Normal file
BIN
resources/[phone]/roadphone/server/notes.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/roaddrop.lua
Normal file
BIN
resources/[phone]/roadphone/server/roaddrop.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/server.lua
Normal file
BIN
resources/[phone]/roadphone/server/server.lua
Normal file
Binary file not shown.
185
resources/[phone]/roadphone/server/serverAPI/bank.lua
Normal file
185
resources/[phone]/roadphone/server/serverAPI/bank.lua
Normal file
|
@ -0,0 +1,185 @@
|
|||
RegisterServerEvent('roadphone:bank:transfer')
|
||||
AddEventHandler('roadphone:bank:transfer', function(number, amount)
|
||||
local src = tonumber(source)
|
||||
local xPlayer = QBCore.Functions.GetPlayer(src)
|
||||
local targetplayer = nil
|
||||
|
||||
if Config.okokBanking then
|
||||
targetplayer = getPlayerFromIban(number)
|
||||
else
|
||||
targetplayer = GetPlayerFromPhone(number)
|
||||
end
|
||||
|
||||
if Config.okokBanking and targetplayer == nil then
|
||||
targetplayer = GetPlayerFromPhone(number)
|
||||
end
|
||||
|
||||
local balance = tonumber(xPlayer.Functions.GetMoney('bank'))
|
||||
|
||||
amount = tonumber(amount)
|
||||
|
||||
if not xPlayer then
|
||||
return;
|
||||
end
|
||||
|
||||
if not targetplayer then
|
||||
TriggerClientEvent("roadphone:sendNotification", src, {
|
||||
apptitle = 'APP_BANK_NAME',
|
||||
title = 'APP_BANK_NUMBER_NOT_FOUND_TITLE',
|
||||
message = 'APP_BANK_NUMBER_NOT_FOUND_MESSAGE',
|
||||
img = "/public/img/Apps/light_mode/bank.webp"
|
||||
})
|
||||
return;
|
||||
end
|
||||
|
||||
local numberfromsource = getNumberFromIdentifier(xPlayer.PlayerData.citizenid)
|
||||
local targetbalance = tonumber(targetplayer.Functions.GetMoney('bank'))
|
||||
|
||||
if numberfromsource == number then
|
||||
TriggerClientEvent("roadphone:sendNotification", src, {
|
||||
apptitle = 'APP_BANK_NAME',
|
||||
title = 'APP_BANK_SEND_MONEY_TO_YOURSELF_TITLE',
|
||||
img = "/public/img/Apps/light_mode/bank.webp"
|
||||
})
|
||||
return;
|
||||
end
|
||||
|
||||
if targetbalance < 0 or balance < 0 then
|
||||
TriggerClientEvent("roadphone:sendNotification", src, {
|
||||
apptitle = "APP_BANK_NAME",
|
||||
title = 'APP_BANK_INVALID_INPUT',
|
||||
img = "/public/img/App/bank.png"
|
||||
})
|
||||
return;
|
||||
end
|
||||
|
||||
if not amount or amount < 0 then
|
||||
TriggerClientEvent("roadphone:sendNotification", src, {
|
||||
apptitle = 'APP_BANK_NAME',
|
||||
title = 'APP_BANK_INVALID_INPUT',
|
||||
img = "/public/img/Apps/light_mode/bank.webp"
|
||||
})
|
||||
return;
|
||||
end
|
||||
|
||||
if amount > balance then
|
||||
TriggerClientEvent("roadphone:sendNotification", src, {
|
||||
apptitle = 'APP_BANK_NAME',
|
||||
title = 'APP_BANK_NOT_ENOUGH_MONEY',
|
||||
message = 'APP_BANK_NOT_ENOUGH_MONEY_MESSAGE',
|
||||
img = "/public/img/Apps/light_mode/bank.webp"
|
||||
})
|
||||
return;
|
||||
end
|
||||
|
||||
local selfname, targetname = getNameFromIdentifier(xPlayer.PlayerData.citizenid), getNameFromIdentifier(targetplayer.PlayerData.citizenid)
|
||||
|
||||
if not selfname or not targetname then
|
||||
return;
|
||||
end
|
||||
|
||||
local percent = amount * Cfg.BankPayTax
|
||||
|
||||
local endamount = amount - percent
|
||||
|
||||
xPlayer.Functions.RemoveMoney('bank', amount)
|
||||
targetplayer.Functions.AddMoney('bank', endamount)
|
||||
|
||||
TriggerEvent("roadphone:addBankTransfer", numberfromsource, number, Lang:t('info.bank_money_transaction', { value = targetname }), amount)
|
||||
|
||||
TriggerClientEvent("roadphone:sendNotification", src, {
|
||||
apptitle = 'APP_BANK_NAME',
|
||||
title = 'APP_BANK_MONEY_SENT',
|
||||
message = Lang:t('info.bank_app_sent_money_text', { value = amount}),
|
||||
img = "/public/img/Apps/light_mode/bank.webp"
|
||||
})
|
||||
|
||||
TriggerClientEvent("roadphone:sendNotification", targetplayer.PlayerData.source, {
|
||||
apptitle = 'APP_BANK_NAME',
|
||||
title = 'APP_BANK_MONEY_RECEIVED',
|
||||
message = Lang:t('info.bank_app_received_money_text', { value = QBCore.Shared.Round(endamount, 2)}),
|
||||
img = "/public/img/Apps/light_mode/bank.webp"
|
||||
})
|
||||
|
||||
if amount >= Cfg.MinimumBankTransfer then
|
||||
bankWebhook(src, targetplayer.source, selfname, targetname, amount)
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent("roadphone:addBankTransfer")
|
||||
AddEventHandler("roadphone:addBankTransfer", function(sender, receiver, reason, amount)
|
||||
if sender and receiver then
|
||||
MySQL.Async.insert(
|
||||
"INSERT INTO roadshop_banktransfer (sender,receiver,reason,amount) VALUES (@sender, @receiver, @reason, @amount)",
|
||||
{
|
||||
["@sender"] = sender,
|
||||
["@receiver"] = receiver,
|
||||
["@reason"] = reason,
|
||||
["@amount"] = amount
|
||||
}, function(id)
|
||||
|
||||
local transaction = {
|
||||
id = id,
|
||||
sender = sender,
|
||||
receiver = receiver,
|
||||
reason = reason,
|
||||
amount = amount
|
||||
}
|
||||
|
||||
local selfplayer = GetPlayerFromPhone(sender)
|
||||
local target = GetPlayerFromPhone(receiver)
|
||||
|
||||
if selfplayer then
|
||||
TriggerClientEvent('roadphone:bank:addTransaction', selfplayer.PlayerData.source, transaction)
|
||||
end
|
||||
|
||||
if target then
|
||||
TriggerClientEvent('roadphone:bank:addTransaction', target.PlayerData.source, transaction)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateCallback("roadphone:getBankBalance", function(source, cb)
|
||||
|
||||
local xPlayer = QBCore.Functions.GetPlayer(source)
|
||||
|
||||
if not xPlayer then
|
||||
return;
|
||||
end
|
||||
|
||||
cb(xPlayer.Functions.GetMoney('bank'))
|
||||
|
||||
end)
|
||||
|
||||
exports("addBankTransaction", function(sender, receiver, reason, amount)
|
||||
|
||||
TriggerEvent("roadphone:addBankTransaction", sender, receiver, reason, amount)
|
||||
|
||||
end)
|
||||
|
||||
function getBankTransactions(number)
|
||||
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM roadshop_banktransfer WHERE sender = @sender OR receiver = @receiver', {
|
||||
['@sender'] = number,
|
||||
['@receiver'] = number
|
||||
})
|
||||
|
||||
return result
|
||||
|
||||
end
|
||||
|
||||
|
||||
local cooldownspambank = 0
|
||||
|
||||
QBCore.Functions.CreateCallback('roadphone:bank:checkSpam', function(source, cb)
|
||||
if cooldownspambank == 0 then
|
||||
cb(0)
|
||||
cooldownspambank = cooldownspambank + 1
|
||||
Wait(1000)
|
||||
cooldownspambank = 0
|
||||
else
|
||||
cb(1)
|
||||
end
|
||||
end)
|
230
resources/[phone]/roadphone/server/serverAPI/billing.lua
Normal file
230
resources/[phone]/roadphone/server/serverAPI/billing.lua
Normal file
|
@ -0,0 +1,230 @@
|
|||
QBCore.Functions.CreateCallback('roadphone:getCodeMBilling2', function(source, cb)
|
||||
|
||||
local billings = exports[Config.codemBilling2Folder]:GetPlayerUnpaidBillings(source)
|
||||
|
||||
cb(billings)
|
||||
|
||||
end)
|
||||
|
||||
|
||||
RegisterServerEvent("roadphone:server:codem:payBill")
|
||||
AddEventHandler("roadphone:server:codem:payBill", function(id)
|
||||
|
||||
local _source = source
|
||||
|
||||
exports[Config.codemBilling2Folder]:PayBilling(_source, id)
|
||||
|
||||
|
||||
end)
|
||||
|
||||
if Config.bcsCompanyManager then
|
||||
|
||||
QBCore.Functions.CreateCallback('roadphone:getbilling', function(source, cb)
|
||||
local e = QBCore.Functions.GetPlayer(source)
|
||||
MySQL.Async.fetchAll('SELECT * FROM billings WHERE identifier = @identifier AND `status` = "unpaid"', {
|
||||
["@identifier"] = e.PlayerData.citizenid
|
||||
}, function(result)
|
||||
local billingg = {}
|
||||
for i = 1, #result, 1 do
|
||||
local jobName = "None"
|
||||
jobName = result[i].company
|
||||
table.insert(billingg, {
|
||||
id = result[i].id,
|
||||
label = result[i].description,
|
||||
sender = jobName,
|
||||
target = result[i].biller_id,
|
||||
amount = result[i].price
|
||||
})
|
||||
end
|
||||
cb(billingg)
|
||||
end)
|
||||
end)
|
||||
elseif Config.JaksamBilling then
|
||||
QBCore.Functions.CreateCallback('roadphone:getbilling', function(source, cb)
|
||||
local e = QBCore.Functions.GetPlayer(source)
|
||||
MySQL.Async.fetchAll('SELECT * FROM billing WHERE identifier = @identifier', {
|
||||
["@identifier"] = e.PlayerData.citizenid
|
||||
}, function(result)
|
||||
local billing = {}
|
||||
for i = 1, #result do
|
||||
local jobName = "None"
|
||||
if result[i].target_type == "society" then
|
||||
jobName = result[i].target:gsub("society_", "")
|
||||
else
|
||||
jobName = getNameFromIdentifier(result[i].sender)
|
||||
if jobName == nil then
|
||||
jobName = "Unkown"
|
||||
end
|
||||
end
|
||||
table.insert(billing, {
|
||||
id = result[i].id,
|
||||
label = result[i].label,
|
||||
sender = jobName,
|
||||
target = result[i].target,
|
||||
amount = result[i].amount
|
||||
})
|
||||
end
|
||||
cb(billing)
|
||||
end)
|
||||
end)
|
||||
|
||||
else
|
||||
|
||||
QBCore.Functions.CreateCallback('roadphone:getbilling', function(source, cb)
|
||||
local e = QBCore.Functions.GetPlayer(source)
|
||||
MySQL.Async.fetchAll('SELECT * FROM phone_invoices WHERE citizenid = @identifier', {
|
||||
["@identifier"] = e.PlayerData.citizenid
|
||||
}, function(result)
|
||||
local billing = {}
|
||||
for i = 1, #result, 1 do
|
||||
|
||||
local sender = getNameFromIdentifier(result[i].sendercitizenid)
|
||||
if sender == nil then
|
||||
sender = "Unkown"
|
||||
end
|
||||
table.insert(billing, {
|
||||
id = result[i].id,
|
||||
label = "Bill",
|
||||
sender = sender,
|
||||
target = result[i].citizenid,
|
||||
amount = result[i].amount
|
||||
})
|
||||
end
|
||||
cb(billing)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
QBCore.Functions.CreateCallback('roadphone:server:getbillingdata', function(source, cb, id)
|
||||
MySQL.Async.fetchAll('SELECT * FROM billing WHERE id = @id', {
|
||||
['@id'] = id
|
||||
}, function(data)
|
||||
cb(data[1])
|
||||
end)
|
||||
end)
|
||||
|
||||
if not Config.bcsCompanyManager then
|
||||
RegisterServerEvent("roadphone:server:payBill")
|
||||
AddEventHandler("roadphone:server:payBill", function(id)
|
||||
local src = source
|
||||
local xPlayer = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
MySQL.Async.fetchAll('SELECT * FROM phone_invoices WHERE id = @id', {
|
||||
['@id'] = id
|
||||
}, function(data)
|
||||
|
||||
local SenderPly = QBCore.Functions.GetPlayerByCitizenId(data[1].sendercitizenid)
|
||||
|
||||
xPlayer.Functions.RemoveMoney('bank', data[1].amount, "paid-invoice")
|
||||
exports['qb-management']:AddMoney(data[1].society, data[1].amount)
|
||||
MySQL.Async.execute('DELETE FROM phone_invoices WHERE id = @id', {
|
||||
['@id'] = id
|
||||
})
|
||||
|
||||
TriggerClientEvent('roadphone:sendNotification', src, {
|
||||
apptitle = 'APP_BILLING_NAME',
|
||||
title = Lang:t('info.info.billing_paid') .. data[1].amount,
|
||||
img = '/public/img/Apps/light_mode/billing.webp'
|
||||
})
|
||||
|
||||
if SenderPly then
|
||||
TriggerClientEvent('roadphone:sendNotification', SenderPly.PlayerData.source, {
|
||||
apptitle = 'APP_BILLING_NAME',
|
||||
title = Lang:t('info.info.billing_paid') .. data[1].amount,
|
||||
img = '/public/img/Apps/light_mode/billing.webp'
|
||||
})
|
||||
end
|
||||
end)
|
||||
|
||||
TriggerClientEvent('roadphone:updatebilling', src)
|
||||
end)
|
||||
|
||||
elseif Config.bcsCompanyManager then
|
||||
RegisterServerEvent("roadphone:server:payBill")
|
||||
AddEventHandler("roadphone:server:payBill", function(id)
|
||||
local src = source
|
||||
local xPlayer = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
MySQL.Async.fetchAll('SELECT * FROM billing WHERE id = @id', {
|
||||
['@id'] = id
|
||||
}, function(data)
|
||||
|
||||
local xTarget = QBCore.Functions.GetPlayerByCitizenId(data[1].sender)
|
||||
local target = data[1].biller_id
|
||||
local amount = data[1].price
|
||||
|
||||
if xTarget then
|
||||
if amount then
|
||||
if xPlayer.Functions.GetMoney('bank') >= amount then
|
||||
|
||||
MySQL.Async.execute('UPDATE billings SET `status`="paid" WHERE id = @id', {
|
||||
['@id'] = id
|
||||
}, function(rowsChanged)
|
||||
xTarget.Functions.AddMoney('bank', amount, 'bill received')
|
||||
xPlayer.Functions.RemoveMoney('bank', amount, 'bill paid')
|
||||
|
||||
TriggerClientEvent('roadphone:sendNotification', src, {
|
||||
apptitle = 'APP_BILLING_NAME',
|
||||
title = Lang:t('info.billing_paid') .. amount,
|
||||
img = '/public/img/Apps/light_mode/billing.webp'
|
||||
})
|
||||
TriggerClientEvent('roadphone:sendNotification', xTarget.PlayerData.source, {
|
||||
apptitle = 'APP_BILLING_NAME',
|
||||
title = Lang:t('info.billing_paid') .. amount,
|
||||
img = '/public/img/Apps/light_mode/billing.webp'
|
||||
})
|
||||
|
||||
TriggerClientEvent('roadphone:updatebilling', xPlayer.PlayerData.source)
|
||||
TriggerClientEvent('roadphone:updatebilling', xTarget.PlayerData.source)
|
||||
|
||||
end)
|
||||
|
||||
else
|
||||
|
||||
TriggerClientEvent('roadphone:sendNotification', src, {
|
||||
apptitle = 'APP_BILLING_NAME',
|
||||
title = Lang:t('info.billing_nomoney') .. amount,
|
||||
img = '/public/img/Apps/light_mode/billing.webp'
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
TriggerClientEvent('roadphone:sendNotification', src, {
|
||||
apptitle = 'APP_BILLING_NAME',
|
||||
title = Lang:t('info.billing_nomoney') .. amount,
|
||||
img = '/public/img/Apps/light_mode/billing.webp'
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
QBCore.Functions.CreateCallback('roadphone:server:getBillingIDS', function(source, cb)
|
||||
|
||||
local xPlayer = QBCore.Functions.GetPlayer(source)
|
||||
|
||||
if not xPlayer then
|
||||
return
|
||||
end
|
||||
|
||||
MySQL.Async.fetchAll('SELECT id FROM billing WHERE identifier = @identifier', {
|
||||
['@identifier'] = xPlayer.PlayerData.citizenid
|
||||
}, function(result)
|
||||
cb(result)
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
if Config.JaksamBilling then
|
||||
AddEventHandler("billing_ui:onBillCreated",
|
||||
function(billId, senderIdentfier, targetIdentifier, amount, date, unixDate)
|
||||
local xPlayer = QBCore.Functions.GetPlayerByCitizenId(targetIdentifier)
|
||||
if xPlayer then
|
||||
TriggerClientEvent('roadphone:updatebilling', xPlayer.PlayerData.source)
|
||||
end
|
||||
end)
|
||||
end
|
673
resources/[phone]/roadphone/server/serverAPI/serverAPI.lua
Normal file
673
resources/[phone]/roadphone/server/serverAPI/serverAPI.lua
Normal file
|
@ -0,0 +1,673 @@
|
|||
-- ==================================================================================== --
|
||||
-- RoadToSix ( orignal Creator )
|
||||
-- Dachlatti ( ESX to QBCore )
|
||||
-- ==================================================================================== --
|
||||
QBCore.Functions.CreateCallback('roadphone:getItemAmount', function(source, cb)
|
||||
|
||||
local hasItem = nil
|
||||
|
||||
if Config.NeedItem then
|
||||
if #Config.Items == 0 then
|
||||
cb(nil)
|
||||
return
|
||||
end
|
||||
local xPlayer = QBCore.Functions.GetPlayer(source)
|
||||
if not xPlayer then
|
||||
return;
|
||||
end
|
||||
for i = 1, #Config.Items, 1 do
|
||||
if Config.codeMInventory then
|
||||
|
||||
local hasItem = exports['codem-inventory']:HasItem(source, Config.Items[i], 1)
|
||||
|
||||
if hasItem then
|
||||
cb(Config.Items[i])
|
||||
return
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
local items = xPlayer.Functions.GetItemByName(Config.Items[i])
|
||||
|
||||
if items and items.count ~= 0 then
|
||||
hasItem = items.name
|
||||
cb(hasItem)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
cb(nil)
|
||||
else
|
||||
cb(true)
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateCallback('roadphone:getRadioAmount', function(source, cb)
|
||||
if Config.RadioNeedItem then
|
||||
if #Config.RadioItems == 0 then
|
||||
cb(nil)
|
||||
return
|
||||
end
|
||||
local xPlayer = QBCore.Functions.GetPlayer(source)
|
||||
if not xPlayer then
|
||||
return;
|
||||
end
|
||||
for i = 1, #Config.RadioItems, 1 do
|
||||
if Config.codeMInventory then
|
||||
|
||||
local hasItem = exports['codem-inventory']:HasItem(source, Config.RadioItems[i], 1)
|
||||
|
||||
if hasItem then
|
||||
cb(true)
|
||||
return
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
local items = xPlayer.Functions.GetItemByName(Config.RadioItems[i])
|
||||
if not items then
|
||||
print("Error: Item " .. Config.RadioItems[i] ..
|
||||
" not found in database. Please add this item in your database.")
|
||||
cb(nil)
|
||||
return
|
||||
end
|
||||
if items.count ~= 0 then
|
||||
cb(true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
cb(nil)
|
||||
else
|
||||
cb(true)
|
||||
end
|
||||
end)
|
||||
|
||||
function getPhoneRandomNumber()
|
||||
local numBase = math.random(1000000, 9999999)
|
||||
return string.format("%07d", numBase)
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
for i = 1, #Config.Items do
|
||||
QBCore.Functions.CreateUseableItem(Config.Items[i], function(source)
|
||||
TriggerClientEvent('roadphone:use', source)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterCommand('fixphone', function(source)
|
||||
TriggerEvent('roadphone:playerLoad', source)
|
||||
end)
|
||||
|
||||
function GetPlayerFromPhone(number)
|
||||
local identifier = MySQL.Sync.fetchScalar('SELECT citizenid FROM ' .. Config.UserTable ..
|
||||
' WHERE phone_number = @phone_number', {
|
||||
['@phone_number'] = number
|
||||
})
|
||||
|
||||
return QBCore.Functions.GetPlayerByCitizenId(identifier)
|
||||
end
|
||||
|
||||
function getJobName(identifier)
|
||||
|
||||
local xPlayer = QBCore.Functions.GetPlayerByCitizenId(identifier)
|
||||
|
||||
if xPlayer then
|
||||
return xPlayer.job.name
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
end
|
||||
|
||||
function getNumberFromIdentifier(identifier)
|
||||
|
||||
local phone_number = MySQL.Sync.fetchScalar('SELECT phone_number FROM ' .. Config.UserTable ..
|
||||
' WHERE citizenid = @identifier', {
|
||||
['@identifier'] = identifier
|
||||
})
|
||||
|
||||
return phone_number
|
||||
|
||||
end
|
||||
|
||||
function getIdentifierFromNumber(number)
|
||||
|
||||
local identifier = MySQL.Sync.fetchScalar('SELECT citizenid FROM ' .. Config.UserTable ..
|
||||
' WHERE phone_number = @phone_number', {
|
||||
['@phone_number'] = number
|
||||
})
|
||||
|
||||
return identifier
|
||||
|
||||
end
|
||||
|
||||
function getNameFromIdentifier(identifier)
|
||||
|
||||
local xPlayer = QBCore.Functions.GetPlayerByCitizenId(identifier)
|
||||
|
||||
if xPlayer then
|
||||
return xPlayer.PlayerData.charinfo.firstname .. ' ' .. xPlayer.PlayerData.charinfo.lastname
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
end
|
||||
|
||||
function getPlayersByJob(job)
|
||||
|
||||
local players = {}
|
||||
|
||||
for k, playerId in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local Player = QBCore.Functions.GetPlayer(playerId)
|
||||
|
||||
if Player and Player.PlayerData.job.name == job then
|
||||
table.insert(players, {
|
||||
id = Player.PlayerData.source
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
return players
|
||||
end
|
||||
|
||||
RegisterNetEvent('roadphone:sendDispatch')
|
||||
AddEventHandler('roadphone:sendDispatch', function(source, message, job, coords, anonym, image)
|
||||
|
||||
local _source = tonumber(source)
|
||||
local xPlayer = QBCore.Functions.GetPlayer(_source)
|
||||
|
||||
if not job or not message then
|
||||
return
|
||||
end
|
||||
|
||||
if xPlayer then
|
||||
local myPhone = getNumberFromIdentifier(xPlayer.PlayerData.citizenid)
|
||||
|
||||
local targets = getPlayersByJob(job)
|
||||
|
||||
if #targets == 0 then
|
||||
TriggerClientEvent('roadphone:sendOffNotification', _source, Lang:t('info.no_dispatchers'))
|
||||
return
|
||||
end
|
||||
|
||||
if not coords then
|
||||
coords = GetEntityCoords(GetPlayerPed(_source))
|
||||
end
|
||||
|
||||
local targetmessage = addServiceDispatch(myPhone, job, message, 0, 0, image, coords)
|
||||
local mymessage = addServiceDispatch(job, myPhone, message, 1, 1, image, coords)
|
||||
|
||||
for _, target in ipairs(targets) do
|
||||
TriggerClientEvent("roadphone:service:receiveMessage:job", target.id, targetmessage, 0)
|
||||
end
|
||||
|
||||
TriggerClientEvent("roadphone:service:receiveMessage", _source, mymessage, 1)
|
||||
|
||||
discordLog("15158332", "Service", 'Number: ' .. myPhone .. '\n' .. 'Message: ' .. message .. '\n' .. 'Received Job: ' .. job, "RoadPhone", nil, Cfg.ServiceWebhook, "Service")
|
||||
|
||||
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterCommand("waveverify", function(source, args)
|
||||
local src = source
|
||||
|
||||
if #args < 2 then
|
||||
TriggerClientEvent('roadphone:sendOffNotification', src, Lang:t('info.command_required_information'))
|
||||
return
|
||||
end
|
||||
|
||||
local auth = args[1]
|
||||
table.remove(args, 1)
|
||||
|
||||
local label = table.concat(args, ' ')
|
||||
|
||||
local verifyValue = auth == "true" and 1 or 0
|
||||
local query =
|
||||
"UPDATE `roadshop_tweetwave_accounts` SET `verify`= @verifyValue WHERE roadshop_tweetwave_accounts.username = @username"
|
||||
|
||||
MySQL.Async.execute(query, {
|
||||
['@verifyValue'] = verifyValue,
|
||||
['@username'] = label
|
||||
}, function(result)
|
||||
if (result == 1) then
|
||||
local message = verifyValue == 1 and Lang:t('info.wave_verify') or Lang:t('info.wave_remove_verify')
|
||||
TriggerClientEvent('roadphone:sendOffNotification', src, message)
|
||||
else
|
||||
TriggerClientEvent('roadphone:sendOffNotification', src, Lang:t('info.command_required_information'))
|
||||
end
|
||||
end)
|
||||
end, true)
|
||||
|
||||
RegisterCommand("connectverify", function(source, args)
|
||||
local src = source
|
||||
|
||||
if #args < 2 then
|
||||
TriggerClientEvent('roadphone:sendOffNotification', src, Lang:t('info.command_required_information'))
|
||||
return
|
||||
end
|
||||
|
||||
local auth = args[1]
|
||||
table.remove(args, 1)
|
||||
|
||||
local label = table.concat(args, ' ')
|
||||
|
||||
local verifyValue = auth == "true" and 1 or 0
|
||||
|
||||
MySQL.Async.execute(
|
||||
"UPDATE `roadshop_connect_accounts` SET `verify`= @verifyValue WHERE roadshop_connect_accounts.username = @username",
|
||||
{
|
||||
['@verifyValue'] = verifyValue,
|
||||
['@username'] = label
|
||||
}, function(result)
|
||||
if (result == 1) then
|
||||
local message = verifyValue == 1 and Lang:t('info.connect_verify') or
|
||||
Lang:t('info.connect_remove_verify')
|
||||
TriggerClientEvent('roadphone:sendOffNotification', src, message)
|
||||
else
|
||||
TriggerClientEvent('roadphone:sendOffNotification', src, Lang:t('info.command_required_information'))
|
||||
end
|
||||
end)
|
||||
end, true)
|
||||
|
||||
RegisterServerEvent("roadphone:server:call:eventnumber")
|
||||
AddEventHandler("roadphone:server:call:eventnumber", function(number)
|
||||
|
||||
if tostring(number) == "77777" then -- CHECK WHICH NUMBER IS CALLED
|
||||
|
||||
-- YOUR CODE
|
||||
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateCallback('roadphone:server:getEmployees', function(source, cb, society)
|
||||
|
||||
local users = QBCore.Functions.GetQBPlayers()
|
||||
local newusers = {}
|
||||
|
||||
if society == "unemployed" or society == "arbeitslos" then
|
||||
cb(newusers)
|
||||
print("[RoadPhone] Unemployed society is not allowed, please change the society name.")
|
||||
return
|
||||
end
|
||||
|
||||
for k, v in pairs(users) do
|
||||
if v.PlayerData.job.name == society then
|
||||
table.insert(newusers, {
|
||||
firstname = v.PlayerData.charinfo.firstname,
|
||||
lastname = v.PlayerData.charinfo.lastname,
|
||||
job_grade = v.PlayerData.job.grade.level,
|
||||
phone_number = v.PlayerData.phone_number,
|
||||
online = true
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
cb(newusers)
|
||||
|
||||
end)
|
||||
|
||||
function getPlayerFromIban(iban) -- okokBanking support
|
||||
|
||||
local players = QBCore.Functions.GetQBPlayers()
|
||||
local player = nil
|
||||
|
||||
for k, v in pairs(players) do
|
||||
local playerIban = v.PlayerData.charinfo.account
|
||||
|
||||
if playerIban == iban then
|
||||
player = v
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
return player
|
||||
|
||||
end
|
||||
|
||||
function getIbanFromPlayer(identifier) --okokBanking support
|
||||
|
||||
local Player = QBCore.Functions.GetPlayerByCitizenId(identifier)
|
||||
|
||||
if not Player then
|
||||
return
|
||||
end
|
||||
|
||||
return Player.PlayerData.charinfo.account
|
||||
|
||||
end
|
||||
|
||||
QBCore.Functions.CreateCallback('roadphone:okokBanking:getIban', function(source, cb)
|
||||
|
||||
local xPlayer = QBCore.Functions.GetPlayer(source)
|
||||
|
||||
if not xPlayer then
|
||||
return
|
||||
end
|
||||
|
||||
local iban = getIbanFromPlayer(xPlayer.PlayerData.citizenid)
|
||||
|
||||
cb(iban)
|
||||
|
||||
end)
|
||||
|
||||
|
||||
-- WEBHOOKS
|
||||
|
||||
function discordLog(color, name, message, footer, image, webhook, username)
|
||||
|
||||
if not message then
|
||||
message = ''
|
||||
end
|
||||
|
||||
if not username then
|
||||
username = 'RoadPhone'
|
||||
end
|
||||
|
||||
local embed;
|
||||
|
||||
if image then
|
||||
embed = {{
|
||||
["color"] = color,
|
||||
["title"] = "**" .. name .. "**",
|
||||
["description"] = message,
|
||||
["image"] = {
|
||||
url = image
|
||||
},
|
||||
["footer"] = {
|
||||
["text"] = footer
|
||||
}
|
||||
}}
|
||||
else
|
||||
embed = {{
|
||||
["color"] = color,
|
||||
["title"] = "**" .. name .. "**",
|
||||
["description"] = message,
|
||||
["footer"] = {
|
||||
["text"] = footer
|
||||
}
|
||||
}}
|
||||
end
|
||||
|
||||
if webhook == 'DISCORD WEBHOOK' then
|
||||
return
|
||||
end
|
||||
|
||||
PerformHttpRequest(webhook, function(err, text, headers)
|
||||
end, 'POST', json.encode({
|
||||
username = username,
|
||||
embeds = embed
|
||||
}), {
|
||||
['Content-Type'] = 'application/json'
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
function addServiceMessage(sender, receiver, message, isRead, isOwner)
|
||||
|
||||
local id = MySQL.Sync.insert(
|
||||
'INSERT INTO roadshop_service_messages (sender, receiver, message, isRead, isOwner) VALUES (@sender, @receiver, @message, @isRead, @isOwner)',
|
||||
{
|
||||
['@sender'] = sender,
|
||||
['@receiver'] = receiver,
|
||||
['@message'] = message,
|
||||
['@isRead'] = isRead,
|
||||
['@isOwner'] = isOwner
|
||||
})
|
||||
|
||||
local data = {
|
||||
id = id,
|
||||
sender = sender,
|
||||
receiver = receiver,
|
||||
message = message,
|
||||
isRead = isRead,
|
||||
isOwner = isOwner,
|
||||
date = tonumber(os.time() .. "000.0")
|
||||
}
|
||||
|
||||
return data
|
||||
|
||||
end
|
||||
|
||||
function addServiceDispatch(sender, receiver, message, isRead, isOwner, image, coords) --You can add your own dispatch system for the service app.
|
||||
|
||||
local id = MySQL.Sync.insert(
|
||||
'INSERT INTO roadshop_service_messages (sender, receiver, message, isRead, isOwner, isDispatch, image, coords) VALUES (@sender, @receiver, @message, @isRead, @isOwner, @isDispatch, @image, @coords)',
|
||||
{
|
||||
['@sender'] = sender,
|
||||
['@receiver'] = receiver,
|
||||
['@message'] = message,
|
||||
['@isRead'] = isRead,
|
||||
['@isOwner'] = isOwner,
|
||||
['@isDispatch'] = 1,
|
||||
['@image'] = image,
|
||||
['@coords'] = json.encode(coords)
|
||||
})
|
||||
|
||||
local data = {
|
||||
id = id,
|
||||
sender = sender,
|
||||
receiver = receiver,
|
||||
message = message,
|
||||
isRead = isRead,
|
||||
isOwner = isOwner,
|
||||
date = tonumber(os.time() .. "000.0"),
|
||||
image = image,
|
||||
isDispatch = 1,
|
||||
isAccepted = 0,
|
||||
isFinished = 0,
|
||||
isDeclined = 0,
|
||||
isAnonym = 0,
|
||||
coords = coords
|
||||
}
|
||||
|
||||
return data
|
||||
|
||||
end
|
||||
|
||||
function testMailServer(identifier)
|
||||
local data = {
|
||||
sender = 'RoadShop',
|
||||
subject = "RoadShop TEST",
|
||||
message = "Mails from scripts come back even better than before now even with <span style='color: red'>Color</span> support. <br> <br> + Support for line breaks and button support ^^",
|
||||
button = {
|
||||
buttonEvent = "qb-drugs:client:setLocation",
|
||||
buttonData = "test",
|
||||
buttonname = "test"
|
||||
}
|
||||
}
|
||||
|
||||
exports['roadphone']:sendMailOffline(identifier, data)
|
||||
end
|
||||
|
||||
function isAbleToTweet(identifier)
|
||||
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
function isAbleToPostConnect(identifier)
|
||||
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
|
||||
function getBlockedNumbers(identifier)
|
||||
local numbers = MySQL.Sync.fetchScalar("SELECT numbers FROM roadshop_blocked_numbers WHERE identifier = @identifier", {
|
||||
["@identifier"] = identifier
|
||||
})
|
||||
|
||||
if numbers then
|
||||
return json.decode(numbers)
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
end
|
||||
|
||||
RegisterServerEvent('roadphone:server:blocknumber')
|
||||
AddEventHandler("roadphone:server:blocknumber", function(number)
|
||||
|
||||
local _source = source
|
||||
local xPlayer = QBCore.Functions.GetPlayer(_source)
|
||||
|
||||
|
||||
if xPlayer then
|
||||
local identifier = xPlayer.PlayerData.citizenid
|
||||
|
||||
local numbers = MySQL.Sync.fetchScalar("SELECT numbers FROM roadshop_blocked_numbers WHERE identifier = @identifier", {
|
||||
["@identifier"] = identifier
|
||||
})
|
||||
|
||||
if numbers then
|
||||
numbers = json.decode(numbers)
|
||||
|
||||
if numbers == nil then
|
||||
numbers = {}
|
||||
end
|
||||
|
||||
for i = 1, #numbers do
|
||||
if tostring(numbers[i]) == tostring(number) then
|
||||
TriggerClientEvent("roadphone:sendNotification", _source, {
|
||||
apptitle = 'APP_CALL_NAME',
|
||||
title = _U('call_already_blocked'),
|
||||
img = "/public/img/Apps/light_mode/call.webp"
|
||||
})
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(numbers, number)
|
||||
|
||||
TriggerClientEvent("roadphone:blocked:numbers", _source, 'add', number)
|
||||
|
||||
MySQL.Async.execute("UPDATE roadshop_blocked_numbers SET numbers = @numbers WHERE identifier = @identifier", {
|
||||
["@identifier"] = identifier,
|
||||
["@numbers"] = json.encode(numbers)
|
||||
})
|
||||
return
|
||||
end
|
||||
|
||||
numbers = {}
|
||||
|
||||
table.insert(numbers, number)
|
||||
|
||||
MySQL.Async.execute("INSERT INTO roadshop_blocked_numbers (identifier, numbers) VALUES (@identifier, @number)", {
|
||||
["@identifier"] = identifier,
|
||||
["@number"] = json.encode(numbers)
|
||||
})
|
||||
|
||||
TriggerClientEvent("roadphone:blocked:numbers", _source, 'add', number)
|
||||
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('roadphone:server:unblocknumber')
|
||||
AddEventHandler("roadphone:server:unblocknumber", function(number)
|
||||
|
||||
local _source = source
|
||||
local xPlayer = QBCore.Functions.GetPlayer(_source)
|
||||
|
||||
if xPlayer then
|
||||
local identifier = xPlayer.PlayerData.citizenid
|
||||
|
||||
local numbers = MySQL.Sync.fetchScalar("SELECT numbers FROM roadshop_blocked_numbers WHERE identifier = @identifier", {
|
||||
["@identifier"] = identifier
|
||||
})
|
||||
|
||||
if numbers then
|
||||
numbers = json.decode(numbers)
|
||||
|
||||
if numbers == nil then
|
||||
numbers = {}
|
||||
end
|
||||
|
||||
for i = 1, #numbers do
|
||||
if tostring(numbers[i]) == tostring(number) then
|
||||
table.remove(numbers, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
MySQL.Async.execute("UPDATE roadshop_blocked_numbers SET numbers = @numbers WHERE identifier = @identifier", {
|
||||
["@identifier"] = identifier,
|
||||
["@numbers"] = json.encode(numbers)
|
||||
})
|
||||
|
||||
TriggerClientEvent("roadphone:blocked:numbers", _source, 'remove', number)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
function addServiceDispatchAnonym(sender, receiver, message, isRead, isOwner, image, coords) -- You can add your own dispatch system for the service app.
|
||||
|
||||
local id = MySQL.Sync.insert(
|
||||
'INSERT INTO roadshop_service_messages (sender, receiver, message, isRead, isOwner, isDispatch, isAnonym, image, coords) VALUES (@sender, @receiver, @message, @isRead, @isOwner, @isDispatch, @isAnonym, @image, @coords)',
|
||||
{
|
||||
['@sender'] = sender,
|
||||
['@receiver'] = receiver,
|
||||
['@message'] = message,
|
||||
['@isRead'] = isRead,
|
||||
['@isOwner'] = isOwner,
|
||||
['@isDispatch'] = 1,
|
||||
['@isAnonym'] = 1,
|
||||
['@image'] = image,
|
||||
['@coords'] = json.encode(coords)
|
||||
})
|
||||
|
||||
local data = {
|
||||
id = id,
|
||||
sender = sender,
|
||||
receiver = receiver,
|
||||
message = message,
|
||||
isRead = isRead,
|
||||
isOwner = isOwner,
|
||||
date = tonumber(os.time() .. "000.0"),
|
||||
image = image,
|
||||
isDispatch = 1,
|
||||
isAccepted = 0,
|
||||
isFinished = 0,
|
||||
isDeclined = 0,
|
||||
isAnonym = 1,
|
||||
coords = coords
|
||||
}
|
||||
|
||||
return data
|
||||
|
||||
end
|
||||
|
||||
exports('sendDispatchAnonym', function (job, title, message, coords, image)
|
||||
|
||||
if not job or not message or not title or not coords then
|
||||
return
|
||||
end
|
||||
|
||||
local targets = getPlayersByJob(job)
|
||||
|
||||
local targetmessage = addServiceDispatchAnonym(title, job, message, 0, 0, image, coords)
|
||||
|
||||
for _, target in ipairs(targets) do
|
||||
TriggerClientEvent("roadphone:service:receiveMessage:job", target.id, targetmessage, 0)
|
||||
end
|
||||
|
||||
discordLog("15158332", "Service",'ServerSide triggered Dispatch \n' .. 'Title: ' .. title .. '\n' .. 'Message: ' .. message .. '\n' .. 'Received Job: ' .. job, "RoadPhone", nil, Cfg.ServiceWebhook, "Service")
|
||||
|
||||
end)
|
||||
|
||||
RegisterCommand('anonymDispatch', function ()
|
||||
|
||||
exports['roadphone']:sendDispatchAnonym('police', 'Robbery', 'Robbery infos: xyz', {x = -1851.1, y = -1248.8, z = 8.6}, nil)
|
||||
|
||||
end)
|
||||
|
||||
function addTaxiMoneySociety(payment)
|
||||
|
||||
exports['qb-banking']:AddMoney(Config.TaxiSociety, payment, 'Customer payment')
|
||||
|
||||
end
|
117
resources/[phone]/roadphone/server/serverAPI/valet.lua
Normal file
117
resources/[phone]/roadphone/server/serverAPI/valet.lua
Normal file
|
@ -0,0 +1,117 @@
|
|||
QBCore.Functions.CreateCallback("roadphone:valet:getCars", function(source, cb)
|
||||
|
||||
local xPlayer = QBCore.Functions.GetPlayer(source)
|
||||
|
||||
if not xPlayer then
|
||||
return;
|
||||
end
|
||||
|
||||
local result
|
||||
|
||||
if Config.JGAdvancedGarages then
|
||||
result = MySQL.Sync.fetchAll("SELECT * FROM " .. Config.OwnedVehiclesTable .. " WHERE `citizenid` = @identifier and `impound` = @impound", {
|
||||
['@impound'] = 0,
|
||||
['@identifier'] = xPlayer.PlayerData.citizenid
|
||||
})
|
||||
else
|
||||
result = MySQL.Sync.fetchAll("SELECT * FROM " .. Config.OwnedVehiclesTable .. " WHERE `citizenid` = @identifier", {
|
||||
['@identifier'] = xPlayer.PlayerData.citizenid
|
||||
})
|
||||
end
|
||||
|
||||
local cachedvehicles = {}
|
||||
|
||||
for i = 1, #result do
|
||||
|
||||
local Garage = result[i].garage_id
|
||||
|
||||
table.insert(cachedvehicles, {
|
||||
plate = result[i].plate,
|
||||
vehicle = result[i].vehicle,
|
||||
hash = result[i].hash,
|
||||
garage = result[i].garage,
|
||||
stored = result[i].state
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
cb(cachedvehicles)
|
||||
|
||||
end)
|
||||
|
||||
|
||||
QBCore.Functions.CreateCallback('roadphone:valet:loadVehicle', function(source, cb, plate)
|
||||
|
||||
local valetCheck = valetServerSideCheck(plate)
|
||||
local xPlayer = QBCore.Functions.GetPlayer(source)
|
||||
|
||||
if valetCheck ~= false then
|
||||
cb(false, valetCheck)
|
||||
return;
|
||||
end
|
||||
|
||||
if not xPlayer then
|
||||
cb(false)
|
||||
return;
|
||||
end
|
||||
|
||||
MySQL.Async.fetchAll('SELECT * FROM ' .. Config.OwnedVehiclesTable .. ' WHERE `plate` = @plate AND `citizenid` = @identifier', {
|
||||
['@plate'] = plate,
|
||||
['@identifier'] = xPlayer.PlayerData.citizenid
|
||||
}, function(vehicle)
|
||||
cb(vehicle)
|
||||
end)
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateCallback('roadphone:valet:checkMoney', function(source, cb)
|
||||
local xPlayer = QBCore.Functions.GetPlayer(source)
|
||||
|
||||
if not xPlayer then
|
||||
return;
|
||||
end
|
||||
|
||||
if xPlayer.Functions.GetMoney('bank') > Config.ValetDeliveryPrice then
|
||||
xPlayer.Functions.RemoveMoney('bank', Config.ValetDeliveryPrice, 'Car delivered')
|
||||
|
||||
local number = getNumberFromIdentifier(xPlayer.PlayerData.citizenid)
|
||||
|
||||
TriggerEvent("roadphone:addBankTransfer", number, 0, Lang:t('info.valet_car_delivered'), Config.ValetDeliveryPrice)
|
||||
|
||||
TriggerClientEvent("roadphone:sendNotification", source, {
|
||||
apptitle = "APP_VALET_NAME",
|
||||
title = "APP_VALET_CAR_ONTHEWAY",
|
||||
img = "/public/img/Apps/light_mode/valet.webp"
|
||||
})
|
||||
|
||||
discordLog("9807270", "Valet", xPlayer.PlayerData.name .. ' ' .. Lang:t('info.valet_car_delivered_2', { value = Config.ValetDeliveryPrice }), 'RoadPhone - Valet', nil, Cfg.ValetWebhook)
|
||||
cb(true)
|
||||
return;
|
||||
else
|
||||
TriggerClientEvent("roadphone:sendNotification", source, {
|
||||
apptitle = "APP_VALET_NAME",
|
||||
title = "APP_VALET_NOTENOUGHMONEY",
|
||||
img = "/public/img/Apps/light_mode/valet.webp"
|
||||
})
|
||||
|
||||
cb(false)
|
||||
return;
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent("roadphone:valetCarSetOutside")
|
||||
AddEventHandler("roadphone:valetCarSetOutside", function(plate)
|
||||
|
||||
if Config.cdGarages or Config.JGAdvancedGarages then
|
||||
MySQL.Async.execute('UPDATE '..Config.OwnedVehiclesTable..' SET `in_garage` = @in_garage WHERE `plate` = @plate', {
|
||||
['@plate'] = plate,
|
||||
['@in_garage'] = 0,
|
||||
})
|
||||
return
|
||||
end
|
||||
|
||||
MySQL.Async.execute("UPDATE " .. Config.OwnedVehiclesTable .. " SET `state` = @stored WHERE `plate` = @plate", {
|
||||
["@plate"] = plate,
|
||||
["@stored"] = 0
|
||||
})
|
||||
end)
|
89
resources/[phone]/roadphone/server/serverAPI/webhooks.lua
Normal file
89
resources/[phone]/roadphone/server/serverAPI/webhooks.lua
Normal file
|
@ -0,0 +1,89 @@
|
|||
function messageWebhook(source, myPhone, phoneNumber, message)
|
||||
|
||||
discordLog(5763719, "Message", "**"..myPhone.."** sent a message to **"..phoneNumber.."**" .. "\n\n**Message:** " .. message, "RoadPhone", nil, Cfg.MessageWebhook, "Messages")
|
||||
|
||||
end
|
||||
|
||||
function messageGroup(source, number, groupid, message)
|
||||
|
||||
discordLog(5763719, "Message", "**"..number.."** sent a message to group **"..groupid.."**" .. "\n\n**Message:** " .. message, "RoadPhone", nil, Cfg.MessageWebhook, "Messages")
|
||||
|
||||
end
|
||||
|
||||
function connectWebhook(source, author, message, picture)
|
||||
|
||||
discordLog("1942002", "The User " .. author .. " has posted a new post!", message, "RoadPhone Connect", picture, Cfg.ConnectWebhook, "Connect")
|
||||
|
||||
end
|
||||
|
||||
function TweetWaveWebhook(source, author, message, image)
|
||||
|
||||
discordLog("1942002", "The User " .. author .. " has posted a new Tweet!", message, "RoadPhone TweetWave", image, Cfg.TweetWaveWebhook, "TweetWave")
|
||||
|
||||
end
|
||||
|
||||
function AdvertisingWebhook(source, number, title, text, picture)
|
||||
|
||||
discordLog("16776960", "Advertising", 'Number: ' .. number .. '\n' .. 'Title: ' .. title .. '\n' .. 'Text: ' .. text, "RoadPhone", picture, Cfg.AdvertisingWebhook, "Advertising")
|
||||
|
||||
|
||||
end
|
||||
|
||||
function cryptoExploitWebhook(xPlayer, amount, coinid)
|
||||
|
||||
discordLog("15548997", "Exploit", 'The user ' .. xPlayer.PlayerData.citizenid .. ' has tried to exploit the Crypto System. He tried to sell ( ' .. amount .. ' ) ' .. coinid .. '.', "RoadPhone", nil, Cfg.ExploitWebhook)
|
||||
|
||||
end
|
||||
function cryptoExploitWebhookBuy(xPlayer, amount, coinid)
|
||||
|
||||
discordLog("15548997", "Exploit", 'The user ' .. xPlayer.PlayerData.citizenid .. ' has tried to exploit the Crypto System. He tried to buy ( ' .. amount .. ' ) ' .. coinid .. '.', "RoadPhone", nil, Cfg.ExploitWebhook)
|
||||
|
||||
end
|
||||
|
||||
function bankWebhook(selfsource, targetsource, selfname, targetname, amount)
|
||||
|
||||
discordLog("5763719", "Bank", "Sender: " .. selfname .. "\n" .. "Receiver: " .. targetname .. "\n" .. "Amount: " .. amount, "RoadPhone - Bank", nil, Cfg.BankWebhook, "Bank")
|
||||
|
||||
end
|
||||
|
||||
function darkchatWebhook(xPlayer, groupname, message)
|
||||
|
||||
discordLog("2303786", "DarkChat", "**"..xPlayer.PlayerData.citizenid .."** sent a message to group **"..groupname.."**" .. "\n\n**Message:** " .. message, "RoadPhone", nil, Cfg.DarkchatWebhook, "DarkChat")
|
||||
|
||||
end
|
||||
|
||||
function callLog(caller, target, callerNumber, targetNumber, isAnonym)
|
||||
|
||||
isAnonym = isAnonym == 1 and "Yes" or "No"
|
||||
|
||||
if not target then
|
||||
target = {
|
||||
PlayerData = {
|
||||
charinfo = {
|
||||
firstname = "( Player is not online )"
|
||||
},
|
||||
citizenid = "( Player is not online )"
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
discordLog("5763719", "Call", "**"..caller.PlayerData.charinfo.firstname.."** started a call to **"..target.PlayerData.charinfo.firstname.."**" .. "\n\n**Number from Caller:** " .. callerNumber .. "\n\n**Number from Target:** " .. targetNumber .. "\n\n**Call is Anonym:** " .. isAnonym .. "\n\n**Caller Identifier:** **" .. caller.PlayerData.citizenid .. "** \n\n**Target Identifier:** **" .. target.PlayerData.citizenid .. "**", "RoadPhone", nil, Cfg.CallWebhook)
|
||||
|
||||
|
||||
end
|
||||
|
||||
function tweetWaveCommentLog(src, comment)
|
||||
|
||||
|
||||
discordLog("5763719", "TweetWave Comment", "Player Source: **" .. src .. '** \n CommentID: **' .. comment.id .. '** \n AuthorID: **' .. comment.authorId .. '** \n Author: **' .. comment.author .. '** \n Message: **' .. comment.message .. '** \n PostID: **' .. comment.postid .. '** \n', "RoadPhone", nil, Cfg.TweetWaveCommentsWebhook)
|
||||
|
||||
|
||||
end
|
||||
|
||||
function connectCommentLog(src, comment)
|
||||
|
||||
|
||||
discordLog("5763719", "Connect Comment", "Player Source: **" .. src .. '** \n CommentID: **' .. comment.id .. '** \n AuthorID: **' .. comment.authorId .. '** \n Author: **' .. comment.author .. '** \n Message: **' .. comment.message .. '** \n PostID: **' .. comment.postid .. '** \n', "RoadPhone", nil, Cfg.ConnectCommentsWebhook)
|
||||
|
||||
|
||||
end
|
BIN
resources/[phone]/roadphone/server/service.lua
Normal file
BIN
resources/[phone]/roadphone/server/service.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/taxi.lua
Normal file
BIN
resources/[phone]/roadphone/server/taxi.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/tweetwave.lua
Normal file
BIN
resources/[phone]/roadphone/server/tweetwave.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/versioncheck.lua
Normal file
BIN
resources/[phone]/roadphone/server/versioncheck.lua
Normal file
Binary file not shown.
BIN
resources/[phone]/roadphone/server/voicememos.lua
Normal file
BIN
resources/[phone]/roadphone/server/voicememos.lua
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue