Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Taxi Job #172

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions accounts/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,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`, `drug_knowledge`, `job`, `is_cuffed`, `age`) VALUES (NULL, '?', 'Unregistered', '[]', '0', '0', '[]', '[]', '0', '100', '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`, `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)
Expand Down Expand Up @@ -155,7 +155,8 @@ 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].inventory = json_decode(result['inventory'])
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'])
PlayerData[player].drug_knowledge = json_decode(result['drug_knowledge'])
Expand Down Expand Up @@ -304,6 +305,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
Expand Down Expand Up @@ -346,7 +348,6 @@ function DestroyPlayerData(player)
end
end

print("Player disconnected : " .. PlayerData[player].accountid)
PlayerData[player] = nil
print("Data destroyed for : " .. player)
end
Expand All @@ -366,7 +367,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,
Expand All @@ -381,6 +382,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,
Expand Down
3 changes: 2 additions & 1 deletion admin/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
35 changes: 33 additions & 2 deletions callouts/c_callouts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local _ = function(k, ...) return ImportPackage("i18n").t(GetPackageName(), k, .

local wpObject
local currentCallout
local wplocation = {}

local calloutsUI = nil

Expand Down Expand Up @@ -78,6 +79,16 @@ function CloseCallout(player)
end
AddEvent("callouts:ui:close", CloseCallout)

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(target, x, y, z, label)
if wpObject ~= nil then DestroyWaypoint(wpObject) end
currentCallout = target
Expand All @@ -90,6 +101,26 @@ AddRemoteEvent("callouts:cleanwp", function()
currentCallout = nil
if wpObject ~= nil then DestroyWaypoint(wpObject) end
wpObject = nil

CallEvent("ClearCalloutDestination")
end)
end)

-- TAXI WAYPOINT

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)

AddEvent("OnPickupStreamIn", function(pickup)
if GetPickupPropertyValue(pickup, "TaxiCall") then
GetPickupStaticMeshComponent(pickup):SetHiddenInGame(true)
end
end)
70 changes: 68 additions & 2 deletions callouts/s_callouts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ AddCommand("911", function(player, label)
CreateCallout(player, "police", tostring(label))
end)

AddCommand("taxi", function(player, label)
CreateCallout(player, "taxi", tostring(label))
end)

--------- CALLOUTS
AddCommand("clearcallouts", function(player)
Expand All @@ -29,6 +32,8 @@ function CreateCallout(player, job, label)-- create a new callout
caller_job = 'police'
elseif PlayerData[player].job == "medic" then
caller_job = 'medic'
elseif PlayerData[player].job == "taxi" then
caller_job = 'taxi'
end

callOuts[player] = { location = {x = x, y = y, z = z}, taken = false, job = job, label = label, caller_job = caller_job }
Expand All @@ -39,6 +44,9 @@ function CreateCallout(player, job, label)-- create a new callout
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, "MakeNotification", _("callout_created"), "linear-gradient(to right, #00b09b, #96c93d)", 10000)
end
Expand All @@ -54,13 +62,46 @@ function CalloutsNotifyPlayers(callout)-- send the new callout to medics and pol
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
else
CallRemoteEvent(v, "MakeNotification", _("new_callout", callout.label), "linear-gradient(to right, #00b09b, #96c93d)", 10000)
end
end
end
end

function SendGPStoTaxi(player, callout)
local target = player
label = _("taxi_waypoint_label")
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: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
if PlayerData[player].job ~= "medic" and PlayerData[player].job ~= "police" then return end
if callOuts[tonumber(target)] == nil then return end
Expand Down Expand Up @@ -163,4 +204,29 @@ function GetCalloutsList(player)
return calloutsList
end

--------- CALLOUTS END
--------- CALLOUTS END

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
end)

AddRemoteEvent("DestroyPickup", function(player, pickup)
if pickup ~= nil and IsValidPickup(pickup) then
DestroyPickup(pickup)
end
end)
9 changes: 8 additions & 1 deletion hud/pinmap/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,6 +24,7 @@ key18 = mining_gather
key19 = mining_process_1
key20 = mining_process_2
key21 = mining_supplier
key22 = taxi_center


[market]
Expand Down Expand Up @@ -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

32 changes: 31 additions & 1 deletion i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -595,5 +595,35 @@
"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": "Taxi menu",
"taxi_garage_menu": "Garage taxi",
"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": "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"
}
39 changes: 36 additions & 3 deletions i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -644,5 +644,38 @@
"gris_fonce": "Gris foncé",
"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."
}
"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",
"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 ?",
"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",
"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",
"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",
"taxi_disclaimer_caution": "Une caution de {1} $ est nécessaire pour utiliser un taxi. Vous les retrouverez une fois le taxi rendu."
}
3 changes: 2 additions & 1 deletion licenses/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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",
Expand Down Expand Up @@ -94,7 +95,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",
Expand Down Expand Up @@ -241,6 +243,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"
]
}
1 change: 1 addition & 0 deletions roleplay.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,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',
Expand Down
Loading