Moved NPC job to F6 menu

This commit is contained in:
ElPumpo
2018-08-13 14:20:19 +02:00
parent 903be46d31
commit 2f3bd4734b
8 changed files with 96 additions and 78 deletions
+80 -77
View File
@@ -279,60 +279,98 @@ end
function OpenMobileTaxiActionsMenu()
ESX.UI.Menu.CloseAll()
ESX.UI.Menu.CloseAll()
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'mobile_taxi_actions',
{
title = 'Taxi',
align = 'top-left',
elements = {
{label = _U('billing'), value = 'billing'}
}
},
function(data, menu)
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_taxi_actions',
{
title = 'Taxi',
align = 'top-left',
elements = {
{ label = _U('billing'), value = 'billing' },
{ label = _U('start_job'), value = 'start_job' }
}
}, function(data, menu)
if data.current.value == 'billing' then
if data.current.value == 'billing' then
ESX.UI.Menu.Open(
'dialog', GetCurrentResourceName(), 'billing',
{
title = _U('invoice_amount')
},
function(data, menu)
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'billing', {
title = _U('invoice_amount')
}, function(data, menu)
local amount = tonumber(data.value)
local amount = tonumber(data.value)
if amount == nil then
ESX.ShowNotification(_U('amount_invalid'))
else
menu.close()
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
if closestPlayer == -1 or closestDistance > 3.0 then
ESX.ShowNotification(_U('no_players_near'))
else
TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_taxi', 'Taxi', amount)
ESX.ShowNotification(_U('billing_sent'))
end
if amount == nil then
ESX.ShowNotification(_U('amount_invalid'))
else
end
menu.close()
end, function(data, menu)
menu.close()
end)
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
elseif data.current.value == 'start_job' then
if OnJob then
StopTaxiJob()
else
if closestPlayer == -1 or closestDistance > 3.0 then
ESX.ShowNotification(_U('no_players_near'))
else
TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_taxi', 'Taxi', amount)
end
if PlayerData.job ~= nil and PlayerData.job.name == 'taxi' then
end
local playerPed = PlayerPedId()
if IsPedInAnyVehicle(playerPed, false) then
end,
function(data, menu)
menu.close()
end
)
local vehicle = GetVehiclePedIsIn(playerPed, false)
if PlayerData.job.grade >= 3 then
StartTaxiJob()
else
if IsInAuthorizedVehicle() then
StartTaxiJob()
else
ESX.ShowNotification(_U('must_in_taxi'))
end
end
end
else
end,
function(data, menu)
menu.close()
end
)
if PlayerData.job.grade >= 3 then
ESX.ShowNotification(_U('must_in_vehicle'))
else
ESX.ShowNotification(_U('must_in_taxi'))
end
end
end
end
end
end, function(data, menu)
menu.close()
end)
end
function IsInAuthorizedVehicle()
local playerPed = PlayerPedId()
local vehModel = GetEntityModel(GetVehiclePedIsIn(playerPed, false))
for i=1, #Config.AuthorizedVehicles, 1 do
if vehModel == GetHashKey(Config.AuthorizedVehicles[i].model) then
return true
end
end
return false
end
function OpenGetStocksMenu()
@@ -818,7 +856,7 @@ Citizen.CreateThread(function()
TriggerServerEvent('esx_society:putVehicleInGarage', 'taxi', vehicleProps)
ESX.Game.DeleteVehicle(CurrentActionData.vehicle)
else
if GetEntityModel(CurrentActionData.vehicle) == GetHashKey('taxi') then
if IsInAuthorizedVehicle() then
ESX.Game.DeleteVehicle(CurrentActionData.vehicle)
if Config.MaxInService ~= -1 then
@@ -837,41 +875,6 @@ Citizen.CreateThread(function()
if IsControlJustReleased(0, Keys['F6']) and GetLastInputMethod(2) and not IsDead and Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.name == 'taxi' then
OpenMobileTaxiActionsMenu()
elseif IsControlJustReleased(0, Keys['DELETE']) and GetLastInputMethod(2) and not IsDead then
if OnJob then
StopTaxiJob()
else
if PlayerData.job ~= nil and PlayerData.job.name == 'taxi' then
local playerPed = PlayerPedId()
if IsPedInAnyVehicle(playerPed, false) then
local vehicle = GetVehiclePedIsIn(playerPed, false)
if PlayerData.job.grade >= 3 then
StartTaxiJob()
else
if GetEntityModel(vehicle) == GetHashKey('taxi') then
StartTaxiJob()
else
ESX.ShowNotification(_U('must_in_taxi'))
end
end
else
if PlayerData.job.grade >= 3 then
ESX.ShowNotification(_U('must_in_vehicle'))
else
ESX.ShowNotification(_U('must_in_taxi'))
end
end
end
end
end
end
end)
+2
View File
@@ -17,8 +17,10 @@ Locales['br'] = {
['amount_invalid'] = 'Valor inválido',
['press_to_open'] = 'Pressione ~INPUT_CONTEXT~ para acessar o menu',
['billing'] = 'Faturamento',
['billing_sent'] = 'the bill has been registered!',
['invoice_amount'] = 'Valor da fatura',
['no_players_near'] = 'Nenhum jogador nas proximidades',
['start_job'] = 'start / stop driving NPC jobs',
['drive_search_pass'] = 'Dirigindo em busca de ~y~passageiros',
['customer_found'] = 'Você ~g~encontrou~s~ um passageiro, dirija até o destino',
['client_unconcious'] = 'Seu passageiro está ~r~insconsciente~w~. Procure por outro.',
+2
View File
@@ -17,8 +17,10 @@ Locales['de'] = {
['amount_invalid'] = 'Betrag ungültig',
['press_to_open'] = 'Drücke ~INPUT_CONTEXT~ um das Menü zu öffnen',
['billing'] = 'Rechnung',
['billing_sent'] = 'the bill has been registered!',
['invoice_amount'] = 'Rechnugsbetrag',
['no_players_near'] = 'Kein Spieler in der Nähe',
['start_job'] = 'start / stop driving NPC jobs',
['drive_search_pass'] = 'Auf der Suche nach ~y~Passagieren',
['customer_found'] = 'du hast einen Passagier ~g~gefunden~s~ , Fahre in zum Ziel',
['client_unconcious'] = 'dein Passagier ist ~r~bewusstlos~s~. Suche nach einem anderen.',
+2
View File
@@ -17,8 +17,10 @@ Locales['en'] = {
['amount_invalid'] = 'amount invalid',
['press_to_open'] = 'press ~INPUT_CONTEXT~ to access the menu',
['billing'] = 'billing',
['billing_sent'] = 'the bill has been registered!',
['invoice_amount'] = 'invoice amount',
['no_players_near'] = 'no players nearby',
['start_job'] = 'start / stop driving NPC jobs',
['drive_search_pass'] = 'driving in search of ~y~passengers',
['customer_found'] = 'you have ~g~found~s~ a customer, drive until last',
['client_unconcious'] = 'your client is ~r~unconscious~s~. Look for another one.',
+2
View File
@@ -17,8 +17,10 @@ Locales['fi'] = {
['amount_invalid'] = 'virheellinen summa',
['press_to_open'] = 'paina ~INPUT_CONTEXT~ avataksesi valikko',
['billing'] = 'Laskutus',
['billing_sent'] = 'the bill has been registered!',
['invoice_amount'] = 'laskun määrä',
['no_players_near'] = 'ei pelaajia lähellä',
['start_job'] = 'start / stop driving NPC jobs',
['drive_search_pass'] = 'Ajele ympäriinsä etsi uusia ~y~asiakkaita',
['customer_found'] = 'Sinä ~g~löysit~s~ asiakkaan, aja lähemmäksi',
['client_unconcious'] = 'Sinun asiakkaasi on ~r~tajuton~s~. Etsi uusi.',
+2
View File
@@ -17,8 +17,10 @@ Locales['fr'] = {
['amount_invalid'] = 'montant invalide',
['press_to_open'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder au menu',
['billing'] = 'facuration',
['billing_sent'] = 'the bill has been registered!',
['invoice_amount'] = 'montant de la facture',
['no_players_near'] = 'aucun joueur à proximité',
['start_job'] = 'start / stop driving NPC jobs',
['drive_search_pass'] = 'conduisez à la recherche de ~y~passagers',
['customer_found'] = 'vous avez ~g~trouvé~s~ un client, conduisez jusqu\'à ce dernier',
['client_unconcious'] = 'votre client est ~r~inconscient~w~. Cherchez-en un autre.',
+2
View File
@@ -17,8 +17,10 @@ Locales['pl'] = {
['amount_invalid'] = 'wartość nieprawidłowa',
['press_to_open'] = 'naciśnij ~INPUT_CONTEXT~ aby wejść do menu',
['billing'] = 'rachunek',
['billing_sent'] = 'the bill has been registered!',
['invoice_amount'] = 'wartość należności',
['no_players_near'] = 'brak graczy w pobliżu',
['start_job'] = 'start / stop driving NPC jobs',
['drive_search_pass'] = 'jazda w poszukiwaniu ~y~pasażerów',
['customer_found'] = '~g~Znalazłeś~s~ klienta, jedź do niego',
['client_unconcious'] = 'twój jest ~r~nieprzytomny xD~s~. Poszukaj innego.',
+4 -1
View File
@@ -11,14 +11,17 @@ Locales['sv'] = {
['spawn_veh'] = 'plocka ut taxi',
['spawnpoint_blocked'] = 'det är ett fordon som blockerar spawnpointen!',
['only_taxi'] = 'du kan endast lagra ~y~taxi fordon~s~ här..',
['taking_service'] = 'du deltog tjänst: ',
['full_service'] = 'du kan inte delta tjänst: ',
['amount_invalid'] = 'ogiltig mängd!',
['press_to_open'] = 'tryck ~INPUT_CONTEXT~ för att öppna menyn.',
['billing'] = 'skapa räkning',
['billing_sent'] = 'räkningen har registrerats!',
['invoice_amount'] = 'faktureringsbelopp',
['no_players_near'] = 'det finns ingen spelare i närheten!',
['drive_search_pass'] = 'åk runt för att hitta ~y~kunder~s~',
['start_job'] = 'starta / sluta köra NPC',
['drive_search_pass'] = 'Åtk runt för att hitta ~y~kunder~s~',
['customer_found'] = 'du har ~g~hittat~s~ en kund!',
['client_unconcious'] = 'din kund är ~r~medvetslös~s~. Hitta en ny.',
['arrive_dest'] = 'du har ~g~anlänt~s~ till din destination',