From ec41b368d9803e5fdb2f34b75e63546f2eed1a59 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Wed, 26 Feb 2020 02:01:27 +0400 Subject: [PATCH 01/26] Update server.lua --- accounts/server.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/accounts/server.lua b/accounts/server.lua index ae0cf04d..d021cc19 100644 --- a/accounts/server.lua +++ b/accounts/server.lua @@ -40,6 +40,9 @@ AddEvent("OnPlayerSteamAuth", OnPlayerSteamAuth) function OnPlayerQuit(player) PlayerData[player].is_online = 0 + if PlayerData[player].job == "taxi" or PlayerData[player].job == "delivery" then + PlayerData[player].job = "" + end SavePlayerAccount(player) GatheringCleanPlayerActions(player)-- → Gathering DestroyPlayerData(player) @@ -103,7 +106,7 @@ function OnAccountCheckIpBan(player) end function CreatePlayerAccount(player) - local query = mariadb_prepare(sql, "INSERT INTO `accounts` (`id`, `steamid`, `name`, `clothing`, `police`, `medic`, `inventory`, `position`, `admin`, `health`, `health_state`, `death_pos`, `armor`, `thirst`, `hunger`, `bank_balance`, `created`, `phone_number`, `driver_license`, `gun_license`, `helicopter_license`, `drug_knowledge`, `job`, `is_cuffed`, `age`) VALUES (NULL, '?', 'Unregistered', '[]', '0', '0', '[]', '[]', '0', '100', 'alive', '', '0', '100', '100', '4900', '0', NULL, '0', '0', '0', '[]', NULL, '0', '0');", + local query = mariadb_prepare(sql, "INSERT INTO `accounts` (`id`, `steamid`, `name`, `clothing`, `police`, `medic`, `inventory`, `position`, `admin`, `health`, `health_state`, `death_pos`, `armor`, `thirst`, `hunger`, `bank_balance`, `created`, `phone_number`, `driver_license`, `gun_license`, `helicopter_license`, `taxi_license`, `drug_knowledge`, `job`, `is_cuffed`, `age`) VALUES (NULL, '?', 'Unregistered', '[]', '0', '0', '[]', '[]', '0', '100', 'alive', '', '0', '100', '100', '4900', '0', NULL, '0', '0', '0', '0', '[]', NULL, '0', '0');", tostring(GetPlayerSteamId(player))) mariadb_query(sql, query, OnAccountCreated, player) @@ -150,6 +153,7 @@ function OnAccountLoaded(player) PlayerData[player].driver_license = math.tointeger(result['driver_license']) PlayerData[player].gun_license = math.tointeger(result['gun_license']) PlayerData[player].helicopter_license = math.tointeger(result['helicopter_license']) + PlayerData[player].taxi_license = math.tointeger(result['taxi_license']) PlayerData[player].inventory = json_decode(result['inventory']) PlayerData[player].created = math.tointeger(result['created']) PlayerData[player].position = json_decode(result['position']) @@ -259,6 +263,7 @@ function CreatePlayerData(player) PlayerData[player].driver_license = 0 PlayerData[player].gun_license = 0 PlayerData[player].helicopter_license = 0 + PlayerData[player].taxi_license = 0 PlayerData[player].logged_in = false PlayerData[player].admin = 0 PlayerData[player].created = 0 @@ -286,11 +291,11 @@ function DestroyPlayerData(player) return end - -- if PlayerData[player].job_vehicle ~= nil then - -- DestroyVehicle(PlayerData[player].job_vehicle) - -- DestroyVehicleData(PlayerData[player].job_vehicle) - -- PlayerData[player].job_vehicle = nil - -- end + if PlayerData[player].job_vehicle ~= nil then + DestroyVehicle(PlayerData[player].job_vehicle) + DestroyVehicleData(PlayerData[player].job_vehicle) + PlayerData[player].job_vehicle = nil + end local attachedObjects = { "backpack", "mask_1", "mask_2", "mask_3", "mask_4" } @@ -301,7 +306,6 @@ function DestroyPlayerData(player) end end - print("Player disconnected : " .. PlayerData[player].accountid) PlayerData[player] = nil print("Data destroyed for : " .. player) end @@ -321,7 +325,7 @@ function SavePlayerAccount(player) local x, y, z = GetPlayerLocation(player) PlayerData[player].position = {x = x, y = y, z = z} - local query = mariadb_prepare(sql, "UPDATE accounts SET admin = ?, bank_balance = ?, health = ?, armor = ?, hunger = ?, thirst = ?, name = '?', clothing = '?', inventory = '?', created = '?', position = '?', driver_license = ?, gun_license = ?, helicopter_license = ?, drug_knowledge = '?', job = '?', is_cuffed = ?, age = ?, is_online = '?' WHERE id = ? LIMIT 1;", + local query = mariadb_prepare(sql, "UPDATE accounts SET admin = ?, bank_balance = ?, health = ?, armor = ?, hunger = ?, thirst = ?, name = '?', clothing = '?', inventory = '?', created = '?', position = '?', driver_license = ?, gun_license = ?, helicopter_license = ?, taxi_license = ?, drug_knowledge = '?', job = '?', is_cuffed = ?, age = ?, is_online = '?' WHERE id = ? LIMIT 1;", PlayerData[player].admin, PlayerData[player].bank_balance, PlayerData[player].health, @@ -336,6 +340,7 @@ function SavePlayerAccount(player) PlayerData[player].driver_license, PlayerData[player].gun_license, PlayerData[player].helicopter_license, + PlayerData[player].taxi_license, json_encode(PlayerData[player].drug_knowledge), PlayerData[player].job or "", PlayerData[player].is_cuffed or 0, From ad5e34c0fbe49511577c0d1b2d4bf804a477be63 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Wed, 26 Feb 2020 02:02:53 +0400 Subject: [PATCH 02/26] Update server.lua --- accounts/server.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/accounts/server.lua b/accounts/server.lua index d021cc19..7d7ff239 100644 --- a/accounts/server.lua +++ b/accounts/server.lua @@ -291,11 +291,11 @@ function DestroyPlayerData(player) return end - if PlayerData[player].job_vehicle ~= nil then - DestroyVehicle(PlayerData[player].job_vehicle) - DestroyVehicleData(PlayerData[player].job_vehicle) - PlayerData[player].job_vehicle = nil - end + --if PlayerData[player].job_vehicle ~= nil then + --DestroyVehicle(PlayerData[player].job_vehicle) + --DestroyVehicleData(PlayerData[player].job_vehicle) + --PlayerData[player].job_vehicle = nil + --end local attachedObjects = { "backpack", "mask_1", "mask_2", "mask_3", "mask_4" } From 49acb2cee735ad3761eb16708b828a5b89ce491c Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Wed, 26 Feb 2020 02:03:36 +0400 Subject: [PATCH 03/26] Add files via upload --- taxi/c_taxi.lua | 162 +++++++++++++++++++++++ taxi/s_taxi.lua | 331 ++++++++++++++++++++++++++++++++++++++++++++++ taxi/taxihud.html | 89 +++++++++++++ 3 files changed, 582 insertions(+) create mode 100644 taxi/c_taxi.lua create mode 100644 taxi/s_taxi.lua create mode 100644 taxi/taxihud.html diff --git a/taxi/c_taxi.lua b/taxi/c_taxi.lua new file mode 100644 index 00000000..30faba4f --- /dev/null +++ b/taxi/c_taxi.lua @@ -0,0 +1,162 @@ +local Dialog = ImportPackage("dialogui") +local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end + +local IsOnDuty = false + +local taxiMenu +local taxiNpcGarageMenu +local taxiPayMenu +local CourseTime +local taxicourse + +local taxiNpcIds = {} +local taxiVehicleNpcIds = {} +local taxiGarageIds = {} + +local TaxiHud + +function OnPackageStart() + TaxiHud = CreateWebUI(0, 0, 0, 0, 0, 60) + SetWebAlignment(TaxiHud, 1.0, 0.0) + SetWebAnchors(TaxiHud, 0.0, 0.0, 1.0, 1.0) + LoadWebFile(TaxiHud, "http://asset/onsetrp/taxi/taxihud.html") + SetWebVisibility(TaxiHud, WEB_HIDDEN) +end +AddEvent("OnPackageStart", OnPackageStart) + + +AddRemoteEvent("taxi:setup", function(_taxiNpcIds, _taxiGarageIds, _taxiVehicleNpcIds) + taxiNpcIds = _taxiNpcIds + taxiGarageIds = _taxiGarageIds + taxiVehicleNpcIds = _taxiVehicleNpcIds +end) + +AddRemoteEvent("taxi:client:isonduty", function(isOnDuty) + IsOnDuty = isOnDuty +end) + +AddEvent("OnTranslationReady", function() + -- TAXI MENU + taxiMenu = Dialog.create(_("taxi_menu"), nil, _("start_course"), _("end_course"), _("payement"), _("callouts"), _("callouts_menu_end_callout"), _("cancel")) + + -- SPAWN VEHICLE MENU + taxiNpcGarageMenu = Dialog.create(_("taxi_garage_menu"), nil, _("spawn_taxi_car"), _("cancel")) + + -- PAYEMENT MENU + taxiPayMenu = Dialog.create(_("payement menu"), nil, _("payin_cash"), _("payin_bank"), _("cancel")) +end) + +AddEvent("OnKeyPress", function(key) + + if key == JOB_MENU_KEY and not GetPlayerBusy() and IsOnDuty then + Dialog.show(taxiMenu) + end + + if key == INTERACT_KEY and not GetPlayerBusy() and IsOnDuty and IsNearbyNpc(GetPlayerId(), taxiVehicleNpcIds) ~= false then + Dialog.show(taxiNpcGarageMenu) + end + + if key == INTERACT_KEY and not GetPlayerBusy() and IsNearbyNpc(GetPlayerId(), taxiNpcIds) ~= false then + AskForTaxiJob(IsNearbyNpc(GetPlayerId(), taxiNpcIds)) + end +end) + +function AskForTaxiJob(npc) + + local message = (IsOnDuty and _("taxi_npc_message_stop") or _("taxi_npc_message_start")) + startCinematic({ + title = _("taxi_npc_name"), + message = message, + actions = { + { + text = _("yes"), + callback = "taxi:startstopcinematic" + }, + { + text = _("no"), + close_on_click = true + } + } + }, NearestTaxi, "ITSJUSTRIGHT") +end + +AddEvent("taxi:startstopcinematic", function() + + local message = (IsOnDuty and _("taxi_service_npc_end") or _("taxi_service_npc_starting")) + updateCinematic({ + message = message + }, NearestTaxi, "WALLLEAN04") + Delay(1500, function() + stopCinematic() + end) + CallRemoteEvent("taxi:startstopservice") +end) + +AddEvent("OnDialogSubmit", function(dialog, button, ...) + local args = {...} + if dialog == taxiMenu then + if button == 1 then -- start course + CallRemoteEvent("course:start") + end + if button == 2 then -- stop course + CallRemoteEvent("course:stop") + end + if button == 3 then + Dialog.show(taxiPayMenu) + end + if button == 4 then -- take callout + CallEvent("callouts:openingmenu") + end + if button == 5 then -- end callout + CallEvent("callouts:stoppingcallout") + end + end + + if dialog == taxiNpcGarageMenu then + if button == 1 then + CallRemoteEvent("taxi:spawnvehicle") + end + --[[if button == 2 then + CallRemoteEvent("taxi:checkbank") + end]] + end + + if dialog == taxiPayMenu then + if button == 1 then + CallRemoteEvent("notifCash") + end + if button == 2 then + CallRemoteEvent("bankPay", CourseTime) + end + end +end) + +function IsNearbyNpc(player, npcs) + local x, y, z = GetPlayerLocation(player) + for k, v in pairs(npcs) do + local x2, y2, z2 = GetNPCLocation(v) + if x2 ~= false and GetDistance3D(x, y, z, x2, y2, z2) <= 200 then return v end + end + return false +end + + +--- Course + +AddRemoteEvent("course", function(state) + if state then + SetWebVisibility(TaxiHud, WEB_HITINVISIBLE) + local CourseTime = 0 + ExecuteWebJS(TaxiHud, "StartCourse("..CourseTime..");") + taxicourse = CreateTimer(function(player) + CourseTime = CourseTime + 1 + ExecuteWebJS(TaxiHud, "StartCourse("..CourseTime..");") + end, 2000, player) + else + DestroyTimer(taxicourse) + end +end) + +AddRemoteEvent("HideTaxiHud", function() + SetWebVisibility(TaxiHud, WEB_HIDDEN) +end) \ No newline at end of file diff --git a/taxi/s_taxi.lua b/taxi/s_taxi.lua new file mode 100644 index 00000000..f4ea5c4a --- /dev/null +++ b/taxi/s_taxi.lua @@ -0,0 +1,331 @@ +local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end + +local MAX_TAXI = 10 -- Number of taximens at the same time +local ALLOW_RESPAWN_VEHICLE = true -- Allow the respawn of the vehicle by destroying the previously spawned one. (Can break RP if the car is stolen or need repairs or fuel) +local CAUTION = 1500 -- Amount of the commission +local state = false +local TaxiState = false + +local occupants = {} + +local VEHICLE_SPAWN_LOCATION = { + {x = 177218, y = 159869, z = 4817, h = -70}, +} + +local TAXI_SERVICE_NPC = { + {x = 176053, y = 158567, z = 4850, h = 0}, +} + +local TAXI_VEHICLE_NPC = { + {x = 176211, y = 159760, z = 4818, h = 10}, +} + +local TAXI_GARAGE = { + {x = 175676, y = 159208, z = 4819}, +} + +local taxiNpcIds = {} +local taxiVehicleNpcIds = {} +local taxiGarageIds = {} + +AddEvent("OnPackageStart", function() + for k, v in pairs(TAXI_SERVICE_NPC) do + v.npcObject = CreateNPC(v.x, v.y, v.z, v.h) + CreateText3D(_("taxi_job") .. "\n" .. _("press_e"), 18, v.x, v.y, v.z + 120, 0, 0, 0) + SetNPCAnimation(v.npcObject, "CROSSARMS", true) + table.insert(taxiNpcIds, v.npcObject) + end + + if ALLOW_RESPAWN_VEHICLE then + for k, v in pairs(TAXI_GARAGE) do + v.garageObject = CreatePickup(2, v.x, v.y, v.z) + table.insert(taxiGarageIds, v.garageObject) + end + end + + for k, v in pairs(TAXI_VEHICLE_NPC) do + v.npcObject = CreateNPC(v.x, v.y, v.z, v.h) + CreateText3D(_("taxi_garage_menu") .. "\n" .. _("press_e"), 18, v.x, v.y, v.z + 120, 0, 0, 0) + SetNPCAnimation(v.npcObject, "WALLLEAN04", true) + table.insert(taxiVehicleNpcIds, v.npcObject) + end +end) + +AddEvent("OnPlayerJoin", function(player) + CallRemoteEvent(player, "taxi:setup", taxiNpcIds, taxiGarageIds, taxiVehicleNpcIds) +end) + +--------- SERVICE +function TaxiStartStopService(player) + if PlayerData[player].job == "" then + TaxiStartService(player) + elseif PlayerData[player].job == "taxi" then + TaxiEndService(player) + else + CallRemoteEvent(player, "MakeErrorNotification", _("please_leave_previous_job")) + end +end +AddRemoteEvent("taxi:startstopservice", TaxiStartStopService) + +function TaxiStartService(player)-- To start the taxi service + -- #1 Check if the player has a job vehicle spawned then destroy it + if PlayerData[player].job_vehicle ~= nil then + DestroyVehicle(PlayerData[player].job_vehicle) + DestroyVehicleData(PlayerData[player].job_vehicle) + PlayerData[player].job_vehicle = nil + end + + -- #2 Check for the number of taximen in service + local taximens = 0 + for k, v in pairs(PlayerData) do + if v.job == "taxi" then taximens = taximens + 1 end + end + if taximens >= MAX_TAXI then + CallRemoteEvent(player, "MakeErrorNotification", _("job_full")) + return + end + + -- #3 Check for the taxi licence + if PlayerData[player].taxi_license == 0 then + CallRemoteEvent(player, "MakeErrorNotification", _("no_taxi_licence")) + return + end + + -- #3 Set the player job to taxi + PlayerData[player].job = "taxi" + CallRemoteEvent(player, "taxi:client:isonduty", true) + CallRemoteEvent(player, "MakeNotification", _("join_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") + + return true +end + +function TaxiEndService(player)-- To end the taxi service + --Set player job + PlayerData[player].job = "" + CallRemoteEvent(player, "taxi:client:isonduty", false) + CallRemoteEvent(player, "MakeNotification", _("quit_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") + + return true +end + +--------- SERVICE END +--------- TAXI VEHICLE +--[[function CheckCash(player) + -- #1 Check if the player has the taxi job + if PlayerData[player].job ~= "taxi" then + CallRemoteEvent(player, "MakeErrorNotification", _("not_taxi")) + return + end + + -- #2 Check if the player has money for commission + if CAUTION > GetPlayerCash(player) then + CallRemoteEvent(player, "MakeErrorNotification",_("no_money_car")) + else + paiement = "cash" + CallEvent("SpawnTaxiCar", player, paiement) CAUTION FOR TAXI VEHICLE + end +end +AddRemoteEvent("taxi:checkcash", CheckCash) + +function CheckBank(player) + -- #1 Check if the player has the taxi job + if PlayerData[player].job ~= "taxi" then + CallRemoteEvent(player, "MakeErrorNotification", _("not_taxi")) + return + end + + -- #2 Check if the player has money for commission + if CAUTION > PlayerData[player].bank_balance then + CallRemoteEvent(player, "MakeErrorNotification", _("no_money_car")) + else + paiement = "bank" + CallEvent("SpawnTaxiCar", player, paiement) + end +end +AddRemoteEvent("taxi:checkbank", CheckBank)]] + +function SpawnTaxiCar(player) + -- #1 Check if the player has the taxi job + if PlayerData[player].job ~= "taxi" then + CallRemoteEvent(player, "MakeErrorNotification", _("not_taxi")) + return + end + + -- #2 Check if the player has a job vehicle spawned then destroy it + if PlayerData[player].job_vehicle ~= nil and ALLOW_RESPAWN_VEHICLE then + DestroyVehicle(PlayerData[player].job_vehicle) + DestroyVehicleData(PlayerData[player].job_vehicle) + PlayerData[player].job_vehicle = nil + end + + -- #3 Try to spawn the vehicle + if PlayerData[player].job_vehicle == nil then + local spawnPoint = VEHICLE_SPAWN_LOCATION[TaxiGetClosestSpawnPoint(player)] + if spawnPoint == nil then return end + for k, v in pairs(GetStreamedVehiclesForPlayer(player)) do + local x, y, z = GetVehicleLocation(v) + if x == false then break end + local dist2 = GetDistance3D(spawnPoint.x, spawnPoint.y, spawnPoint.z, x, y, z) + if dist2 < 500.0 then + CallRemoteEvent(player, "MakeErrorNotification", _("cannot_spawn_vehicle")) + return + end + end + local vehicle = CreateVehicle(2, spawnPoint.x, spawnPoint.y, spawnPoint.z, spawnPoint.h) + PlayerData[player].job_vehicle = vehicle + CreateVehicleData(player, vehicle, 2) + SetVehicleRespawnParams(vehicle, false) + SetVehiclePropertyValue(vehicle, "locked", true, true) + --[[if paiement == "cash" then + RemovePlayerCash(player, CAUTION) + elseif paiement == "bank" then + PlayerData[player].bank_balance = PlayerData[player].bank_balance - CAUTION + end]] + CallRemoteEvent(player, "MakeNotification", _("spawn_vehicle_success", " taxi car"), "linear-gradient(to right, #00b09b, #96c93d)") + else + CallRemoteEvent(player, "MakeErrorNotification", _("cannot_spawn_vehicle")) + end +end +AddRemoteEvent("taxi:spawnvehicle", SpawnTaxiCar) + +function DespawnTaxiCar(player) + -- Check if the player has a job vehicle spawned then destroy it + if PlayerData[player].job_vehicle ~= nil then + DestroyVehicle(PlayerData[player].job_vehicle) + DestroyVehicleData(PlayerData[player].job_vehicle) + PlayerData[player].job_vehicle = nil + --PlayerData[player].bank_balance = PlayerData[player].bank_balance + CAUTION + CallRemoteEvent(player, "MakeNotification", _("vehicle_stored"), "linear-gradient(to right, #00b09b, #96c93d)") + return + end +end + +AddEvent("OnPlayerPickupHit", function(player, pickup)-- Store the vehicle in garage + if PlayerData[player].job ~= "taxi" then return end + for k, v in pairs(TAXI_GARAGE) do + if v.garageObject == pickup then + local vehicle = GetPlayerVehicle(player) + if vehicle == nil then return end + local seat = GetPlayerVehicleSeat(player) + if vehicle == PlayerData[player].job_vehicle and + VehicleData[vehicle].owner == PlayerData[player].accountid and + seat == 1 + then + DespawnTaxiCar(player) + end + end + end +end) +--------- TAXI VEHICLE END +--------- INTERACTIONS + +function StartCourse(player) + local taxiID = GetPlayerVehicle(player) + if taxiID ~= 0 then -- Check if player in vehicle + local vehID = GetVehicleModel(taxiID) + if vehID == 2 then -- Check if player in taxi + local playerDriver = GetVehicleDriver(taxiID) + if player == playerDriver then -- Check if taximan is driver + local occupants = GetClientInTaxi(player, taxiID) + if occupants ~= nil then -- Check if there is client in taxi + state = true + for k, v in ipairs(occupants) do + CallRemoteEvent(v, "course", state) + end + CallRemoteEvent(player, "course", state) + TaxiState = true + else + CallRemoteEvent(player, "MakeErrorNotification", _("no_player_in_vehicle")) + end + else + CallRemoteEvent(player, "MakeErrorNotification", _("not_driver")) + end + end + else + CallRemoteEvent(player, "MakeErrorNotification", _("not_in_vehicle")) + end +end +AddRemoteEvent("course:start", StartCourse) + +--[[function PauseCourse(player) + local state = 2 + for k, v in ipairs(Occupants) do + if v ~= 0 then + CallRemoteEvent(v, "course", state) + end + end + CallRemoteEvent(player, "course", state) +end +AddRemoteEvent("course:pause_unpause", PauseCourse)]] + +function StopCourse(player) + if TaxiState then + state = false + CallRemoteEvent(player, "course", state) + CallRemoteEvent(player, "MakeNotification", _("process_pay"), "linear-gradient(to right, #00b09b, #96c93d)") + for k, v in ipairs(occupants) do + CallRemoteEvent(v, "course", state) + CallRemoteEvent(v, "MakeNotification", _("process_pay"), "linear-gradient(to right, #00b09b, #96c93d)") + end + else + CallRemoteEvent(player, "MakeErrorNotification", _("no_current_course")) + end +end +AddRemoteEvent("course:stop", StopCourse) + +AddRemoteEvent("notifCash", function(player) + if TaxiState then + TaxiState = false + CallRemoteEvent(player, "MakeNotification", _("cash_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") -- Les joueurs doivent procéder au paiement depuis leur inventaires + CallRemoteEvent(player, "HideTaxiHud") + for k, v in ipairs(occupants) do + CallRemoteEvent(v, "MakeNotification", _("cash_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") + CallRemoteEvent(v, "HideTaxiHud") + end + occupants = nil -- clear table + end +end) + +AddRemoteEvent("bankPay", function(player, CourseTime) + if TaxiState then + TaxiState = false + for k, v in ipairs(occupants) do + PlayerData[v].bank_balance = PlayerData[v].bank_balance - CourseTime -- On débite les clients + PlayerData[player].bank_balance = PlayerData[player].bank_balance + CourseTime -- On alimente le compte du chauffeur + CallRemoteEvent(v, "MakeNotification", _("pay_success"), "linear-gradient(to right, #00b09b, #96c93d)") + end + CallRemoteEvent(player, "MakeNotification", _("pay_success"), "linear-gradient(to right, #00b09b, #96c93d)") + occupants = nil -- clear table + end +end) + +--------- INTERACTIONS END +-- Tools +function TaxiGetClosestSpawnPoint(player) + local x, y, z = GetPlayerLocation(player) + local closestSpawnPoint + local dist + for k, v in pairs(VEHICLE_SPAWN_LOCATION) do + local currentDist = GetDistance3D(x, y, z, v.x, v.y, v.z) + if (dist == nil or currentDist < dist) and currentDist <= 2000 then + closestSpawnPoint = k + dist = currentDist + end + end + return closestSpawnPoint +end + +function GetClientInTaxi(player, taxiID) + for i = 2, 4 do + local passenger = GetVehiclePassenger(taxiID, i) + if (passenger ~= 0) then + table.insert( occupants, passenger ) + --occupants [#occupants + 1] = passenger + end + end + if #occupants == 0 then + return nil + else + return occupants + end +end \ No newline at end of file diff --git a/taxi/taxihud.html b/taxi/taxihud.html new file mode 100644 index 00000000..e285e617 --- /dev/null +++ b/taxi/taxihud.html @@ -0,0 +1,89 @@ + + + + + + Taxi + + + + + + + +
+
Prix course :
+
+
+ + + + + + \ No newline at end of file From e60396fa35584ba54ab7e271945a423f5800ab36 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Wed, 26 Feb 2020 02:06:12 +0400 Subject: [PATCH 04/26] Update roleplay.sql --- roleplay.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/roleplay.sql b/roleplay.sql index b89fcd12..17d233ae 100644 --- a/roleplay.sql +++ b/roleplay.sql @@ -21,6 +21,7 @@ CREATE TABLE IF NOT EXISTS `accounts` ( `driver_license` tinyint(1) NOT NULL DEFAULT '0', `gun_license` tinyint(1) NOT NULL DEFAULT '0', `helicopter_license` tinyint(1) NOT NULL DEFAULT '0', + `taxi_license` tinyint(1) NOT NULL DEFAULT '0', `drug_knowledge` text NOT NULL, `job` varchar(20) DEFAULT NULL, `is_cuffed` tinyint(1) NOT NULL DEFAULT '0', From b55a944a14a63ed33d2fc9f73891f999abbd76ee Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Wed, 26 Feb 2020 02:09:06 +0400 Subject: [PATCH 05/26] Update package.json --- package.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index ccfbf296..50baf508 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "admin/s_spectate.lua", "searchobject/server.lua", "callouts/s_callouts.lua", - "onset-characterize/server.lua" + "onset-characterize/server.lua", + "taxi/s_taxi.lua" ], "client_scripts": [ "welcome/client.lua", @@ -93,7 +94,8 @@ "admin/c_spectate.lua", "searchobject/client.lua", "callouts/c_callouts.lua", - "onset-characterize/client.lua" + "onset-characterize/client.lua", + "taxi/c_taxi.lua" ], "files": [ "hud/speaking/speaking.png", @@ -240,6 +242,7 @@ "onset-characterize/ui/jquery.js", "onset-characterize/ui/style.css", "onset-characterize/click.wav", - "admin/broadcastui/broadcastui.html" + "admin/broadcastui/broadcastui.html", + "taxi/taxihud.html" ] } From 61efffd6911b82e035325dd45bd6e77c1bdeccc5 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Wed, 26 Feb 2020 02:10:10 +0400 Subject: [PATCH 06/26] Update s_callouts.lua --- callouts/s_callouts.lua | 409 ++++++++++++++++++++++++++++------------ 1 file changed, 287 insertions(+), 122 deletions(-) diff --git a/callouts/s_callouts.lua b/callouts/s_callouts.lua index a8b3ce82..5646a09e 100644 --- a/callouts/s_callouts.lua +++ b/callouts/s_callouts.lua @@ -1,166 +1,331 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end -local callOuts = {} +local MAX_TAXI = 10 -- Number of taximens at the same time +local ALLOW_RESPAWN_VEHICLE = true -- Allow the respawn of the vehicle by destroying the previously spawned one. (Can break RP if the car is stolen or need repairs or fuel) +local CAUTION = 1500 -- Amount of the commission +local state = false +local TaxiState = false -AddCommand("med", function(player, label) - CreateCallout(player, "medic", tostring(label)) -end) +local occupants = {} -AddCommand("911", function(player, label) - CreateCallout(player, "police", tostring(label)) -end) +local VEHICLE_SPAWN_LOCATION = { + {x = 177218, y = 159869, z = 4817, h = -70}, +} +local TAXI_SERVICE_NPC = { + {x = 176053, y = 158567, z = 4850, h = 0}, +} ---------- CALLOUTS -AddCommand("clearcallouts", function(player) - if PlayerData[player].admin ~= 1 then return end - callOuts = {} - UpdateCalloutsList(player) - print('CALLOUTS → Cleared') -end) +local TAXI_VEHICLE_NPC = { + {x = 176211, y = 159760, z = 4818, h = 10}, +} -function CreateCallout(player, job, label)-- create a new callout - label = string.gsub(label, '"', '') - if callOuts[player] ~= nil and callOuts[player].taken ~= false then return end - local x, y, z = GetPlayerLocation(player) - local caller_job = nil +local TAXI_GARAGE = { + {x = 175676, y = 159208, z = 4819}, +} + +local taxiNpcIds = {} +local taxiVehicleNpcIds = {} +local taxiGarageIds = {} - if PlayerData[player].job == "police" then - caller_job = 'police' - elseif PlayerData[player].job == "medic" then - caller_job = 'medic' +AddEvent("OnPackageStart", function() + for k, v in pairs(TAXI_SERVICE_NPC) do + v.npcObject = CreateNPC(v.x, v.y, v.z, v.h) + CreateText3D(_("taxi_job") .. "\n" .. _("press_e"), 18, v.x, v.y, v.z + 120, 0, 0, 0) + SetNPCAnimation(v.npcObject, "CROSSARMS", true) + table.insert(taxiNpcIds, v.npcObject) + end + + if ALLOW_RESPAWN_VEHICLE then + for k, v in pairs(TAXI_GARAGE) do + v.garageObject = CreatePickup(2, v.x, v.y, v.z) + table.insert(taxiGarageIds, v.garageObject) + end + end + + for k, v in pairs(TAXI_VEHICLE_NPC) do + v.npcObject = CreateNPC(v.x, v.y, v.z, v.h) + CreateText3D(_("taxi_garage_menu") .. "\n" .. _("press_e"), 18, v.x, v.y, v.z + 120, 0, 0, 0) + SetNPCAnimation(v.npcObject, "WALLLEAN04", true) + table.insert(taxiVehicleNpcIds, v.npcObject) end +end) - callOuts[player] = { location = {x = x, y = y, z = z}, taken = false, job = job, label = label, caller_job = caller_job } - CalloutsNotifyPlayers(callOuts[player]) - UpdateCalloutsList(player, job) +AddEvent("OnPlayerJoin", function(player) + CallRemoteEvent(player, "taxi:setup", taxiNpcIds, taxiGarageIds, taxiVehicleNpcIds) +end) - if job == "medic" then - CallRemoteEvent(player, "MakeNotification", _("medic_callout_created"), "linear-gradient(to right, #00b09b, #96c93d)", 10000) - elseif job == "police" then - CallRemoteEvent(player, "MakeNotification", _("police_callout_created"), "linear-gradient(to right, #00b09b, #96c93d)", 10000) +--------- SERVICE +function TaxiStartStopService(player) + if PlayerData[player].job == "" then + TaxiStartService(player) + elseif PlayerData[player].job == "taxi" then + TaxiEndService(player) else - CallRemoteEvent(player, "MakeNotification", _("callout_created"), "linear-gradient(to right, #00b09b, #96c93d)", 10000) + CallRemoteEvent(player, "MakeErrorNotification", _("please_leave_previous_job")) end end -AddRemoteEvent("callouts:create", CreateCallout) - -function CalloutsNotifyPlayers(callout)-- send the new callout to medics and policemens - for k, v in pairs(GetAllPlayers()) do - if PlayerData[v] ~= nil and PlayerData[v].job ~= nil and PlayerData[v].job ~= "" and callout.job == PlayerData[v].job then - if callout.job == "medic" then - CallRemoteEvent(v, "MakeNotification", _("medic_new_callout", callout.label), "linear-gradient(to right, #00b09b, #96c93d)", 10000) - CallRemoteEvent(v, "medic:deathalarm") - elseif callout.job == "police" then - CallRemoteEvent(v, "MakeNotification", _("police_new_callout", callout.label), "linear-gradient(to right, #00b09b, #96c93d)", 10000) - CallRemoteEvent(v, "medic:deathalarm") - else - CallRemoteEvent(v, "MakeNotification", _("new_callout", callout.label), "linear-gradient(to right, #00b09b, #96c93d)", 10000) - end - end +AddRemoteEvent("taxi:startstopservice", TaxiStartStopService) + +function TaxiStartService(player)-- To start the taxi service + -- #1 Check if the player has a job vehicle spawned then destroy it + if PlayerData[player].job_vehicle ~= nil then + DestroyVehicle(PlayerData[player].job_vehicle) + DestroyVehicleData(PlayerData[player].job_vehicle) + PlayerData[player].job_vehicle = nil + end + + -- #2 Check for the number of taximen in service + local taximens = 0 + for k, v in pairs(PlayerData) do + if v.job == "taxi" then taximens = taximens + 1 end + end + if taximens >= MAX_TAXI then + CallRemoteEvent(player, "MakeErrorNotification", _("job_full")) + return end + + -- #3 Check for the taxi licence + if PlayerData[player].taxi_license == 0 then + CallRemoteEvent(player, "MakeErrorNotification", _("no_taxi_licence")) + return + end + + -- #3 Set the player job to taxi + PlayerData[player].job = "taxi" + CallRemoteEvent(player, "taxi:client:isonduty", true) + CallRemoteEvent(player, "MakeNotification", _("join_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") + + return true end -function CalloutTake(player, target)-- allow to take the callout - if PlayerData[player].job ~= "medic" and PlayerData[player].job ~= "police" then return end - if callOuts[tonumber(target)] == nil then return end +function TaxiEndService(player)-- To end the taxi service + --Set player job + PlayerData[player].job = "" + CallRemoteEvent(player, "taxi:client:isonduty", false) + CallRemoteEvent(player, "MakeNotification", _("quit_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") + + return true +end - for k,v in pairs(callOuts) do - if v.taken == player then - CallRemoteEvent(player, "MakeErrorNotification", _("callout_already_have_callout")) +--------- SERVICE END +--------- TAXI VEHICLE +--[[function CheckCash(player) + -- #1 Check if the player has the taxi job + if PlayerData[player].job ~= "taxi" then + CallRemoteEvent(player, "MakeErrorNotification", _("not_taxi")) return end - end - - if callOuts[tonumber(target)].taken ~= false then - CallRemoteEvent(player, "MakeErrorNotification", _("callout_taken_by", PlayerData[callOuts[tonumber(target)].taken].name)) + + -- #2 Check if the player has money for commission + if CAUTION > GetPlayerCash(player) then + CallRemoteEvent(player, "MakeErrorNotification",_("no_money_car")) + else + paiement = "cash" + CallEvent("SpawnTaxiCar", player, paiement) CAUTION FOR TAXI VEHICLE + end +end +AddRemoteEvent("taxi:checkcash", CheckCash) + +function CheckBank(player) + -- #1 Check if the player has the taxi job + if PlayerData[player].job ~= "taxi" then + CallRemoteEvent(player, "MakeErrorNotification", _("not_taxi")) return end + + -- #2 Check if the player has money for commission + if CAUTION > PlayerData[player].bank_balance then + CallRemoteEvent(player, "MakeErrorNotification", _("no_money_car")) + else + paiement = "bank" + CallEvent("SpawnTaxiCar", player, paiement) + end +end +AddRemoteEvent("taxi:checkbank", CheckBank)]] - callOuts[tonumber(target)].taken = player - - local label +function SpawnTaxiCar(player) + -- #1 Check if the player has the taxi job + if PlayerData[player].job ~= "taxi" then + CallRemoteEvent(player, "MakeErrorNotification", _("not_taxi")) + return + end - if PlayerData[player].job == "medic" then - label = _("medic_waypoint_label") - elseif PlayerData[player].job == "police" then - label = _("police_waypoint_label") + -- #2 Check if the player has a job vehicle spawned then destroy it + if PlayerData[player].job_vehicle ~= nil and ALLOW_RESPAWN_VEHICLE then + DestroyVehicle(PlayerData[player].job_vehicle) + DestroyVehicleData(PlayerData[player].job_vehicle) + PlayerData[player].job_vehicle = nil + end + + -- #3 Try to spawn the vehicle + if PlayerData[player].job_vehicle == nil then + local spawnPoint = VEHICLE_SPAWN_LOCATION[TaxiGetClosestSpawnPoint(player)] + if spawnPoint == nil then return end + for k, v in pairs(GetStreamedVehiclesForPlayer(player)) do + local x, y, z = GetVehicleLocation(v) + if x == false then break end + local dist2 = GetDistance3D(spawnPoint.x, spawnPoint.y, spawnPoint.z, x, y, z) + if dist2 < 500.0 then + CallRemoteEvent(player, "MakeErrorNotification", _("cannot_spawn_vehicle")) + return + end + end + local vehicle = CreateVehicle(2, spawnPoint.x, spawnPoint.y, spawnPoint.z, spawnPoint.h) + PlayerData[player].job_vehicle = vehicle + CreateVehicleData(player, vehicle, 2) + SetVehicleRespawnParams(vehicle, false) + SetVehiclePropertyValue(vehicle, "locked", true, true) + --[[if paiement == "cash" then + RemovePlayerCash(player, CAUTION) + elseif paiement == "bank" then + PlayerData[player].bank_balance = PlayerData[player].bank_balance - CAUTION + end]] + CallRemoteEvent(player, "MakeNotification", _("spawn_vehicle_success", " taxi car"), "linear-gradient(to right, #00b09b, #96c93d)") else - label = _("callout_waypoint_label") + CallRemoteEvent(player, "MakeErrorNotification", _("cannot_spawn_vehicle")) end - - UpdateCalloutsList(player) - - CallRemoteEvent(player, "callouts:createwp", tonumber(target), callOuts[tonumber(target)].location.x, callOuts[tonumber(target)].location.y, callOuts[tonumber(target)].location.z, label) - CallRemoteEvent(player, "MakeNotification", _("callouts_you_took_callout"), "linear-gradient(to right, #00b09b, #96c93d)") - CallRemoteEvent(tonumber(target), "MakeNotification", _("callout_has_been_taken"), "linear-gradient(to right, #00b09b, #96c93d)", 10000) end -AddRemoteEvent("callouts:start", CalloutTake) +AddRemoteEvent("taxi:spawnvehicle", SpawnTaxiCar) -function CalloutEnd(player, target)-- allow to end a callout - if PlayerData[player].job ~= "medic" and PlayerData[player].job ~= "police" then return end - if callOuts[tonumber(target)] == nil then return end - if callOuts[tonumber(target)].taken ~= player then return end - - callOuts[tonumber(target)] = nil - UpdateCalloutsList(player) - CallRemoteEvent(player, "callouts:cleanwp", tonumber(target)) - CallRemoteEvent(player, "MakeNotification", _("callouts_ended_callout"), "linear-gradient(to right, #00b09b, #96c93d)") +function DespawnTaxiCar(player) + -- Check if the player has a job vehicle spawned then destroy it + if PlayerData[player].job_vehicle ~= nil then + DestroyVehicle(PlayerData[player].job_vehicle) + DestroyVehicleData(PlayerData[player].job_vehicle) + PlayerData[player].job_vehicle = nil + --PlayerData[player].bank_balance = PlayerData[player].bank_balance + CAUTION + CallRemoteEvent(player, "MakeNotification", _("vehicle_stored"), "linear-gradient(to right, #00b09b, #96c93d)") + return + end end -AddRemoteEvent("callouts:end", CalloutEnd) - -AddRemoteEvent("callouts:getlist", function(player) - local calloutsList = GetCalloutsList(player) - CallRemoteEvent(player, "callouts:displaymenu", calloutsList) +AddEvent("OnPlayerPickupHit", function(player, pickup)-- Store the vehicle in garage + if PlayerData[player].job ~= "taxi" then return end + for k, v in pairs(TAXI_GARAGE) do + if v.garageObject == pickup then + local vehicle = GetPlayerVehicle(player) + if vehicle == nil then return end + local seat = GetPlayerVehicleSeat(player) + if vehicle == PlayerData[player].job_vehicle and + VehicleData[vehicle].owner == PlayerData[player].accountid and + seat == 1 + then + DespawnTaxiCar(player) + end + end + end end) +--------- TAXI VEHICLE END +--------- INTERACTIONS -function UpdateCalloutsList(player, job) - local job = job or PlayerData[player].job - - for k, v in pairs(GetAllPlayers()) do - if PlayerData[v] ~= nil and PlayerData[v].job ~= nil and PlayerData[v].job ~= "" and job == PlayerData[v].job then - local calloutsList = GetCalloutsList(v) - CallRemoteEvent(v, "callouts:updatelist", calloutsList) +function StartCourse(player) + local taxiID = GetPlayerVehicle(player) + if taxiID ~= 0 then -- Check if player in vehicle + local vehID = GetVehicleModel(taxiID) + if vehID == 2 then -- Check if player in taxi + local playerDriver = GetVehicleDriver(taxiID) + if player == playerDriver then -- Check if taximan is driver + local occupants = GetClientInTaxi(player, taxiID) + if occupants ~= nil then -- Check if there is client in taxi + state = true + for k, v in ipairs(occupants) do + CallRemoteEvent(v, "course", state) + end + CallRemoteEvent(player, "course", state) + TaxiState = true + else + CallRemoteEvent(player, "MakeErrorNotification", _("no_player_in_vehicle")) + end + else + CallRemoteEvent(player, "MakeErrorNotification", _("not_driver")) + end end + else + CallRemoteEvent(player, "MakeErrorNotification", _("not_in_vehicle")) end end +AddRemoteEvent("course:start", StartCourse) -function GetCalloutsList(player) - if PlayerData[player].job ~= "medic" and PlayerData[player].job ~= "police" then return { } end - - local x,y,z = GetPlayerLocation(player) - - local calloutsList = {} - - for k,v in pairs(callOuts) do - if v.job == PlayerData[player].job then - if IsValidPlayer(k) then - local dist = math.floor(tonumber(GetDistance2D(x, y, v.location.x, v.location.y)) / 100) +--[[function PauseCourse(player) + local state = 2 + for k, v in ipairs(Occupants) do + if v ~= 0 then + CallRemoteEvent(v, "course", state) + end + end + CallRemoteEvent(player, "course", state) +end +AddRemoteEvent("course:pause_unpause", PauseCourse)]] - local taken = v.taken +function StopCourse(player) + if TaxiState then + state = false + CallRemoteEvent(player, "course", state) + CallRemoteEvent(player, "MakeNotification", _("process_pay"), "linear-gradient(to right, #00b09b, #96c93d)") + for k, v in ipairs(occupants) do + CallRemoteEvent(v, "course", state) + CallRemoteEvent(v, "MakeNotification", _("process_pay"), "linear-gradient(to right, #00b09b, #96c93d)") + end + else + CallRemoteEvent(player, "MakeErrorNotification", _("no_current_course")) + end +end +AddRemoteEvent("course:stop", StopCourse) - if v.taken then - if taken == player then - taken = 'me' - else - taken = PlayerData[taken].name - end - end +AddRemoteEvent("notifCash", function(player) + if TaxiState then + TaxiState = false + CallRemoteEvent(player, "MakeNotification", _("cash_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") -- Les joueurs doivent procéder au paiement depuis leur inventaires + CallRemoteEvent(player, "HideTaxiHud") + for k, v in ipairs(occupants) do + CallRemoteEvent(v, "MakeNotification", _("cash_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") + CallRemoteEvent(v, "HideTaxiHud") + end + occupants = nil -- clear table + end +end) - table.insert(calloutsList, { - id = k, - from = PlayerData[k].name, - job = v.caller_job, - reason = v.label, - distance = dist, - taken = taken - }) - end +AddRemoteEvent("bankPay", function(player, CourseTime) + if TaxiState then + TaxiState = false + for k, v in ipairs(occupants) do + PlayerData[v].bank_balance = PlayerData[v].bank_balance - CourseTime -- On débite les clients + PlayerData[player].bank_balance = PlayerData[player].bank_balance + CourseTime -- On alimente le compte du chauffeur + CallRemoteEvent(v, "MakeNotification", _("pay_success"), "linear-gradient(to right, #00b09b, #96c93d)") end + CallRemoteEvent(player, "MakeNotification", _("pay_success"), "linear-gradient(to right, #00b09b, #96c93d)") + occupants = nil -- clear table end +end) - return calloutsList +--------- INTERACTIONS END +-- Tools +function TaxiGetClosestSpawnPoint(player) + local x, y, z = GetPlayerLocation(player) + local closestSpawnPoint + local dist + for k, v in pairs(VEHICLE_SPAWN_LOCATION) do + local currentDist = GetDistance3D(x, y, z, v.x, v.y, v.z) + if (dist == nil or currentDist < dist) and currentDist <= 2000 then + closestSpawnPoint = k + dist = currentDist + end + end + return closestSpawnPoint end ---------- CALLOUTS END \ No newline at end of file +function GetClientInTaxi(player, taxiID) + for i = 2, 4 do + local passenger = GetVehiclePassenger(taxiID, i) + if (passenger ~= 0) then + table.insert( occupants, passenger ) + --occupants [#occupants + 1] = passenger + end + end + if #occupants == 0 then + return nil + else + return occupants + end +end From 68b7475a6df036ecdff8a0c58a0d3a131c559831 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Wed, 26 Feb 2020 02:10:34 +0400 Subject: [PATCH 07/26] Update s_callouts.lua --- callouts/s_callouts.lua | 456 +++++++++++++++------------------------- 1 file changed, 164 insertions(+), 292 deletions(-) diff --git a/callouts/s_callouts.lua b/callouts/s_callouts.lua index 5646a09e..4d1b6b5c 100644 --- a/callouts/s_callouts.lua +++ b/callouts/s_callouts.lua @@ -1,331 +1,203 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end -local MAX_TAXI = 10 -- Number of taximens at the same time -local ALLOW_RESPAWN_VEHICLE = true -- Allow the respawn of the vehicle by destroying the previously spawned one. (Can break RP if the car is stolen or need repairs or fuel) -local CAUTION = 1500 -- Amount of the commission -local state = false -local TaxiState = false - -local occupants = {} - -local VEHICLE_SPAWN_LOCATION = { - {x = 177218, y = 159869, z = 4817, h = -70}, -} - -local TAXI_SERVICE_NPC = { - {x = 176053, y = 158567, z = 4850, h = 0}, -} - -local TAXI_VEHICLE_NPC = { - {x = 176211, y = 159760, z = 4818, h = 10}, -} - -local TAXI_GARAGE = { - {x = 175676, y = 159208, z = 4819}, -} - -local taxiNpcIds = {} -local taxiVehicleNpcIds = {} -local taxiGarageIds = {} - -AddEvent("OnPackageStart", function() - for k, v in pairs(TAXI_SERVICE_NPC) do - v.npcObject = CreateNPC(v.x, v.y, v.z, v.h) - CreateText3D(_("taxi_job") .. "\n" .. _("press_e"), 18, v.x, v.y, v.z + 120, 0, 0, 0) - SetNPCAnimation(v.npcObject, "CROSSARMS", true) - table.insert(taxiNpcIds, v.npcObject) - end - - if ALLOW_RESPAWN_VEHICLE then - for k, v in pairs(TAXI_GARAGE) do - v.garageObject = CreatePickup(2, v.x, v.y, v.z) - table.insert(taxiGarageIds, v.garageObject) - end - end - - for k, v in pairs(TAXI_VEHICLE_NPC) do - v.npcObject = CreateNPC(v.x, v.y, v.z, v.h) - CreateText3D(_("taxi_garage_menu") .. "\n" .. _("press_e"), 18, v.x, v.y, v.z + 120, 0, 0, 0) - SetNPCAnimation(v.npcObject, "WALLLEAN04", true) - table.insert(taxiVehicleNpcIds, v.npcObject) - end +local callOuts = {} + +AddCommand("med", function(player, label) + CreateCallout(player, "medic", tostring(label)) +end) + +AddCommand("911", function(player, label) + CreateCallout(player, "police", tostring(label)) end) -AddEvent("OnPlayerJoin", function(player) - CallRemoteEvent(player, "taxi:setup", taxiNpcIds, taxiGarageIds, taxiVehicleNpcIds) +AddCommand("taxi", function(player, label) + CreateCallout(player, "taxi", tostring(label)) end) ---------- SERVICE -function TaxiStartStopService(player) - if PlayerData[player].job == "" then - TaxiStartService(player) +--------- CALLOUTS +AddCommand("clearcallouts", function(player) + if PlayerData[player].admin ~= 1 then return end + callOuts = {} + UpdateCalloutsList(player) + print('CALLOUTS → Cleared') +end) + +function CreateCallout(player, job, label)-- create a new callout + label = string.gsub(label, '"', '') + if callOuts[player] ~= nil and callOuts[player].taken ~= false then return end + local x, y, z = GetPlayerLocation(player) + local caller_job = nil + + if PlayerData[player].job == "police" then + caller_job = 'police' + elseif PlayerData[player].job == "medic" then + caller_job = 'medic' elseif PlayerData[player].job == "taxi" then - TaxiEndService(player) + caller_job = 'taxi' + end + + callOuts[player] = { location = {x = x, y = y, z = z}, taken = false, job = job, label = label, caller_job = caller_job } + CalloutsNotifyPlayers(callOuts[player]) + UpdateCalloutsList(player, job) + + if job == "medic" then + CallRemoteEvent(player, "MakeNotification", _("medic_callout_created"), "linear-gradient(to right, #00b09b, #96c93d)", 10000) + elseif job == "police" then + CallRemoteEvent(player, "MakeNotification", _("police_callout_created"), "linear-gradient(to right, #00b09b, #96c93d)", 10000) + elseif job == "taxi" then + CallRemoteEvent(player, "MakeNotification", _("taxi_callout_created"), "linear-gradient(to right, #00b09b, #96c93d)", 10000) + SendGPStoTaxi(player, callOuts[player]) else - CallRemoteEvent(player, "MakeErrorNotification", _("please_leave_previous_job")) + CallRemoteEvent(player, "MakeNotification", _("callout_created"), "linear-gradient(to right, #00b09b, #96c93d)", 10000) end end -AddRemoteEvent("taxi:startstopservice", TaxiStartStopService) - -function TaxiStartService(player)-- To start the taxi service - -- #1 Check if the player has a job vehicle spawned then destroy it - if PlayerData[player].job_vehicle ~= nil then - DestroyVehicle(PlayerData[player].job_vehicle) - DestroyVehicleData(PlayerData[player].job_vehicle) - PlayerData[player].job_vehicle = nil - end - - -- #2 Check for the number of taximen in service - local taximens = 0 - for k, v in pairs(PlayerData) do - if v.job == "taxi" then taximens = taximens + 1 end - end - if taximens >= MAX_TAXI then - CallRemoteEvent(player, "MakeErrorNotification", _("job_full")) - return - end - - -- #3 Check for the taxi licence - if PlayerData[player].taxi_license == 0 then - CallRemoteEvent(player, "MakeErrorNotification", _("no_taxi_licence")) - return +AddRemoteEvent("callouts:create", CreateCallout) + +function CalloutsNotifyPlayers(callout)-- send the new callout to medics and policemens + for k, v in pairs(GetAllPlayers()) do + if PlayerData[v] ~= nil and PlayerData[v].job ~= nil and PlayerData[v].job ~= "" and callout.job == PlayerData[v].job then + if callout.job == "medic" then + CallRemoteEvent(v, "MakeNotification", _("medic_new_callout", callout.label), "linear-gradient(to right, #00b09b, #96c93d)", 10000) + CallRemoteEvent(v, "medic:deathalarm") + elseif callout.job == "police" then + CallRemoteEvent(v, "MakeNotification", _("police_new_callout", callout.label), "linear-gradient(to right, #00b09b, #96c93d)", 10000) + CallRemoteEvent(v, "medic:deathalarm") + else + CallRemoteEvent(v, "MakeNotification", _("new_callout", callout.label), "linear-gradient(to right, #00b09b, #96c93d)", 10000) + end + end end - - -- #3 Set the player job to taxi - PlayerData[player].job = "taxi" - CallRemoteEvent(player, "taxi:client:isonduty", true) - CallRemoteEvent(player, "MakeNotification", _("join_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") - - return true end -function TaxiEndService(player)-- To end the taxi service - --Set player job - PlayerData[player].job = "" - CallRemoteEvent(player, "taxi:client:isonduty", false) - CallRemoteEvent(player, "MakeNotification", _("quit_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") - - return true -end - ---------- SERVICE END ---------- TAXI VEHICLE ---[[function CheckCash(player) - -- #1 Check if the player has the taxi job - if PlayerData[player].job ~= "taxi" then - CallRemoteEvent(player, "MakeErrorNotification", _("not_taxi")) - return - end - - -- #2 Check if the player has money for commission - if CAUTION > GetPlayerCash(player) then - CallRemoteEvent(player, "MakeErrorNotification",_("no_money_car")) - else - paiement = "cash" - CallEvent("SpawnTaxiCar", player, paiement) CAUTION FOR TAXI VEHICLE +function SendGPStoTaxi(player, callout) + local target = player + label = _("taxi_waypoint_label") + SetPlayerPropertyValue(player, "Caller", true, true) + for k, v in pairs(GetAllPlayers()) do + if PlayerData[v] ~= nil and PlayerData[v].job ~= nil and PlayerData[v].job ~= "" and callout.job == PlayerData[v].job then + if callout.job == "taxi" then + CallRemoteEvent(v, "medic:deathalarm") + CallRemoteEvent(v, "callouts:createwp", tonumber(target), callOuts[tonumber(target)].location.x, callOuts[tonumber(target)].location.y, callOuts[tonumber(target)].location.z, label) + + Delay(360000, function() + callOuts[tonumber(target)] = nil + UpdateCalloutsList(player) + CallRemoteEvent(v, "callouts:cleanwp", tonumber(target)) + end) + end end -end -AddRemoteEvent("taxi:checkcash", CheckCash) - -function CheckBank(player) - -- #1 Check if the player has the taxi job - if PlayerData[player].job ~= "taxi" then - CallRemoteEvent(player, "MakeErrorNotification", _("not_taxi")) - return end - - -- #2 Check if the player has money for commission - if CAUTION > PlayerData[player].bank_balance then - CallRemoteEvent(player, "MakeErrorNotification", _("no_money_car")) - else - paiement = "bank" - CallEvent("SpawnTaxiCar", player, paiement) - end end -AddRemoteEvent("taxi:checkbank", CheckBank)]] -function SpawnTaxiCar(player) - -- #1 Check if the player has the taxi job - if PlayerData[player].job ~= "taxi" then - CallRemoteEvent(player, "MakeErrorNotification", _("not_taxi")) +function CalloutTake(player, target)-- allow to take the callout + if PlayerData[player].job ~= "medic" and PlayerData[player].job ~= "police" then return end + if callOuts[tonumber(target)] == nil then return end + + for k,v in pairs(callOuts) do + if v.taken == player then + CallRemoteEvent(player, "MakeErrorNotification", _("callout_already_have_callout")) return end + end - -- #2 Check if the player has a job vehicle spawned then destroy it - if PlayerData[player].job_vehicle ~= nil and ALLOW_RESPAWN_VEHICLE then - DestroyVehicle(PlayerData[player].job_vehicle) - DestroyVehicleData(PlayerData[player].job_vehicle) - PlayerData[player].job_vehicle = nil + if callOuts[tonumber(target)].taken ~= false then + CallRemoteEvent(player, "MakeErrorNotification", _("callout_taken_by", PlayerData[callOuts[tonumber(target)].taken].name)) + return end - - -- #3 Try to spawn the vehicle - if PlayerData[player].job_vehicle == nil then - local spawnPoint = VEHICLE_SPAWN_LOCATION[TaxiGetClosestSpawnPoint(player)] - if spawnPoint == nil then return end - for k, v in pairs(GetStreamedVehiclesForPlayer(player)) do - local x, y, z = GetVehicleLocation(v) - if x == false then break end - local dist2 = GetDistance3D(spawnPoint.x, spawnPoint.y, spawnPoint.z, x, y, z) - if dist2 < 500.0 then - CallRemoteEvent(player, "MakeErrorNotification", _("cannot_spawn_vehicle")) - return - end - end - local vehicle = CreateVehicle(2, spawnPoint.x, spawnPoint.y, spawnPoint.z, spawnPoint.h) - PlayerData[player].job_vehicle = vehicle - CreateVehicleData(player, vehicle, 2) - SetVehicleRespawnParams(vehicle, false) - SetVehiclePropertyValue(vehicle, "locked", true, true) - --[[if paiement == "cash" then - RemovePlayerCash(player, CAUTION) - elseif paiement == "bank" then - PlayerData[player].bank_balance = PlayerData[player].bank_balance - CAUTION - end]] - CallRemoteEvent(player, "MakeNotification", _("spawn_vehicle_success", " taxi car"), "linear-gradient(to right, #00b09b, #96c93d)") + + callOuts[tonumber(target)].taken = player + + local label + + if PlayerData[player].job == "medic" then + label = _("medic_waypoint_label") + elseif PlayerData[player].job == "police" then + label = _("police_waypoint_label") else - CallRemoteEvent(player, "MakeErrorNotification", _("cannot_spawn_vehicle")) + label = _("callout_waypoint_label") end + + UpdateCalloutsList(player) + + CallRemoteEvent(player, "callouts:createwp", tonumber(target), callOuts[tonumber(target)].location.x, callOuts[tonumber(target)].location.y, callOuts[tonumber(target)].location.z, label) + CallRemoteEvent(player, "MakeNotification", _("callouts_you_took_callout"), "linear-gradient(to right, #00b09b, #96c93d)") + CallRemoteEvent(tonumber(target), "MakeNotification", _("callout_has_been_taken"), "linear-gradient(to right, #00b09b, #96c93d)", 10000) end -AddRemoteEvent("taxi:spawnvehicle", SpawnTaxiCar) - -function DespawnTaxiCar(player) - -- Check if the player has a job vehicle spawned then destroy it - if PlayerData[player].job_vehicle ~= nil then - DestroyVehicle(PlayerData[player].job_vehicle) - DestroyVehicleData(PlayerData[player].job_vehicle) - PlayerData[player].job_vehicle = nil - --PlayerData[player].bank_balance = PlayerData[player].bank_balance + CAUTION - CallRemoteEvent(player, "MakeNotification", _("vehicle_stored"), "linear-gradient(to right, #00b09b, #96c93d)") - return - end +AddRemoteEvent("callouts:start", CalloutTake) + +function CalloutEnd(player, target)-- allow to end a callout + if PlayerData[player].job ~= "medic" and PlayerData[player].job ~= "police" then return end + if callOuts[tonumber(target)] == nil then return end + if callOuts[tonumber(target)].taken ~= player then return end + + callOuts[tonumber(target)] = nil + UpdateCalloutsList(player) + CallRemoteEvent(player, "callouts:cleanwp", tonumber(target)) + CallRemoteEvent(player, "MakeNotification", _("callouts_ended_callout"), "linear-gradient(to right, #00b09b, #96c93d)") end +AddRemoteEvent("callouts:end", CalloutEnd) -AddEvent("OnPlayerPickupHit", function(player, pickup)-- Store the vehicle in garage - if PlayerData[player].job ~= "taxi" then return end - for k, v in pairs(TAXI_GARAGE) do - if v.garageObject == pickup then - local vehicle = GetPlayerVehicle(player) - if vehicle == nil then return end - local seat = GetPlayerVehicleSeat(player) - if vehicle == PlayerData[player].job_vehicle and - VehicleData[vehicle].owner == PlayerData[player].accountid and - seat == 1 - then - DespawnTaxiCar(player) - end +AddRemoteEvent("callouts:getlist", function(player) + local calloutsList = GetCalloutsList(player) + + CallRemoteEvent(player, "callouts:displaymenu", calloutsList) +end) + +function UpdateCalloutsList(player, job) + local job = job or PlayerData[player].job + + for k, v in pairs(GetAllPlayers()) do + if PlayerData[v] ~= nil and PlayerData[v].job ~= nil and PlayerData[v].job ~= "" and job == PlayerData[v].job then + local calloutsList = GetCalloutsList(v) + CallRemoteEvent(v, "callouts:updatelist", calloutsList) end end -end) ---------- TAXI VEHICLE END ---------- INTERACTIONS - -function StartCourse(player) - local taxiID = GetPlayerVehicle(player) - if taxiID ~= 0 then -- Check if player in vehicle - local vehID = GetVehicleModel(taxiID) - if vehID == 2 then -- Check if player in taxi - local playerDriver = GetVehicleDriver(taxiID) - if player == playerDriver then -- Check if taximan is driver - local occupants = GetClientInTaxi(player, taxiID) - if occupants ~= nil then -- Check if there is client in taxi - state = true - for k, v in ipairs(occupants) do - CallRemoteEvent(v, "course", state) +end + +function GetCalloutsList(player) + if PlayerData[player].job ~= "medic" and PlayerData[player].job ~= "police" and PlayerData[player].job ~= "taxi" then return { } end + + local x,y,z = GetPlayerLocation(player) + + local calloutsList = {} + + for k,v in pairs(callOuts) do + if v.job == PlayerData[player].job then + if IsValidPlayer(k) then + local dist = math.floor(tonumber(GetDistance2D(x, y, v.location.x, v.location.y)) / 100) + + local taken = v.taken + + if v.taken then + if taken == player then + taken = 'me' + else + taken = PlayerData[taken].name end - CallRemoteEvent(player, "course", state) - TaxiState = true - else - CallRemoteEvent(player, "MakeErrorNotification", _("no_player_in_vehicle")) end - else - CallRemoteEvent(player, "MakeErrorNotification", _("not_driver")) + + table.insert(calloutsList, { + id = k, + from = PlayerData[k].name, + job = v.caller_job, + reason = v.label, + distance = dist, + taken = taken + }) end end - else - CallRemoteEvent(player, "MakeErrorNotification", _("not_in_vehicle")) end -end -AddRemoteEvent("course:start", StartCourse) ---[[function PauseCourse(player) - local state = 2 - for k, v in ipairs(Occupants) do - if v ~= 0 then - CallRemoteEvent(v, "course", state) - end - end - CallRemoteEvent(player, "course", state) + return calloutsList end -AddRemoteEvent("course:pause_unpause", PauseCourse)]] - -function StopCourse(player) - if TaxiState then - state = false - CallRemoteEvent(player, "course", state) - CallRemoteEvent(player, "MakeNotification", _("process_pay"), "linear-gradient(to right, #00b09b, #96c93d)") - for k, v in ipairs(occupants) do - CallRemoteEvent(v, "course", state) - CallRemoteEvent(v, "MakeNotification", _("process_pay"), "linear-gradient(to right, #00b09b, #96c93d)") - end - else - CallRemoteEvent(player, "MakeErrorNotification", _("no_current_course")) - end -end -AddRemoteEvent("course:stop", StopCourse) - -AddRemoteEvent("notifCash", function(player) - if TaxiState then - TaxiState = false - CallRemoteEvent(player, "MakeNotification", _("cash_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") -- Les joueurs doivent procéder au paiement depuis leur inventaires - CallRemoteEvent(player, "HideTaxiHud") - for k, v in ipairs(occupants) do - CallRemoteEvent(v, "MakeNotification", _("cash_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") - CallRemoteEvent(v, "HideTaxiHud") - end - occupants = nil -- clear table - end -end) -AddRemoteEvent("bankPay", function(player, CourseTime) - if TaxiState then - TaxiState = false - for k, v in ipairs(occupants) do - PlayerData[v].bank_balance = PlayerData[v].bank_balance - CourseTime -- On débite les clients - PlayerData[player].bank_balance = PlayerData[player].bank_balance + CourseTime -- On alimente le compte du chauffeur - CallRemoteEvent(v, "MakeNotification", _("pay_success"), "linear-gradient(to right, #00b09b, #96c93d)") - end - CallRemoteEvent(player, "MakeNotification", _("pay_success"), "linear-gradient(to right, #00b09b, #96c93d)") - occupants = nil -- clear table - end -end) +--------- CALLOUTS END ---------- INTERACTIONS END --- Tools -function TaxiGetClosestSpawnPoint(player) - local x, y, z = GetPlayerLocation(player) - local closestSpawnPoint - local dist - for k, v in pairs(VEHICLE_SPAWN_LOCATION) do - local currentDist = GetDistance3D(x, y, z, v.x, v.y, v.z) - if (dist == nil or currentDist < dist) and currentDist <= 2000 then - closestSpawnPoint = k - dist = currentDist +--[[AddRemoteEvent("DestroyWp", function (waypt, caller) + for k, v in pairs(GetAllPlayers()) do + if PlayerData[v] ~= nil and PlayerData[v].job == "taxi" then + CallRemoteEvent(v, "callouts:destroywptaxi", waypt) end end - return closestSpawnPoint -end - -function GetClientInTaxi(player, taxiID) - for i = 2, 4 do - local passenger = GetVehiclePassenger(taxiID, i) - if (passenger ~= 0) then - table.insert( occupants, passenger ) - --occupants [#occupants + 1] = passenger - end - end - if #occupants == 0 then - return nil - else - return occupants - end -end + SetPlayerPropertyValue(caller, "Caller", false, true) +end)]] From 28d56ae81b76d57993590a0c93892cdbe076bb1f Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Wed, 26 Feb 2020 02:11:14 +0400 Subject: [PATCH 08/26] Update c_callouts.lua --- callouts/c_callouts.lua | 45 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/callouts/c_callouts.lua b/callouts/c_callouts.lua index 48bfb859..414fc3fa 100644 --- a/callouts/c_callouts.lua +++ b/callouts/c_callouts.lua @@ -2,6 +2,7 @@ local Dialog = ImportPackage("dialogui") local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end local wpObject +local wptaxi local currentCallout local calloutsUI = nil @@ -83,7 +84,8 @@ AddRemoteEvent("callouts:createwp", function(target, x, y, z, label) currentCallout = target wpObject = CreateWaypoint(x, y, z, tostring(label)) - CallEvent("UpdateCalloutDestination", x, y) + CallEvent("UpdateCalloutDestination", x, y) + end) AddRemoteEvent("callouts:cleanwp", function() @@ -92,4 +94,43 @@ AddRemoteEvent("callouts:cleanwp", function() wpObject = nil CallEvent("ClearCalloutDestination") -end) \ No newline at end of file +end) + + +-- TAXI WAYPOINT + +--[[AddRemoteEvent("callouts:createwptaxi", function(target, x, y, z, label) + if wptaxi ~= nil then DestroyWaypoint(wptaxi) end + currentCallout = target + wptaxi = CreateWaypoint(x, y, z, tostring(label)) + StockWayptnID(target, wptaxi) + CallEvent("UpdateCalloutDestination", x, y) + +end) + +AddRemoteEvent("callouts:destroywptaxi", function(waypt) + currentCallout = nil + if waypt ~= nil then DestroyWaypoint(waypt) end + waypt = nil + end +end) + +function StockWayptnID(target, wptaxi) + if wpObject ~= nil then + waypt = wptaxi + caller = target + else + CallRemoteEvent("DestroyWp", waypt, caller) + end +end + +AddEvent("OnPlayerStartEnterVehicle", function(vehicle, seat) + if GetPlayerPropertyValue("Caller") then + local vehicleID = GetVehicleModel(vehicle) + if vehicleID == 2 then + if seatId ~= 0 then + StockWayptnID() + end + end + end +end)]] From ae533da66f3fbd3bf6716350ab5d0d3bb4e5af6a Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Wed, 26 Feb 2020 02:12:27 +0400 Subject: [PATCH 09/26] Update fr.json --- i18n/fr.json | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/i18n/fr.json b/i18n/fr.json index 56a693ee..d6f74932 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -628,5 +628,33 @@ "delivery_vehicle_too_far_away": "Votre véhicule de prêt est trop loin. Vous ne serez pas remboursé.", "delivery_desc": "Ce service nécessite le dépot de {1} $ de location pour le véhicule de fonction. Si vous le rendez en état vous serez remboursé en quasi-totalité.", "delivery_start_success": "Le montant de la location a bien été prélevé, votre véhicule vous attend.", - "delivery_need_delivery_truck": "Vous avez besoin de votre camion de livraison pour faire ça" -} \ No newline at end of file + "delivery_need_delivery_truck": "Vous avez besoin de votre camion de livraison pour faire ça", + "taxi_job": "Chauffeur de taxi", + "taxi_menu": "Menu Taxi", + "taxi_garage_menu": "Garage taxi", + "spawn_taxi_car": "Sortir un taxi", + "quit_taxi": "Vous n'êtes plus chauffeur de taxi", + "taxi_npc_message_stop": "Quoi ?! Tu veux déjà nous quitter ?", + "taxi_npc_message_start": "Bonjour, tu souhaites devenir chauffeur de taxi ?", + "taxi_npc_name": "Mr. White, Employeur", + "taxi_service_npc_starting": "C'est d'accord, bienvenue dans l'équipe", + "taxi_service_npc_end": "Compris, reviens quand tu veux", + "join_taxi": "Vous êtes devenus chauffeur de taxi", + "not_taxi": "Vous n'êtes pas chauffeur de taxi", + "taxi_license": "License de taxi", + "start_course": "Commencer une course", + "end_course": "Terminer une course", + "payement": "Paiement", + "payement menu": "Menu Paiement", + "payin_cash": "Paiement en liquide", + "payin_bank": "Paiment avec la banque", + "cash_taxi": "Paiement en liquide : La transaction doit être réalisée depuis vos inventaires", + "process_pay": "La course est terminée. Veuillez procéder au paiement", + "no_player_in_vehicle": "Il n'y a personne dans votre vehicule !", + "not_in_vehicle": "Vous devez être dans votre vehicule !", + "not_driver": "Vous devez être au volant du vehicule !", + "pay_success": "La transaction a été effectué avec succes", + "no_current_course": "Il n'y a pas de course en cours !", + "taxi_callout_created": "Les taxis ont reçu votre appels", + "taxi_waypoint_label": "Taxi" +} From 52f46da2a08e6f695c4ff2e5760aca410b610e26 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Wed, 26 Feb 2020 02:12:52 +0400 Subject: [PATCH 10/26] Update fr.json --- i18n/fr.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/fr.json b/i18n/fr.json index d6f74932..c1e4dbdd 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -629,7 +629,7 @@ "delivery_desc": "Ce service nécessite le dépot de {1} $ de location pour le véhicule de fonction. Si vous le rendez en état vous serez remboursé en quasi-totalité.", "delivery_start_success": "Le montant de la location a bien été prélevé, votre véhicule vous attend.", "delivery_need_delivery_truck": "Vous avez besoin de votre camion de livraison pour faire ça", - "taxi_job": "Chauffeur de taxi", + "taxi_job": "Chauffeur de taxi", "taxi_menu": "Menu Taxi", "taxi_garage_menu": "Garage taxi", "spawn_taxi_car": "Sortir un taxi", From 6a9fe3f40a420d88f82c3b6a8f5d7b642cfa7d00 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Wed, 26 Feb 2020 02:13:32 +0400 Subject: [PATCH 11/26] Update en.json --- i18n/en.json | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/i18n/en.json b/i18n/en.json index cd859203..f39e255d 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -595,5 +595,33 @@ "item_menu": "Objects menu", "admin_give_item_success": "Objects given with succes", "admin_give_item_fail": "Can't give this objects", - "orange": "orange" + "orange": "orange", + "taxi_job": "Chauffeur de taxi", + "taxi_menu": "Menu Taxi", + "taxi_garage_menu": "Garage taxi", + "spawn_taxi_car": "Sortir un taxi", + "quit_taxi": "Vous n'êtes plus chauffeur de taxi", + "taxi_npc_message_stop": "Quoi ?! Tu veux déjà nous quitter ?", + "taxi_npc_message_start": "Bonjour, tu souhaites devenir chauffeur de taxi ?", + "taxi_npc_name": "Mr. White, Employeur", + "taxi_service_npc_starting": "C'est d'accord, bienvenue dans l'équipe", + "taxi_service_npc_end": "Compris, reviens quand tu veux", + "join_taxi": "Vous êtes devenus chauffeur de taxi", + "not_taxi": "Vous n'êtes pas chauffeur de taxi", + "taxi_license": "License de taxi", + "start_course": "Commencer une course", + "end_course": "Terminer une course", + "payement": "Payement", + "payement menu": "Payement Menu", + "payin_cash": "Player pay in cash", + "payin_bank": "Player pay with bank", + "cash_taxi": "Payment in cash : Payment need to be made from your inventory", + "process_pay": "La course est terminée. Veuillez procéder au paiement", + "no_player_in_vehicle": "Il n'y a personne dans votre vehicule !", + "not_in_vehicle": "Vous devez être dans votre vehicule !", + "not_driver": "Vous devez être au volant du vehicule !", + "pay_success": "La transaction a été effectué avec succes", + "no_current_course": "Il n'y a pas de course en cours !", + "taxi_callout_created": "Taxis receive your call", + "taxi_waypoint_label": "Taxi" } From f3155a8c9157e7969a5cc970733dbee57ac09f7c Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Sat, 29 Feb 2020 23:10:02 +0400 Subject: [PATCH 12/26] Update c_callouts.lua --- callouts/c_callouts.lua | 64 +++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 37 deletions(-) diff --git a/callouts/c_callouts.lua b/callouts/c_callouts.lua index 414fc3fa..4d2595ed 100644 --- a/callouts/c_callouts.lua +++ b/callouts/c_callouts.lua @@ -2,8 +2,8 @@ local Dialog = ImportPackage("dialogui") local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end local wpObject -local wptaxi local currentCallout +local wplocation = {} local calloutsUI = nil @@ -79,58 +79,48 @@ function CloseCallout(player) end AddEvent("callouts:ui:close", CloseCallout) -AddRemoteEvent("callouts:createwp", function(target, x, y, z, label) +AddRemoteEvent("callouts:createtaxiwp", function(x, y, z, label) + taxiwp = CreateWaypoint(x, y, z, tostring(label)) + GetPickupStaticMeshComponent(pickup):SetHiddenInGame(true) + Delay(360000, function() + if taxiwp ~= nil then + DestroyWaypoint(taxiwp) + end + end) +end) + +AddRemoteEvent("callouts:createwp", function(x, y, z, label) if wpObject ~= nil then DestroyWaypoint(wpObject) end currentCallout = target wpObject = CreateWaypoint(x, y, z, tostring(label)) - CallEvent("UpdateCalloutDestination", x, y) - + CallEvent("UpdateCalloutDestination", x, y) end) AddRemoteEvent("callouts:cleanwp", function() currentCallout = nil if wpObject ~= nil then DestroyWaypoint(wpObject) end wpObject = nil - CallEvent("ClearCalloutDestination") end) - -- TAXI WAYPOINT ---[[AddRemoteEvent("callouts:createwptaxi", function(target, x, y, z, label) - if wptaxi ~= nil then DestroyWaypoint(wptaxi) end - currentCallout = target - wptaxi = CreateWaypoint(x, y, z, tostring(label)) - StockWayptnID(target, wptaxi) - CallEvent("UpdateCalloutDestination", x, y) - -end) - -AddRemoteEvent("callouts:destroywptaxi", function(waypt) - currentCallout = nil - if waypt ~= nil then DestroyWaypoint(waypt) end - waypt = nil +AddRemoteEvent("DestroyTaxiWP", function(pickup) + local px, py, pz = GetPickupLocation(pickup) + for k, v in pairs(GetAllWaypoints()) do + local wx, wy, wz = GetWaypointLocation(v) + local distance = GetDistance3D(px, py, pz, wx, wy, wz) + if distance < 30 then + DestroyWaypoint(v) + CallRemoteEvent("DestroyPickup", pickup) + break + end end end) -function StockWayptnID(target, wptaxi) - if wpObject ~= nil then - waypt = wptaxi - caller = target - else - CallRemoteEvent("DestroyWp", waypt, caller) +AddEvent("OnPickupStreamIn", function(pickup) + if GetPickupPropertyValue(pickup, "TaxiCall") then + GetPickupStaticMeshComponent(pickup):SetHiddenInGame(true) end -end - -AddEvent("OnPlayerStartEnterVehicle", function(vehicle, seat) - if GetPlayerPropertyValue("Caller") then - local vehicleID = GetVehicleModel(vehicle) - if vehicleID == 2 then - if seatId ~= 0 then - StockWayptnID() - end - end - end -end)]] +end) From d29a3cab5e32b780dcd3bb25f275bfd2e571c544 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Sat, 29 Feb 2020 23:10:33 +0400 Subject: [PATCH 13/26] Update s_callouts.lua --- callouts/s_callouts.lua | 59 ++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/callouts/s_callouts.lua b/callouts/s_callouts.lua index 4d1b6b5c..e44fbbfc 100644 --- a/callouts/s_callouts.lua +++ b/callouts/s_callouts.lua @@ -72,21 +72,34 @@ end function SendGPStoTaxi(player, callout) local target = player label = _("taxi_waypoint_label") - SetPlayerPropertyValue(player, "Caller", true, true) + if GetPlayerPropertyValue(target, "Caller") ~= nil then + DPickup = GetPlayerPropertyValue(target, "Caller") + if IsValidPickup(DPickup) then + current_call = true + end + end + local TaxiPickup = CreatePickup(336, callOuts[tonumber(target)].location.x, callOuts[tonumber(target)].location.y, callOuts[tonumber(target)].location.z) + SetPickupScale(TaxiPickup, 40, 40, 4) + SetPickupPropertyValue(TaxiPickup, "TaxiCall", true, true) + SetPlayerPropertyValue(target, "Caller", TaxiPickup, true) for k, v in pairs(GetAllPlayers()) do if PlayerData[v] ~= nil and PlayerData[v].job ~= nil and PlayerData[v].job ~= "" and callout.job == PlayerData[v].job then if callout.job == "taxi" then + if current_call then + CallRemoteEvent(v, "DestroyTaxiWP", DPickup) + end CallRemoteEvent(v, "medic:deathalarm") - CallRemoteEvent(v, "callouts:createwp", tonumber(target), callOuts[tonumber(target)].location.x, callOuts[tonumber(target)].location.y, callOuts[tonumber(target)].location.z, label) - - Delay(360000, function() - callOuts[tonumber(target)] = nil - UpdateCalloutsList(player) - CallRemoteEvent(v, "callouts:cleanwp", tonumber(target)) - end) + CallRemoteEvent(v, "callouts:createtaxiwp", callOuts[tonumber(target)].location.x, callOuts[tonumber(target)].location.y, callOuts[tonumber(target)].location.z, label) end end end + + Delay(360000, function() + if TaxiPickup ~= nil then + DestroyPickup(TaxiPickup) + SetPlayerPropertyValue(target, "Caller", nil, true) + end + end) end function CalloutTake(player, target)-- allow to take the callout @@ -155,7 +168,7 @@ function UpdateCalloutsList(player, job) end function GetCalloutsList(player) - if PlayerData[player].job ~= "medic" and PlayerData[player].job ~= "police" and PlayerData[player].job ~= "taxi" then return { } end + if PlayerData[player].job ~= "medic" and PlayerData[player].job ~= "police" then return { } end local x,y,z = GetPlayerLocation(player) @@ -193,11 +206,27 @@ end --------- CALLOUTS END ---[[AddRemoteEvent("DestroyWp", function (waypt, caller) - for k, v in pairs(GetAllPlayers()) do - if PlayerData[v] ~= nil and PlayerData[v].job == "taxi" then - CallRemoteEvent(v, "callouts:destroywptaxi", waypt) +AddEvent("OnPlayerPickupHit", function(player, pickup) -- Destroy pickup + if GetPickupPropertyValue(pickup, "TaxiCall") then + if PlayerData[player].job ~= "taxi" then return end + local vehicle = GetPlayerVehicle(player) + if vehicle == nil then return end + local seat = GetPlayerVehicleSeat(player) + if vehicle == PlayerData[player].job_vehicle and + VehicleData[vehicle].owner == PlayerData[player].accountid and + seat == 1 + then + for k, v in pairs(GetAllPlayers()) do + if PlayerData[v] ~= nil and PlayerData[v].job == "taxi" then + CallRemoteEvent(v, "DestroyTaxiWP", pickup) + end + end end end - SetPlayerPropertyValue(caller, "Caller", false, true) -end)]] +end) + +AddRemoteEvent("DestroyPickup", function(player, pickup) + if pickup ~= nil and IsValidPickup(pickup) then + DestroyPickup(pickup) + end +end) From 3dd6fcf51d37fb7fb23b904d0c7c9b156837f517 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Sat, 29 Feb 2020 23:11:34 +0400 Subject: [PATCH 14/26] Update c_callouts.lua --- callouts/c_callouts.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/callouts/c_callouts.lua b/callouts/c_callouts.lua index 4d2595ed..1a59bdee 100644 --- a/callouts/c_callouts.lua +++ b/callouts/c_callouts.lua @@ -89,7 +89,7 @@ AddRemoteEvent("callouts:createtaxiwp", function(x, y, z, label) end) end) -AddRemoteEvent("callouts:createwp", function(x, y, z, label) +AddRemoteEvent("callouts:createwp", function(target, x, y, z, label) if wpObject ~= nil then DestroyWaypoint(wpObject) end currentCallout = target wpObject = CreateWaypoint(x, y, z, tostring(label)) From dbfb558677fc066e292e2dede50d42734cc9419b Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Sat, 29 Feb 2020 23:15:08 +0400 Subject: [PATCH 15/26] Update c_taxi.lua --- taxi/c_taxi.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/taxi/c_taxi.lua b/taxi/c_taxi.lua index 30faba4f..057e3e90 100644 --- a/taxi/c_taxi.lua +++ b/taxi/c_taxi.lua @@ -37,7 +37,7 @@ end) AddEvent("OnTranslationReady", function() -- TAXI MENU - taxiMenu = Dialog.create(_("taxi_menu"), nil, _("start_course"), _("end_course"), _("payement"), _("callouts"), _("callouts_menu_end_callout"), _("cancel")) + taxiMenu = Dialog.create(_("taxi_menu"), nil, _("start_course"), _("end_course"), _("payement"), --[[_("callouts"), _("callouts_menu_end_callout"),]] _("cancel")) -- SPAWN VEHICLE MENU taxiNpcGarageMenu = Dialog.create(_("taxi_garage_menu"), nil, _("spawn_taxi_car"), _("cancel")) @@ -104,12 +104,12 @@ AddEvent("OnDialogSubmit", function(dialog, button, ...) if button == 3 then Dialog.show(taxiPayMenu) end - if button == 4 then -- take callout + --[[if button == 4 then -- take callout CallEvent("callouts:openingmenu") end if button == 5 then -- end callout CallEvent("callouts:stoppingcallout") - end + end]] end if dialog == taxiNpcGarageMenu then @@ -159,4 +159,4 @@ end) AddRemoteEvent("HideTaxiHud", function() SetWebVisibility(TaxiHud, WEB_HIDDEN) -end) \ No newline at end of file +end) From 11a3694784105373512b49d01fcd502aad8f9063 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Sat, 29 Feb 2020 23:16:05 +0400 Subject: [PATCH 16/26] Update s_taxi.lua --- taxi/s_taxi.lua | 64 +++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/taxi/s_taxi.lua b/taxi/s_taxi.lua index f4ea5c4a..8eca8ccb 100644 --- a/taxi/s_taxi.lua +++ b/taxi/s_taxi.lua @@ -2,9 +2,7 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, . local MAX_TAXI = 10 -- Number of taximens at the same time local ALLOW_RESPAWN_VEHICLE = true -- Allow the respawn of the vehicle by destroying the previously spawned one. (Can break RP if the car is stolen or need repairs or fuel) -local CAUTION = 1500 -- Amount of the commission -local state = false -local TaxiState = false +local CAUTION = 1500 -- Amount of the caution local occupants = {} @@ -220,29 +218,33 @@ end) --------- INTERACTIONS function StartCourse(player) - local taxiID = GetPlayerVehicle(player) - if taxiID ~= 0 then -- Check if player in vehicle + taximan = player + local taxiID = GetPlayerVehicle(taximan) + if taxiID ~= 0 then -- Check if taximan in vehicle local vehID = GetVehicleModel(taxiID) - if vehID == 2 then -- Check if player in taxi + if vehID == 2 then -- Check if taximan in taxi local playerDriver = GetVehicleDriver(taxiID) - if player == playerDriver then -- Check if taximan is driver - local occupants = GetClientInTaxi(player, taxiID) - if occupants ~= nil then -- Check if there is client in taxi - state = true - for k, v in ipairs(occupants) do - CallRemoteEvent(v, "course", state) + if taximan == playerDriver then -- Check if taximan is driver + if GetPlayerPropertyValue(taximan, "TaxiOcupped") == nil or not GetPlayerPropertyValue(taximan, "TaxiOcupped") then -- Check if course not in progress + local occupants = GetClientInTaxi(taximan, taxiID) + if occupants ~= nil then -- Check if there is client in taxi + SetPlayerPropertyValue(taximan, "TaxiOcupped", true, true) + SetPlayerPropertyValue(taximan, "Occup", occupants, true) + state = true + for k, v in ipairs(occupants) do + CallRemoteEvent(v, "course", state) + end + CallRemoteEvent(taximan, "course", state) + else + CallRemoteEvent(taximan, "MakeErrorNotification", _("no_player_in_vehicle")) end - CallRemoteEvent(player, "course", state) - TaxiState = true - else - CallRemoteEvent(player, "MakeErrorNotification", _("no_player_in_vehicle")) end else - CallRemoteEvent(player, "MakeErrorNotification", _("not_driver")) + CallRemoteEvent(taximan, "MakeErrorNotification", _("not_driver")) end end else - CallRemoteEvent(player, "MakeErrorNotification", _("not_in_vehicle")) + CallRemoteEvent(taximan, "MakeErrorNotification", _("not_in_vehicle")) end end AddRemoteEvent("course:start", StartCourse) @@ -259,11 +261,12 @@ end AddRemoteEvent("course:pause_unpause", PauseCourse)]] function StopCourse(player) - if TaxiState then + if GetPlayerPropertyValue(player, "TaxiOcupped") ~= nil and GetPlayerPropertyValue(player, "TaxiOcupped") then state = false CallRemoteEvent(player, "course", state) CallRemoteEvent(player, "MakeNotification", _("process_pay"), "linear-gradient(to right, #00b09b, #96c93d)") - for k, v in ipairs(occupants) do + occup = GetPlayerPropertyValue(player, "Occup") + for k, v in ipairs(occup) do CallRemoteEvent(v, "course", state) CallRemoteEvent(v, "MakeNotification", _("process_pay"), "linear-gradient(to right, #00b09b, #96c93d)") end @@ -274,28 +277,30 @@ end AddRemoteEvent("course:stop", StopCourse) AddRemoteEvent("notifCash", function(player) - if TaxiState then - TaxiState = false + if GetPlayerPropertyValue(player, "TaxiOcupped") ~= nil and GetPlayerPropertyValue(player, "TaxiOcupped") then + SetPlayerPropertyValue(player, "TaxiOcupped", false, true) CallRemoteEvent(player, "MakeNotification", _("cash_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") -- Les joueurs doivent procéder au paiement depuis leur inventaires CallRemoteEvent(player, "HideTaxiHud") - for k, v in ipairs(occupants) do + occup = GetPlayerPropertyValue(player, "Occup") + SetPlayerPropertyValue(player, "Occup", nil, true) + for k, v in ipairs(occup) do CallRemoteEvent(v, "MakeNotification", _("cash_taxi"), "linear-gradient(to right, #00b09b, #96c93d)") CallRemoteEvent(v, "HideTaxiHud") end - occupants = nil -- clear table end end) AddRemoteEvent("bankPay", function(player, CourseTime) - if TaxiState then - TaxiState = false - for k, v in ipairs(occupants) do + if GetPlayerPropertyValue(player, "TaxiOcupped") ~= nil and GetPlayerPropertyValue(player, "TaxiOcupped") then + SetPlayerPropertyValue(player, "TaxiOcupped", false, true) + occup = GetPlayerPropertyValue(player, "Occup") + SetPlayerPropertyValue(player, "Occup", nil, true) + for k, v in ipairs(occup) do PlayerData[v].bank_balance = PlayerData[v].bank_balance - CourseTime -- On débite les clients PlayerData[player].bank_balance = PlayerData[player].bank_balance + CourseTime -- On alimente le compte du chauffeur CallRemoteEvent(v, "MakeNotification", _("pay_success"), "linear-gradient(to right, #00b09b, #96c93d)") end CallRemoteEvent(player, "MakeNotification", _("pay_success"), "linear-gradient(to right, #00b09b, #96c93d)") - occupants = nil -- clear table end end) @@ -316,6 +321,7 @@ function TaxiGetClosestSpawnPoint(player) end function GetClientInTaxi(player, taxiID) + occupants = {} for i = 2, 4 do local passenger = GetVehiclePassenger(taxiID, i) if (passenger ~= 0) then @@ -328,4 +334,4 @@ function GetClientInTaxi(player, taxiID) else return occupants end -end \ No newline at end of file +end From bf543a9b32cb123c536adcccafe27c0228341a8d Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Sat, 29 Feb 2020 23:25:55 +0400 Subject: [PATCH 17/26] Update server.lua --- accounts/server.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/accounts/server.lua b/accounts/server.lua index cbcb96cd..eb5eadcd 100644 --- a/accounts/server.lua +++ b/accounts/server.lua @@ -110,9 +110,7 @@ function OnAccountCheckIpBan(player) end function CreatePlayerAccount(player) - local query = mariadb_prepare(sql, "INSERT INTO `accounts` (`id`, `steamid`, `name`, `clothing`, `police`, `medic`, `inventory`, `position`, `admin`, `health`, `armor`, `thirst`, `hunger`, `bank_balance`, `created`, `phone_number`, `driver_license`, `gun_license`, `helicopter_license`, `taxi_license`, `drug_knowledge`, `job`, `is_cuffed`, `age`) VALUES (NULL, '?', 'Unregistered', '[]', '0', '0', '[]', '[]', '0', '100', '0', '100', '100', '4900', '0', NULL, '0', '0', '0', '0', '[]', NULL, '0', '0');", - tostring(GetPlayerSteamId(player))) mariadb_query(sql, query, OnAccountCreated, player) From fbfbe847cf0deefe76b14135c1c575f859561a0e Mon Sep 17 00:00:00 2001 From: Soljian / Sheaven Date: Mon, 2 Mar 2020 20:20:03 +0100 Subject: [PATCH 18/26] some fixes, tp admin, pos on map for taxi center --- admin/server.lua | 3 ++- hud/pinmap/config.ini | 9 ++++++++- i18n/fr.json | 4 +++- licenses/server.lua | 3 ++- taxi/c_taxi.lua | 2 +- taxi/s_taxi.lua | 6 ++++-- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/admin/server.lua b/admin/server.lua index a984e529..a5930f63 100644 --- a/admin/server.lua +++ b/admin/server.lua @@ -32,7 +32,8 @@ local teleportPlace = { mining_process_2 = {-191437, -31107, 1148}, mining_supplier = {67862, 184741, 535}, ironsmith = {-189805, -34122, 1148}, - hospital = {213530, 158344, 1416} + hospital = {213530, 158344, 1416}, + taxi_center = {175330,160737,4959} } local weaponList = { diff --git a/hud/pinmap/config.ini b/hud/pinmap/config.ini index 1701e455..99e20798 100644 --- a/hud/pinmap/config.ini +++ b/hud/pinmap/config.ini @@ -2,7 +2,7 @@ #If developerModeEnabled is set to true, it will allow for teleporting when the map is open via right click. developerModeEnabled = false [mapLegend] -keyCount = 21 +keyCount = 22 key1 = market key2 = atm key3 = gunstore @@ -24,6 +24,7 @@ key18 = mining_gather key19 = mining_process_1 key20 = mining_process_2 key21 = mining_supplier +key22 = taxi_center [market] @@ -194,3 +195,9 @@ displayText = lumberjack_supplier blipCount = 1 blip1 = 203566, 171875 +[taxi_center] +iconpath = http://asset/onsetrp/hud/pinmap/client/web/icons/shelby/ico-pos-taxi.png +displayText = taxi_center +blipCount = 1 +blip1 = 176194, 158444 + diff --git a/i18n/fr.json b/i18n/fr.json index adc664c9..11e270f2 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -500,7 +500,7 @@ "policecar_place_player_in_back": "Vous avez mis cette personne dans votre voiture", "policecar_player_remove_from_car": "Vous avez fait sortir les personnes de votre voiture", "police_no_player_in_range": "Il n'y a aucune personne à qui donner cette amende", - "please_leave_previous_job": "Merci de quitter votre précédent travaille", + "please_leave_previous_job": "Merci de quitter votre précédent travail", "police_alert_bank": "CODE 3 : L'alarme de la banque vient d'être déclenchée !", "police_robbery_in_progress": "BRAQUAGE EN COURS", "police_check_my_equipment": "Vérifier mon équipement", @@ -645,6 +645,7 @@ "gris_titanium": "Gris Titanium", "violet_fonce": "Violet foncé", "disable_dev_mode": "Merci de désactiver le DEVMODE dans votre launcher Steam pour jouer sur ce serveur.", + "taxi_center": "Centre des taxis", "taxi_job": "Chauffeur de taxi", "taxi_menu": "Menu Taxi", "taxi_garage_menu": "Garage taxi", @@ -658,6 +659,7 @@ "join_taxi": "Vous êtes devenus chauffeur de taxi", "not_taxi": "Vous n'êtes pas chauffeur de taxi", "taxi_license": "License de taxi", + "no_taxi_licence": "Vous avez besoin d'une license de taxi pour cela", "start_course": "Commencer une course", "end_course": "Terminer une course", "payement": "Paiement", diff --git a/licenses/server.lua b/licenses/server.lua index 87694cba..7eee7d0e 100644 --- a/licenses/server.lua +++ b/licenses/server.lua @@ -2,7 +2,8 @@ local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) Licenses = { driver_license = 1500, - gun_license = 6000 + gun_license = 6000, + taxi_license = 5000 -- helicopter_license = 30000 } LicensesNpcLocation = { x = 169336, y = 193430, z = 1307, h = 180 } diff --git a/taxi/c_taxi.lua b/taxi/c_taxi.lua index 057e3e90..2ee0df3e 100644 --- a/taxi/c_taxi.lua +++ b/taxi/c_taxi.lua @@ -146,7 +146,7 @@ end AddRemoteEvent("course", function(state) if state then SetWebVisibility(TaxiHud, WEB_HITINVISIBLE) - local CourseTime = 0 + CourseTime = 0 ExecuteWebJS(TaxiHud, "StartCourse("..CourseTime..");") taxicourse = CreateTimer(function(player) CourseTime = CourseTime + 1 diff --git a/taxi/s_taxi.lua b/taxi/s_taxi.lua index 8eca8ccb..cabc32e9 100644 --- a/taxi/s_taxi.lua +++ b/taxi/s_taxi.lua @@ -1,7 +1,7 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, ...) end local MAX_TAXI = 10 -- Number of taximens at the same time -local ALLOW_RESPAWN_VEHICLE = true -- Allow the respawn of the vehicle by destroying the previously spawned one. (Can break RP if the car is stolen or need repairs or fuel) +local ALLOW_RESPAWN_VEHICLE = false -- Allow the respawn of the vehicle by destroying the previously spawned one. (Can break RP if the car is stolen or need repairs or fuel) local CAUTION = 1500 -- Amount of the caution local occupants = {} @@ -34,7 +34,7 @@ AddEvent("OnPackageStart", function() table.insert(taxiNpcIds, v.npcObject) end - if ALLOW_RESPAWN_VEHICLE then + if ALLOW_RESPAWN_VEHICLE == false then for k, v in pairs(TAXI_GARAGE) do v.garageObject = CreatePickup(2, v.x, v.y, v.z) table.insert(taxiGarageIds, v.garageObject) @@ -299,7 +299,9 @@ AddRemoteEvent("bankPay", function(player, CourseTime) PlayerData[v].bank_balance = PlayerData[v].bank_balance - CourseTime -- On débite les clients PlayerData[player].bank_balance = PlayerData[player].bank_balance + CourseTime -- On alimente le compte du chauffeur CallRemoteEvent(v, "MakeNotification", _("pay_success"), "linear-gradient(to right, #00b09b, #96c93d)") + CallRemoteEvent(v, "HideTaxiHud") end + CallRemoteEvent(player, "HideTaxiHud") CallRemoteEvent(player, "MakeNotification", _("pay_success"), "linear-gradient(to right, #00b09b, #96c93d)") end end) From 96f340f95437d2b833c00c51c1d287b31c5417de Mon Sep 17 00:00:00 2001 From: Soljian / Sheaven Date: Mon, 2 Mar 2020 20:46:13 +0100 Subject: [PATCH 19/26] get job on spawn --- accounts/server.lua | 3 --- taxi/s_taxi.lua | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/accounts/server.lua b/accounts/server.lua index b6fc4985..65d61f6d 100644 --- a/accounts/server.lua +++ b/accounts/server.lua @@ -44,9 +44,6 @@ AddEvent("OnPlayerSteamAuth", OnPlayerSteamAuth) function OnPlayerQuit(player) PlayerData[player].is_online = 0 - if PlayerData[player].job == "taxi" or PlayerData[player].job == "delivery" then - PlayerData[player].job = "" - end SavePlayerAccount(player) GatheringCleanPlayerActions(player)-- → Gathering DestroyPlayerData(player) diff --git a/taxi/s_taxi.lua b/taxi/s_taxi.lua index cabc32e9..ddd8105f 100644 --- a/taxi/s_taxi.lua +++ b/taxi/s_taxi.lua @@ -53,6 +53,14 @@ AddEvent("OnPlayerJoin", function(player) CallRemoteEvent(player, "taxi:setup", taxiNpcIds, taxiGarageIds, taxiVehicleNpcIds) end) +AddEvent("job:onspawn", function(player) + --PlayerData[player].job_vehicle = trucksOnLocation[PlayerData[player].accountid] -- Pour récupérer la propriété du véhicule de prêt + if PlayerData[player].job == "taxi" then -- Anti glitch + CallRemoteEvent(player, "taxi:client:isonduty", true) + end +end) + + --------- SERVICE function TaxiStartStopService(player) if PlayerData[player].job == "" then From 0a6d645b3612074ff18ecdf26ce00b7df5c8a075 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Tue, 3 Mar 2020 00:43:24 +0400 Subject: [PATCH 20/26] Update c_taxi.lua --- taxi/c_taxi.lua | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/taxi/c_taxi.lua b/taxi/c_taxi.lua index 2ee0df3e..ddfd8850 100644 --- a/taxi/c_taxi.lua +++ b/taxi/c_taxi.lua @@ -37,10 +37,10 @@ end) AddEvent("OnTranslationReady", function() -- TAXI MENU - taxiMenu = Dialog.create(_("taxi_menu"), nil, _("start_course"), _("end_course"), _("payement"), --[[_("callouts"), _("callouts_menu_end_callout"),]] _("cancel")) - + taxiMenu = Dialog.create(_("taxi_menu"), nil, _("start_course"), _("end_course"), _("cancel_course"), _("payement"), _("cancel")) + -- SPAWN VEHICLE MENU - taxiNpcGarageMenu = Dialog.create(_("taxi_garage_menu"), nil, _("spawn_taxi_car"), _("cancel")) + taxiNpcGarageMenu = Dialog.create(_("taxi_garage_menu"), nil, _("spawn_taxi_cash"), _("spawn_taxi_bank"), _("cancel")) -- PAYEMENT MENU taxiPayMenu = Dialog.create(_("payement menu"), nil, _("payin_cash"), _("payin_bank"), _("cancel")) @@ -101,25 +101,22 @@ AddEvent("OnDialogSubmit", function(dialog, button, ...) if button == 2 then -- stop course CallRemoteEvent("course:stop") end - if button == 3 then - Dialog.show(taxiPayMenu) + if button == 3 then -- cancel course + CallRemoteEvent("course:cancel") end - --[[if button == 4 then -- take callout - CallEvent("callouts:openingmenu") + if button == 4 then + Dialog.show(taxiPayMenu) end - if button == 5 then -- end callout - CallEvent("callouts:stoppingcallout") - end]] end if dialog == taxiNpcGarageMenu then if button == 1 then - CallRemoteEvent("taxi:spawnvehicle") + CallRemoteEvent("taxi:checkcash") end - --[[if button == 2 then + if button == 2 then CallRemoteEvent("taxi:checkbank") - end]] - end + end + end if dialog == taxiPayMenu then if button == 1 then @@ -160,3 +157,15 @@ end) AddRemoteEvent("HideTaxiHud", function() SetWebVisibility(TaxiHud, WEB_HIDDEN) end) + +AddRemoteEvent("cancelcourse", function() + if GetWebVisibility(TaxiHud) == 0 then + SetWebVisibility(WEB_HITINVISIBLE) + end + DestroyTimer(taxicourse) + local CourseTime = 0 + ExecuteWebJS(TaxiHud, "StartCourse("..CourseTime..");") + Delay(1000, function() + SetWebVisibility(TaxiHud, WEB_HIDDEN) + end) +end) From c3a87b91283cecba9c1bc6969a904e018e133c94 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Tue, 3 Mar 2020 00:46:04 +0400 Subject: [PATCH 21/26] Update s_taxi.lua --- taxi/s_taxi.lua | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/taxi/s_taxi.lua b/taxi/s_taxi.lua index ddd8105f..f355829f 100644 --- a/taxi/s_taxi.lua +++ b/taxi/s_taxi.lua @@ -116,19 +116,19 @@ end --------- SERVICE END --------- TAXI VEHICLE ---[[function CheckCash(player) +function CheckCash(player) -- #1 Check if the player has the taxi job if PlayerData[player].job ~= "taxi" then CallRemoteEvent(player, "MakeErrorNotification", _("not_taxi")) return end - -- #2 Check if the player has money for commission + -- #2 Check if the player has money for caution if CAUTION > GetPlayerCash(player) then CallRemoteEvent(player, "MakeErrorNotification",_("no_money_car")) else - paiement = "cash" - CallEvent("SpawnTaxiCar", player, paiement) CAUTION FOR TAXI VEHICLE + SetPlayerPropertyValue(player, "caution", "cash", true) + CallEvent("SpawnTaxiCar", player) end end AddRemoteEvent("taxi:checkcash", CheckCash) @@ -144,18 +144,18 @@ function CheckBank(player) if CAUTION > PlayerData[player].bank_balance then CallRemoteEvent(player, "MakeErrorNotification", _("no_money_car")) else - paiement = "bank" - CallEvent("SpawnTaxiCar", player, paiement) + SetPlayerPropertyValue(player, "caution", "bank", true) + CallEvent("SpawnTaxiCar", player) end end -AddRemoteEvent("taxi:checkbank", CheckBank)]] +AddRemoteEvent("taxi:checkbank", CheckBank) function SpawnTaxiCar(player) - -- #1 Check if the player has the taxi job + --[[ #1 Check if the player has the taxi job if PlayerData[player].job ~= "taxi" then - CallRemoteEvent(player, "MakeErrorNotification", _("not_taxi")) + CallRemoteEvent(player, "MakeErrorNotification", _("not_taxi")) -- Already checked before return - end + end]] -- #2 Check if the player has a job vehicle spawned then destroy it if PlayerData[player].job_vehicle ~= nil and ALLOW_RESPAWN_VEHICLE then @@ -182,17 +182,17 @@ function SpawnTaxiCar(player) CreateVehicleData(player, vehicle, 2) SetVehicleRespawnParams(vehicle, false) SetVehiclePropertyValue(vehicle, "locked", true, true) - --[[if paiement == "cash" then + if GetPlayerPropertyValue(player, "caution") == "cash" then RemovePlayerCash(player, CAUTION) - elseif paiement == "bank" then + elseif GetPlayerPropertyValue(player, "caution") == "bank" then PlayerData[player].bank_balance = PlayerData[player].bank_balance - CAUTION - end]] + end CallRemoteEvent(player, "MakeNotification", _("spawn_vehicle_success", " taxi car"), "linear-gradient(to right, #00b09b, #96c93d)") else CallRemoteEvent(player, "MakeErrorNotification", _("cannot_spawn_vehicle")) end end -AddRemoteEvent("taxi:spawnvehicle", SpawnTaxiCar) +AddEvent("taxi:spawnvehicle", SpawnTaxiCar) function DespawnTaxiCar(player) -- Check if the player has a job vehicle spawned then destroy it @@ -200,7 +200,12 @@ function DespawnTaxiCar(player) DestroyVehicle(PlayerData[player].job_vehicle) DestroyVehicleData(PlayerData[player].job_vehicle) PlayerData[player].job_vehicle = nil - --PlayerData[player].bank_balance = PlayerData[player].bank_balance + CAUTION + if GetPlayerPropertyValue(player, "caution") == "cash" then + AddPlayerCash(player, CAUTION) + else + PlayerData[player].bank_balance = PlayerData[player].bank_balance + CAUTION + end + SetPlayerPropertyValue(player, "caution", nil, true) CallRemoteEvent(player, "MakeNotification", _("vehicle_stored"), "linear-gradient(to right, #00b09b, #96c93d)") return end @@ -268,6 +273,17 @@ AddRemoteEvent("course:start", StartCourse) end AddRemoteEvent("course:pause_unpause", PauseCourse)]] +function CancelCourse(player) + if GetPlayerPropertyValue(player, "TaxiOccuped") then + occup = GetPlayerPropertyValue(player, "Occup") + for k, v in pairs(occup) do + CallRemoteEvent(v, "cancelcourse") + end + CallRemoteEvent(v, "cancelcourse") + end +end +AddRemoteEvent("course:cancel", CancelCourse) + function StopCourse(player) if GetPlayerPropertyValue(player, "TaxiOcupped") ~= nil and GetPlayerPropertyValue(player, "TaxiOcupped") then state = false From 61486610fe1973c10dd7a3b796c4f18d99ebe7e0 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Tue, 3 Mar 2020 00:53:16 +0400 Subject: [PATCH 22/26] Update fr.json --- i18n/fr.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/i18n/fr.json b/i18n/fr.json index 11e270f2..1d385adf 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -649,7 +649,8 @@ "taxi_job": "Chauffeur de taxi", "taxi_menu": "Menu Taxi", "taxi_garage_menu": "Garage taxi", - "spawn_taxi_car": "Sortir un taxi", + "spawn_taxi_cash": "Sortir un taxi (Caution [1500€] en liquide)", + "spawn_taxi_bank": "Sortir un taxi (Caution [1500€] depuis le compte bancaire)", "quit_taxi": "Vous n'êtes plus chauffeur de taxi", "taxi_npc_message_stop": "Quoi ?! Tu veux déjà nous quitter ?", "taxi_npc_message_start": "Bonjour, tu souhaites devenir chauffeur de taxi ?", @@ -662,6 +663,7 @@ "no_taxi_licence": "Vous avez besoin d'une license de taxi pour cela", "start_course": "Commencer une course", "end_course": "Terminer une course", + "cancel_course": "Annuler une course", "payement": "Paiement", "payement menu": "Menu Paiement", "payin_cash": "Paiement en liquide", From 2361a43d645affad6d797f0a8489a19f6f1b6500 Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Tue, 3 Mar 2020 00:59:57 +0400 Subject: [PATCH 23/26] Update en.json --- i18n/en.json | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index f39e255d..1ebd1739 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -596,32 +596,34 @@ "admin_give_item_success": "Objects given with succes", "admin_give_item_fail": "Can't give this objects", "orange": "orange", - "taxi_job": "Chauffeur de taxi", - "taxi_menu": "Menu Taxi", + "taxi_job": "Chauffeur de taxi", + "taxi_menu": "Taxi menu", "taxi_garage_menu": "Garage taxi", - "spawn_taxi_car": "Sortir un taxi", - "quit_taxi": "Vous n'êtes plus chauffeur de taxi", - "taxi_npc_message_stop": "Quoi ?! Tu veux déjà nous quitter ?", - "taxi_npc_message_start": "Bonjour, tu souhaites devenir chauffeur de taxi ?", - "taxi_npc_name": "Mr. White, Employeur", - "taxi_service_npc_starting": "C'est d'accord, bienvenue dans l'équipe", - "taxi_service_npc_end": "Compris, reviens quand tu veux", - "join_taxi": "Vous êtes devenus chauffeur de taxi", - "not_taxi": "Vous n'êtes pas chauffeur de taxi", - "taxi_license": "License de taxi", - "start_course": "Commencer une course", - "end_course": "Terminer une course", + "spawn_taxi_cash": "Get taxi car (Caution [1500€] cash)", + "spawn_taxi_bank": "Get taxi car (Caution [1500€] bank account)", + "quit_taxi": "You are no longer taxi driver", + "taxi_npc_message_stop": "What ? You want to let us already ?", + "taxi_npc_message_start": "Hello, Do you want to become taxi driver ?", + "taxi_npc_name": "Mr. White, Employer", + "taxi_service_npc_starting": "It's OK, Welcome in our team !", + "taxi_service_npc_end": "Go it, come back when you want", + "join_taxi": "You become taxi driver", + "not_taxi": "You're not taxi driver", + "taxi_license": "taxi license", + "start_course": "Start course", + "end_course": "End course", + "cancel_course": "Cancel course", "payement": "Payement", "payement menu": "Payement Menu", "payin_cash": "Player pay in cash", "payin_bank": "Player pay with bank", "cash_taxi": "Payment in cash : Payment need to be made from your inventory", - "process_pay": "La course est terminée. Veuillez procéder au paiement", - "no_player_in_vehicle": "Il n'y a personne dans votre vehicule !", - "not_in_vehicle": "Vous devez être dans votre vehicule !", - "not_driver": "Vous devez être au volant du vehicule !", - "pay_success": "La transaction a été effectué avec succes", - "no_current_course": "Il n'y a pas de course en cours !", + "process_pay": "Course is over, please process to payment", + "no_player_in_vehicle": "There is nobody in your car !", + "not_in_vehicle": "You have to be in your car !", + "not_driver": "You have to be the driver !", + "pay_success": "Transaction success", + "no_current_course": "There is no course in progress !", "taxi_callout_created": "Taxis receive your call", "taxi_waypoint_label": "Taxi" } From 4abb983463dd81ffb4bdb5d451143067d695802d Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Tue, 3 Mar 2020 01:01:04 +0400 Subject: [PATCH 24/26] Update server.lua --- accounts/server.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/accounts/server.lua b/accounts/server.lua index 65d61f6d..fdc72360 100644 --- a/accounts/server.lua +++ b/accounts/server.lua @@ -333,11 +333,11 @@ function DestroyPlayerData(player) return end - --if PlayerData[player].job_vehicle ~= nil then - --DestroyVehicle(PlayerData[player].job_vehicle) - --DestroyVehicleData(PlayerData[player].job_vehicle) - --PlayerData[player].job_vehicle = nil - --end + -- if PlayerData[player].job_vehicle ~= nil then + -- DestroyVehicle(PlayerData[player].job_vehicle) + -- DestroyVehicleData(PlayerData[player].job_vehicle) + -- PlayerData[player].job_vehicle = nil + -- end local attachedObjects = { "backpack", "mask_1", "mask_2", "mask_3", "mask_4" } From 34c25c0799d24b4e6e8641ba955304d690842f3a Mon Sep 17 00:00:00 2001 From: GalaxHD551 <59099660+GalaxHD551@users.noreply.github.com> Date: Tue, 3 Mar 2020 01:03:11 +0400 Subject: [PATCH 25/26] Update s_taxi.lua --- taxi/s_taxi.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taxi/s_taxi.lua b/taxi/s_taxi.lua index f355829f..d5e3b07f 100644 --- a/taxi/s_taxi.lua +++ b/taxi/s_taxi.lua @@ -140,7 +140,7 @@ function CheckBank(player) return end - -- #2 Check if the player has money for commission + -- #2 Check if the player has money for caution if CAUTION > PlayerData[player].bank_balance then CallRemoteEvent(player, "MakeErrorNotification", _("no_money_car")) else From 1ba331283302439d27db9a2004cde8909b8be8d6 Mon Sep 17 00:00:00 2001 From: Soljian / Sheaven Date: Tue, 3 Mar 2020 19:13:04 +0100 Subject: [PATCH 26/26] fixes --- i18n/fr.json | 7 ++++--- taxi/c_taxi.lua | 11 +++++++---- taxi/s_taxi.lua | 8 ++++---- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/i18n/fr.json b/i18n/fr.json index 1d385adf..ccaddbec 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -649,8 +649,8 @@ "taxi_job": "Chauffeur de taxi", "taxi_menu": "Menu Taxi", "taxi_garage_menu": "Garage taxi", - "spawn_taxi_cash": "Sortir un taxi (Caution [1500€] en liquide)", - "spawn_taxi_bank": "Sortir un taxi (Caution [1500€] depuis le compte bancaire)", + "spawn_taxi_cash": "Sortir taxi (Caution en cash)", + "spawn_taxi_bank": "Sortir taxi (Caution en banque)", "quit_taxi": "Vous n'êtes plus chauffeur de taxi", "taxi_npc_message_stop": "Quoi ?! Tu veux déjà nous quitter ?", "taxi_npc_message_start": "Bonjour, tu souhaites devenir chauffeur de taxi ?", @@ -676,5 +676,6 @@ "pay_success": "La transaction a été effectué avec succes", "no_current_course": "Il n'y a pas de course en cours !", "taxi_callout_created": "Les taxis ont reçu votre appels", - "taxi_waypoint_label": "Taxi" + "taxi_waypoint_label": "Taxi", + "taxi_disclaimer_caution": "Une caution de {1} $ est nécessaire pour utiliser un taxi. Vous les retrouverez une fois le taxi rendu." } diff --git a/taxi/c_taxi.lua b/taxi/c_taxi.lua index ddfd8850..c9e56f4a 100644 --- a/taxi/c_taxi.lua +++ b/taxi/c_taxi.lua @@ -15,6 +15,8 @@ local taxiGarageIds = {} local TaxiHud +local cautionTaxi = 0 + function OnPackageStart() TaxiHud = CreateWebUI(0, 0, 0, 0, 0, 60) SetWebAlignment(TaxiHud, 1.0, 0.0) @@ -25,10 +27,14 @@ end AddEvent("OnPackageStart", OnPackageStart) -AddRemoteEvent("taxi:setup", function(_taxiNpcIds, _taxiGarageIds, _taxiVehicleNpcIds) +AddRemoteEvent("taxi:setup", function(_taxiNpcIds, _taxiGarageIds, _taxiVehicleNpcIds, _caution) taxiNpcIds = _taxiNpcIds taxiGarageIds = _taxiGarageIds taxiVehicleNpcIds = _taxiVehicleNpcIds + cautionTaxi = _caution + + -- SPAWN VEHICLE MENU + taxiNpcGarageMenu = Dialog.create(_("taxi_garage_menu"), _("taxi_disclaimer_caution", cautionTaxi), _("spawn_taxi_cash"), _("spawn_taxi_bank"), _("cancel")) end) AddRemoteEvent("taxi:client:isonduty", function(isOnDuty) @@ -38,9 +44,6 @@ end) AddEvent("OnTranslationReady", function() -- TAXI MENU taxiMenu = Dialog.create(_("taxi_menu"), nil, _("start_course"), _("end_course"), _("cancel_course"), _("payement"), _("cancel")) - - -- SPAWN VEHICLE MENU - taxiNpcGarageMenu = Dialog.create(_("taxi_garage_menu"), nil, _("spawn_taxi_cash"), _("spawn_taxi_bank"), _("cancel")) -- PAYEMENT MENU taxiPayMenu = Dialog.create(_("payement menu"), nil, _("payin_cash"), _("payin_bank"), _("cancel")) diff --git a/taxi/s_taxi.lua b/taxi/s_taxi.lua index d5e3b07f..e2c6f24e 100644 --- a/taxi/s_taxi.lua +++ b/taxi/s_taxi.lua @@ -50,7 +50,7 @@ AddEvent("OnPackageStart", function() end) AddEvent("OnPlayerJoin", function(player) - CallRemoteEvent(player, "taxi:setup", taxiNpcIds, taxiGarageIds, taxiVehicleNpcIds) + CallRemoteEvent(player, "taxi:setup", taxiNpcIds, taxiGarageIds, taxiVehicleNpcIds, CAUTION) end) AddEvent("job:onspawn", function(player) @@ -128,7 +128,7 @@ function CheckCash(player) CallRemoteEvent(player, "MakeErrorNotification",_("no_money_car")) else SetPlayerPropertyValue(player, "caution", "cash", true) - CallEvent("SpawnTaxiCar", player) + SpawnTaxiCar(player) end end AddRemoteEvent("taxi:checkcash", CheckCash) @@ -145,7 +145,7 @@ function CheckBank(player) CallRemoteEvent(player, "MakeErrorNotification", _("no_money_car")) else SetPlayerPropertyValue(player, "caution", "bank", true) - CallEvent("SpawnTaxiCar", player) + SpawnTaxiCar(player) end end AddRemoteEvent("taxi:checkbank", CheckBank) @@ -279,7 +279,7 @@ function CancelCourse(player) for k, v in pairs(occup) do CallRemoteEvent(v, "cancelcourse") end - CallRemoteEvent(v, "cancelcourse") + CallRemoteEvent(player, "cancelcourse") end end AddRemoteEvent("course:cancel", CancelCourse)