Add files

This commit is contained in:
Jérémie N'gadi
2017-08-02 12:11:31 +02:00
parent 47b662aab1
commit dcf8df0df8
6 changed files with 976 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
description 'ESX Taxi Job'
client_scripts {
'config.lua',
'client/main.lua'
}
server_scripts {
'config.lua',
'server/main.lua'
}
+756
View File
@@ -0,0 +1,756 @@
local Keys = {
["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
}
ESX = nil
local PlayerData = {}
local GUI = {}
GUI.Time = 0
local HasAlreadyEnteredMarker = false
local LastZone = nil
local CurrentAction = nil
local CurrentActionMsg = ''
local CurrentActionData = {}
local OnJob = false
local CurrentCustomer = nil
local CurrentCustomerBlip = nil
local DestinationBlip = nil
local IsNearCustomer = false
local CustomerIsEnteringVehicle = false
local CustomerEnteredVehicle = false
local TargetCoords = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
function DrawSub(msg, time)
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString(msg)
DrawSubtitleTimed(time, 1)
end
function ShowLoadingPromt(msg, time, type)
Citizen.CreateThread(function()
Citizen.Wait(0)
N_0xaba17d7ce615adbf("STRING")
AddTextComponentString(msg)
N_0xbd12f8228410d9b4(type)
Citizen.Wait(time)
N_0x10d373323e5b9c0d()
end)
end
function GetRandomPed()
local peds = {}
local handle, ped = FindFirstPed()
local success = nil
repeat
table.insert(peds, ped)
success, ped = FindNextPed(handle)
until not success
EndFindPed(handle)
if #peds > 0 then
return peds[GetRandomIntInRange(1, #peds)]
end
end
function ClearCurrentMission()
if DoesBlipExist(CurrentCustomerBlip) then
RemoveBlip(CurrentCustomerBlip)
end
if DoesBlipExist(DestinationBlip) then
RemoveBlip(DestinationBlip)
end
CurrentCustomer = nil
CurrentCustomerBlip = nil
DestinationBlip = nil
IsNearCustomer = false
CustomerIsEnteringVehicle = false
CustomerEnteredVehicle = false
TargetCoords = nil
end
function StartTaxiJob()
ShowLoadingPromt('Prise de service : Taxi/Uber', 5000, 3)
ClearCurrentMission()
OnJob = true
end
function StopTaxiJob()
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, false) and CurrentCustomer ~= nil then
local vehicle = GetVehiclePedIsIn(playerPed, false)
TaskLeaveVehicle(CurrentCustomer, vehicle, 0)
if CustomerEnteredVehicle then
TaskGoStraightToCoord(CurrentCustomer, TargetCoords.x, TargetCoords.y, TargetCoords.z, 1.0, -1, 0.0, 0.0)
end
end
ClearCurrentMission()
OnJob = false
DrawSub('Mission terminée', 5000)
end
function OpenTaxiActionsMenu()
local elements = {
{label = 'Sortir Véhicule', value = 'spawn_vehicle'}
}
if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' then
table.insert(elements, {label = 'Retirer argent société', value = 'withdraw_society_money'})
table.insert(elements, {label = 'Déposer argent ', value = 'deposit_money'})
table.insert(elements, {label = 'Blanchir argent', value = 'wash_money'})
end
ESX.UI.Menu.CloseAll()
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'taxi_actions',
{
title = 'Taxi',
elements = elements
},
function(data, menu)
if data.current.value == 'spawn_vehicle' then
menu.close()
if Config.MaxInService == -1 then
local playerPed = GetPlayerPed(-1)
local coords = Config.Zones.VehicleSpawnPoint.Pos
ESX.Game.SpawnVehicle('taxi', coords, 225.0, function(vehicle)
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
end)
else
ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount)
if canTakeService then
local playerPed = GetPlayerPed(-1)
local coords = Config.Zones.VehicleSpawnPoint.Pos
ESX.Game.SpawnVehicle('taxi', coords, 225.0, function(vehicle)
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
end)
else
ESX.ShowNotification('Service complet : ' .. inServiceCount .. '/' .. maxInService)
end
end, 'taxi')
end
end
if data.current.value == 'withdraw_society_money' then
ESX.UI.Menu.Open(
'dialog', GetCurrentResourceName(), 'withdraw_society_money_amount',
{
title = 'Montant du retrait'
},
function(data, menu)
local amount = tonumber(data.value)
if amount == nil then
ESX.ShowNotification('Montant invalide')
else
menu.close()
TriggerServerEvent('esx_society:withdrawMoney', 'taxi', amount)
end
end,
function(data, menu)
menu.close()
end
)
end
if data.current.value == 'deposit_money' then
ESX.UI.Menu.Open(
'dialog', GetCurrentResourceName(), 'deposit_money_amount',
{
title = 'Montant du dépôt'
},
function(data, menu)
local amount = tonumber(data.value)
if amount == nil then
ESX.ShowNotification('Montant invalide')
else
menu.close()
TriggerServerEvent('esx_society:depositMoney', 'taxi', amount)
end
end,
function(data, menu)
menu.close()
end
)
end
if data.current.value == 'wash_money' then
ESX.UI.Menu.Open(
'dialog', GetCurrentResourceName(), 'wash_money_amount',
{
title = 'Montant à blanchir'
},
function(data, menu)
local amount = tonumber(data.value)
if amount == nil then
ESX.ShowNotification('Montant invalide')
else
menu.close()
TriggerServerEvent('esx_society:washMoney', 'taxi', amount)
end
end,
function(data, menu)
menu.close()
end
)
end
end,
function(data, menu)
menu.close()
CurrentAction = 'taxi_actions_menu'
CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour accéder au menu'
CurrentActionData = {}
end
)
end
function OpenMobileTaxiActionsMenu()
ESX.UI.Menu.CloseAll()
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'mobile_taxi_actions',
{
title = 'Taxi',
elements = {
{label = 'Facuration', value = 'billing'}
}
},
function(data, menu)
if data.current.value == 'billing' then
ESX.UI.Menu.Open(
'dialog', GetCurrentResourceName(), 'billing',
{
title = 'Montant de la facture'
},
function(data, menu)
local amount = tonumber(data.value)
if amount == nil then
ESX.ShowNotification('Montant invalide')
else
menu.close()
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
if closestPlayer == -1 or closestDistance > 3.0 then
ESX.ShowNotification('Aucun joueur à proximité')
else
TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_taxi', 'Taxi', amount)
end
end
end,
function(data, menu)
menu.close()
end
)
end
end,
function(data, menu)
menu.close()
end
)
end
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
PlayerData = xPlayer
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
PlayerData.job = job
end)
AddEventHandler('esx_taxijob:hasEnteredMarker', function(zone)
if zone == 'TaxiActions' then
CurrentAction = 'taxi_actions_menu'
CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour accéder au menu'
CurrentActionData = {}
end
if zone == 'VehicleDeleter' then
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, false) then
CurrentAction = 'delete_vehicle'
CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour ranger le véhicule'
CurrentActionData = {}
end
end
end)
AddEventHandler('esx_taxijob:hasExitedMarker', function(zone)
CurrentAction = nil
end)
RegisterNetEvent('esx_phone:loaded')
AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts)
local specialContact = {
name = 'Taxi',
number = 'taxi',
base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGGElEQVR4XsWWW2gd1xWGv7Vn5pyRj47ut8iOYlmyWxw1KSZN4riOW6eFuCYldaBtIL1Ag4NNmt5ICORCaNKXlF6oCy0hpSoJKW4bp7Sk6YNb01RuLq4d0pQ0kWQrshVJ1uX46HJ0zpy5rCKfQYgjCUs4kA+GtTd786+ftW8jqsqHibB6TLZn2zeq09ZTWAIWCxACoTI1E+6v+eSpXwHRqkVZPcmqlBzCApLQ8dk3IWVKMQlYcHG81OODNmD6D7d9VQrTSbwsH73lFKePtvOxXSfn48U+Xpb58fl5gPmgl6DiR19PZN4+G7iODY4liIAACqiCHyp+AFvb7ML3uot1QP5yDUim292RtIqfU6Lr8wFVDVV8AsPKRDAxzYkKm2kj5sSFuUT3+v2FXkDXakD6f+7c1NGS7Ml0Pkah6jq8mhvwUy7Cyijg5Aoks6/hTp+k7vRjDJ73dmw8WHxlJRM2y5Nsb3GPDuzsZURbGMsUmRkoUPByCMrKCG7SobJiO01X7OKq6utoe3XX34BaoLDaCljj3faTcu3j3z3T+iADwzNYEmKIWcGAIAtqqkKAxZa2Sja/tY+59/7y48aveQ8A4Woq4Fa3bj7Q1/EgwWRAZ52NMTYCWAZEwIhBUEQgUiVQ8IpKvqj4kVJCyGRCRrb+hvap+gPAo0DuUhWQfx2q29u+t/vPmarbCLwII7qQTEQRLbUtBJ2PAkZARBADqkLBV/I+BGrhpoSN577FWz3P3XbTvRMvAlpuwC4crv5jwtK9RAFSu46+G8cRwESxQ+K2gESAgCiIASHuA8YCBdSUohdCKGCF0H6iGc3MgrEphvKi+6Wp24HABioSjuxFARGobyJ5OMXEiGHW6iLR0EmifhPJDddj3CoqtuwEZSkCc73/RAvTeEOvU5w8gz/Zj2TfoLFFibZvQrI5EOFiPqgAZmzApTINKKgPiW20ffkXtPXfA9Ysmf5/kHn/T0z8e5rpCS5JVQNUN1ayfn2a+qvT2JWboOOXMPg0ms6C2IAAWTc2ACPeupdbm5yb8XNQczOM90DOB0uoa01Ttz5FZ6IL3Ctg9DUIg7Lto2DZ0HIDFEbAz4AaiBRyxZJe9U7kQg84KYbH/JeJESANXPXwXdWffvzu1p+x5VE4/ST4EyAOoEAI6WsAhdx/AYulhJDqAgRm/hPPEVAfnAboeAB6v88jTw/f98SzU8eAwbgC5IGRg3vsW3E7YewYzJwF4wAhikJURGqvBO8ouAFIxBI0gqgPEp9B86+ASSAIEEHhbEnX7eTgnrFbn3iW5+K82EAA+M2V+d2EeRj9K/izIBYgJZGwCO4Gzm/uRQOwDEsI41PSfPZ+xJsBKwFo6dOwpJvezMU84Md5sSmRCM51uacGbUKvHWEjAKIelXaGJqePyopjzFTdx6Ef/gDbjo3FKEoQKN+8/yEqRt8jf67IaNDBnF9FZFwERRGspMM20+XC64nym9AMhSE1G7fjbb0bCQsISi6vFCdPMPzuUwR9AcmOKQ7cew+WZcq3IGEYMZeb4p13sjjmU4TX7Cfdtp0oDAFBbZfk/37N0MALAKbcAKaY4yPeuwy3t2J8MAKDIxDVd1Lz8Ts599vb8Wameen532GspRWIQmXPHV8k0BquvPP3TOSgsRmiCFRAHWh9420Gi7nl34JaBen7O7UWRMD740AQ7yEf8nW78TIeN+7+PCIsOYaqMJHxqKtpJ++D+DA5ARsawEmASqzv1Cz7FjRpbt951tUAOcAHdNEUC7C5NAJo7Dws03CAFMxlkdSRZmCMxaq8ejKuVwSqIJfzA61LmyIgBoxZfgmYmQazKLGumHitRso0ZVkD0aE/FI7UrYv2WUYXjo0ihNhEatA1GBEUIxEWAcKCHhHCVMG8AETlda0ENn3hrm+/6Zh47RBCtXn+mZ/sAXzWjnPHV77zkiXBgl6gFkee+em1wBlgdnEF8sCF5moLI7KwlSIMwABwgbVT21htMNjleheAfPkShEBh/PzQccexdxBT9IPjQAYYZ+3o2OjQ8cQiPb+kVwBCliENXA3sAm6Zj3E/zaq4fD07HmwEmuKYXsUFcDl6Hz7/B1RGfEbPim/bAAAAAElFTkSuQmCC',
}
TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon)
end)
-- Create Blips
Citizen.CreateThread(function()
local blip = AddBlipForCoord(Config.Zones.TaxiActions.Pos.x, Config.Zones.TaxiActions.Pos.y, Config.Zones.TaxiActions.Pos.z)
SetBlipSprite (blip, 198)
SetBlipDisplay(blip, 4)
SetBlipScale (blip, 1.0)
SetBlipColour (blip, 5)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Taxi")
EndTextCommandSetBlipName(blip)
end)
-- Display markers
Citizen.CreateThread(function()
while true do
Wait(0)
if PlayerData.job ~= nil and PlayerData.job.name == 'taxi' then
local coords = GetEntityCoords(GetPlayerPed(-1))
for k,v in pairs(Config.Zones) do
if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then
DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, false, false, false)
end
end
end
end
end)
-- Enter / Exit marker events
Citizen.CreateThread(function()
while true do
Wait(0)
if PlayerData.job ~= nil and PlayerData.job.name == 'taxi' then
local coords = GetEntityCoords(GetPlayerPed(-1))
local isInMarker = false
local currentZone = nil
for k,v in pairs(Config.Zones) do
if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then
isInMarker = true
currentZone = k
end
end
if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then
HasAlreadyEnteredMarker = true
LastZone = currentZone
TriggerEvent('esx_taxijob:hasEnteredMarker', currentZone)
end
if not isInMarker and HasAlreadyEnteredMarker then
HasAlreadyEnteredMarker = false
TriggerEvent('esx_taxijob:hasExitedMarker', LastZone)
end
end
end
end)
-- Taxi Job
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local playerPed = GetPlayerPed(-1)
if OnJob then
if CurrentCustomer == nil then
DrawSub('Conduisez à la recherche de ~y~passagers', 5000)
if IsPedInAnyVehicle(playerPed, false) and GetEntitySpeed(playerPed) > 0 then
local waitUntil = GetGameTimer() + GetRandomIntInRange(1000, 120000)
while OnJob and waitUntil > GetGameTimer() do
Citizen.Wait(0)
end
if OnJob and IsPedInAnyVehicle(playerPed, false) and GetEntitySpeed(playerPed) > 0 then
while CurrentCustomer == nil do
local ped = GetRandomPed()
if IsPedHuman(ped) and IsPedWalking(ped) then
CurrentCustomer = ped
end
end
CurrentCustomerBlip = AddBlipForEntity(CurrentCustomer)
SetBlipAsFriendly(CurrentCustomerBlip, 1)
SetBlipColour(CurrentCustomerBlip, 2)
SetBlipCategory(CurrentCustomerBlip, 3)
SetBlipRoute(CurrentCustomerBlip, true)
SetEntityAsMissionEntity(CurrentCustomer, true)
ClearPedTasksImmediately(CurrentCustomer)
SetBlockingOfNonTemporaryEvents(CurrentCustomer, 1)
local standTime = GetRandomIntInRange(60000, 180000)
TaskStandStill(CurrentCustomer, standTime)
ESX.ShowNotification('Vous avez ~g~trouvé~s~ un client, conduisez jusqu\'à ce dernier')
end
end
else
if IsPedFatallyInjured(CurrentCustomer) then
ESX.ShowNotification('Votre client est ~r~inconscient~w~. Cherchez-en un autre.')
if DoesBlipExist(CurrentCustomerBlip) then
RemoveBlip(CurrentCustomerBlip)
end
if DoesBlipExist(DestinationBlip) then
RemoveBlip(DestinationBlip)
end
SetEntityAsMissionEntity(CurrentCustomer, false)
CurrentCustomer = nil
CurrentCustomerBlip = nil
DestinationBlip = nil
IsNearCustomer = false
CustomerIsEnteringVehicle = false
CustomerEnteredVehicle = false
TargetCoords = nil
end
if IsPedInAnyVehicle(playerPed, false) then
local vehicle = GetVehiclePedIsIn(playerPed, false)
local playerCoords = GetEntityCoords(playerPed)
local customerCoords = GetEntityCoords(CurrentCustomer)
local customerDistance = GetDistanceBetweenCoords(playerCoords.x, playerCoords.y, playerCoords.z, customerCoords.x, customerCoords.y, customerCoords.z)
if IsPedSittingInVehicle(CurrentCustomer, vehicle) then
if CustomerEnteredVehicle then
local targetDistance = GetDistanceBetweenCoords(playerCoords.x, playerCoords.y, playerCoords.z, TargetCoords.x, TargetCoords.y, TargetCoords.z)
if targetDistance <= 10.0 then
TaskLeaveVehicle(CurrentCustomer, vehicle, 0)
ESX.ShowNotification('Vous êtes ~g~arrivé~s~ à destination')
TaskGoStraightToCoord(CurrentCustomer, TargetCoords.x, TargetCoords.y, TargetCoords.z, 1.0, -1, 0.0, 0.0)
SetEntityAsMissionEntity(CurrentCustomer, false)
TriggerServerEvent('esx_taxijob:success')
RemoveBlip(DestinationBlip)
CurrentCustomer = nil
CurrentCustomerBlip = nil
DestinationBlip = nil
IsNearCustomer = false
CustomerIsEnteringVehicle = false
CustomerEnteredVehicle = false
TargetCoords = nil
end
DrawMarker(1, TargetCoords.x, TargetCoords.y, TargetCoords.z - 1.0, 0, 0, 0, 0, 0, 0, 4.0, 4.0, 2.0, 178, 236, 93, 155, 0, 0, 2, 0, 0, 0, 0)
else
RemoveBlip(CurrentCustomerBlip)
CurrentCustomerBlip = nil
TargetCoords = Config.JobLocations[GetRandomIntInRange(1, #Config.JobLocations)]
local street = table.pack(GetStreetNameAtCoord(TargetCoords.x, TargetCoords.y, TargetCoords.z))
local msg = nil
if street[2] ~= 0 and street[2] ~= nil then
msg = string.format("~w~Emmenez-moi à~y~ %s~w~, près de~y~ %s", GetStreetNameFromHashKey(street[1]),GetStreetNameFromHashKey(street[2]))
else
msg = string.format("~w~Emmenez-moi à~y~ %s", GetStreetNameFromHashKey(street[1]))
end
ESX.ShowNotification(msg)
DestinationBlip = AddBlipForCoord(TargetCoords.x, TargetCoords.y, TargetCoords.z)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Destination")
EndTextCommandSetBlipName(blip)
SetBlipRoute(DestinationBlip, true)
CustomerEnteredVehicle = true
end
else
if not CustomerIsEnteringVehicle then
DrawMarker(1, customerCoords.x, customerCoords.y, customerCoords.z - 1.0, 0, 0, 0, 0, 0, 0, 4.0, 4.0, 2.0, 178, 236, 93, 155, 0, 0, 2, 0, 0, 0, 0)
end
if not CustomerEnteredVehicle then
if customerDistance <= 30.0 then
if not IsNearCustomer then
ESX.ShowNotification('Vous êtes à proximité du client, approchez-vous de lui')
IsNearCustomer = true
end
end
if customerDistance <= 10.0 then
if not CustomerIsEnteringVehicle then
ClearPedTasksImmediately(CurrentCustomer)
local seat = 0
for i=4, 0, 1 do
if IsVehicleSeatFree(vehicle, seat) then
seat = i
break
end
end
TaskEnterVehicle(CurrentCustomer, vehicle, -1, seat, 2.0, 1)
CustomerIsEnteringVehicle = true
end
end
end
end
else
DrawSub('Veuillez remonter dans votre véhicule pour continuer la mission', 5000)
end
end
end
end
end)
-- Key Controls
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if CurrentAction ~= nil then
SetTextComponentFormat('STRING')
AddTextComponentString(CurrentActionMsg)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
if IsControlPressed(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'taxi' and (GetGameTimer() - GUI.Time) > 300 then
if CurrentAction == 'taxi_actions_menu' then
OpenTaxiActionsMenu()
end
if CurrentAction == 'delete_vehicle' then
local playerPed = GetPlayerPed(-1)
local vehicle = GetVehiclePedIsIn(playerPed, false)
if GetEntityModel(vehicle) == GetHashKey('taxi') then
if Config.MaxInService ~= -1 then
TriggerServerEvent('esx_service:disableService', 'taxi')
end
DeleteVehicle(vehicle)
else
ESX.ShowNotification('Vous ne pouvez ranger que les taxi')
end
end
CurrentAction = nil
GUI.Time = GetGameTimer()
end
end
if IsControlPressed(0, Keys['F6']) and Config.EnablePlayerManagement and (GetGameTimer() - GUI.Time) > 150 then
OpenMobileTaxiActionsMenu()
GUI.Time = GetGameTimer()
end
if IsControlPressed(0, Keys['DELETE']) and (GetGameTimer() - GUI.Time) > 150 then
if OnJob then
StopTaxiJob()
else
if PlayerData.job ~= nil and PlayerData.job.name == 'taxi' then
local playerPed = GetPlayerPed(-1)
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('Vous devez être dans un taxi pour commencer la mission')
end
end
else
if PlayerData.job.grade >= 3 then
ESX.ShowNotification('Vous devez être dans un véhicule pour commencer la mission')
else
ESX.ShowNotification('Vous devez être dans un taxi pour commencer la mission')
end
end
end
end
GUI.Time = GetGameTimer()
end
end
end)
+124
View File
@@ -0,0 +1,124 @@
Config = {}
Config.DrawDistance = 100.0
Config.NPCJobEarnings = {min = 15, max = 40}
Config.MaxInService = 2
Config.EnablePlayerManagement = false
Config.Zones = {
TaxiActions = {
Pos = {x = 915.039, y = -162.187, z = 73.684},
Size = {x = 1.5, y = 1.5, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Type = 1
},
VehicleSpawnPoint = {
Pos = {x = 911.108, y = -177.867, z = 74.283},
Size = {x = 1.5, y = 1.5, z = 1.0},
Type = -1
},
VehicleDeleter = {
Pos = {x = 908.317, y = -183.070, z = 73.201},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Type = 1
}
}
Config.JobLocations = {
{x = 293.476, y = -590.163, z = 42.7371},
{x = 253.404, y = -375.86, z = 44.0819},
{x = 120.808, y = -300.416, z = 45.1399},
{x = -38.4132, y = -381.576, z = 38.3456},
{x = -107.442, y = -614.377, z = 35.6703},
{x = -252.292, y = -856.474, z = 30.5626},
{x = -236.138, y = -988.382, z = 28.7749},
{x = -276.989, y = -1061.18, z = 25.6853},
{x = -576.451, y = -998.989, z = 21.785},
{x = -602.798, y = -952.63, z = 21.6353},
{x = -790.653, y = -961.855, z = 14.8932},
{x = -912.588, y = -864.756, z = 15.0057},
{x = -1069.77, y = -792.513, z = 18.8075},
{x = -1306.94, y = -854.085, z = 15.0959},
{x = -1468.51, y = -681.363, z = 26.178},
{x = -1380.89, y = -452.7, z = 34.0843},
{x = -1326.35, y = -394.81, z = 36.0632},
{x = -1383.68, y = -269.985, z = 42.4878},
{x = -1679.61, y = -457.339, z = 39.4048},
{x = -1812.45, y = -416.917, z = 43.6734},
{x = -2043.64, y = -268.291, z = 22.9927},
{x = -2186.45, y = -421.595, z = 12.6776},
{x = -1862.08, y = -586.528, z = 11.1747},
{x = -1859.5, y = -617.563, z = 10.8788},
{x = -1634.95, y = -988.302, z = 12.6241},
{x = -1283.99, y = -1154.16, z = 5.30998},
{x = -1126.47, y = -1338.08, z = 4.63434},
{x = -867.907, y = -1159.67, z = 5.00795},
{x = -847.55, y = -1141.38, z = 6.27591},
{x = -722.625, y = -1144.6, z = 10.2176},
{x = -575.503, y = -318.446, z = 34.5273},
{x = -592.309, y = -224.853, z = 36.1209},
{x = -559.594, y = -162.873, z = 37.7547},
{x = -534.992, y = -65.6695, z = 40.634},
{x = -758.234, y = -36.6906, z = 37.2911},
{x = -1375.88, y = 20.9516, z = 53.2255},
{x = -1320.25, y = -128.018, z = 48.097},
{x = -1285.71, y = 294.287, z = 64.4619},
{x = -1245.67, y = 386.533, z = 75.0908},
{x = -760.355, y = 285.015, z = 85.0667},
{x = -626.786, y = 254.146, z = 81.0964},
{x = -563.609, y = 267.962, z = 82.5116},
{x = -486.806, y = 271.977, z = 82.8187},
{x = 88.295, y = 250.867, z = 108.188},
{x = 234.087, y = 344.678, z = 105.018},
{x = 434.963, y = 96.707, z = 99.1713},
{x = 482.617, y = -142.533, z = 58.1936},
{x = 762.651, y = -786.55, z = 25.8915},
{x = 809.06, y = -1290.8, z = 25.7946},
{x = 490.819, y = -1751.37, z = 28.0987},
{x = 432.351, y = -1856.11, z = 27.0352},
{x = 164.348, y = -1734.54, z = 28.8982},
{x = -57.6909, y = -1501.4, z = 31.1084},
{x = 52.2241, y = -1566.65, z = 29.006},
{x = 310.222, y = -1376.76, z = 31.4442},
{x = 181.967, y = -1332.79, z = 28.8773},
{x = -74.6091, y = -1100.64, z = 25.738},
{x = -887.045, y = -2187.46, z = 8.13248},
{x = -749.584, y = -2296.59, z = 12.4627},
{x = -1064.83, y = -2560.66, z = 19.6811},
{x = -1033.44, y = -2730.24, z = 19.6868},
{x = -1018.67, y = -2732, z = 13.2687},
{x = 797.354, y = -174.423, z = 72.708},
{x = 508.156, y = -117.908, z = 60.78},
{x = 159.458, y = -27.555, z = 67.38},
{x = -36.382, y = -106.912, z = 56.982},
{x = -355.801, y = -270.404, z = 33.011},
{x = -831.196, y = -76.871, z = 37.323},
{x = -1038.707, y = -214.593, z = 37},
{x = 1918.448, y = 3691.41, z = 32.261},
{x = 1820.217, y = 3697.115, z = 33.493},
{x = 1619.323, y = 3827.162, z = 34.482},
{x = 1418.628, y = 3602.243, z = 34.511},
{x = 1944.858, y = 3856.252, z = 31.741},
{x = 2285.278, y = 3839.444, z = 34.023},
{x = 2760.945, y = 3387.813, z = 55.659},
{x = 1952.819, y = 2627.731, z = 45.368},
{x = 1051.414, y = 474.833, z = 93.653},
{x = 866.393, y = 17.635, z = 78.654},
{x = 318.985, y = 167.41, z = 103.335},
{x = 88.836, y = 254.054, z = 108.236},
{x = -44.852, y = 70.414, z = 72.437},
{x = -115.496, y = 84.333, z = 70.792},
{x = -384.806, y = 226.868, z = 83.548},
{x = -578.669, y = 139.085, z = 61.337},
{x = -651.334, y = -584.879, z = 34.116},
{x = -571.847, y = -1195.648, z = 17.869},
{x = -1513.271, y = -670.039, z = 28.362},
{x = -1297.484, y = -654.913, z = 26.123},
{x = -1645.546, y = 144.571, z = 61.664},
{x = -1160.618, y = 744.418, z = 154.571},
{x = -798.09, y = 831.699, z = 204.351},
}
+15
View File
@@ -0,0 +1,15 @@
INSERT INTO `addon_account` VALUES (name, label, shared)
('society_taxi','Taxi',1)
;
INSERT INTO `jobs` (name, label) VALUES
('taxi','Taxi')
;
INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES
('taxi',0,'recrue','Recrue',12,'{}','{}'),
('taxi',1,'novice','Novice',24,'{}','{}'),
('taxi',2,'experimente','Experimente',36,'{}','{}'),
('taxi',3,'uber','Uber',48,'{}','{}'),
('taxi',4,'boss','Patron',0,'{}','{}')
;
+11
View File
@@ -0,0 +1,11 @@
INSERT INTO `jobs` (name, label) VALUES
('taxi','Taxi')
;
INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES
('taxi',0,'recrue','Recrue',12,'{}','{}'),
('taxi',1,'novice','Novice',24,'{}','{}'),
('taxi',2,'experimente','Experimente',36,'{}','{}'),
('taxi',3,'uber','Uber',48,'{}','{}'),
('taxi',4,'boss','Patron',0,'{}','{}')
;
+57
View File
@@ -0,0 +1,57 @@
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
if Config.MaxInService ~= -1 then
TriggerEvent('esx_service:activateService', 'taxi', Config.MaxInService)
end
RegisterServerEvent('esx_taxijob:success')
AddEventHandler('esx_taxijob:success', function()
local xPlayer = ESX.GetPlayerFromId(source)
local total = math.random(Config.NPCJobEarnings.min, Config.NPCJobEarnings.max);
local societyAccount = nil
if xPlayer.job.grade >= 3 then
total = total * 2
end
TriggerEvent('esx_addonaccount:getSharedAccount', 'society_taxi', function(account)
societyAccount = account
end)
if societyAccount ~= nil then
local playerMoney = math.floor(total / 100 * 30)
local societyMoney = math.floor(total / 100 * 70)
xPlayer.addMoney(playerMoney)
societyAccount.addMoney(societyMoney)
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez gagné ~g~$'.. playerMoney)
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Votre société a gagné ~g~$'.. societyMoney)
else
xPlayer.addMoney(total)
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez gagné ~g~$'.. total)
end
end)
TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message, anon)
local xPlayer = ESX.GetPlayerFromId(source)
local xPlayers = ESX.GetPlayers()
if phoneNumber == 'taxi' then
for k, v in pairs(xPlayers) do
if v.job.name == 'taxi' then
TriggerClientEvent('esx_phone:onMessage', v.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, 'Appel Taxi')
end
end
end
end)