├── fxmanifest.lua ├── client ├── targets.lua └── main.lua ├── README.md ├── server └── main.lua ├── locales ├── bg.lua ├── en.lua └── de.lua └── config.lua /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'cerulean' 2 | game 'gta5' 3 | lua54 'yes' 4 | 5 | shared_scripts { 6 | '@qb-core/shared/locale.lua', 7 | 'locales/en.lua', 8 | 'config.lua' 9 | } 10 | 11 | client_script { 12 | 'client/main.lua', 13 | 'client/targets.lua' 14 | } 15 | 16 | server_script 'server/main.lua' 17 | -------------------------------------------------------------------------------- /client/targets.lua: -------------------------------------------------------------------------------- 1 | CreateThread(function() 2 | 3 | 4 | exports['qb-target']:AddTargetModel(1206185632, { 5 | options = { 6 | { 7 | type = "client", 8 | event = "elite-electrician:client:VehPick", 9 | icon = "fas fa-car", 10 | label = Lang:t("info.pik"), 11 | }, 12 | 13 | }, 14 | distance = 2.5 15 | }) 16 | end) 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **Electrician job for QBCore Framework** 2 | 3 | **Open-source script** 4 | 5 | 6 | 7 | Dependencies: 8 | * [qb-core](https://github.com/qbcore-framework/qb-core) 9 | * [qb-target](https://github.com/BerkieBb/qb-target) 10 | * [ps-ui](https://github.com/Project-Sloth/ps-ui) 11 | * [mythic notify](https://github.com/wowpanda/mythic_notify) 12 | 13 | Photos: 14 | ![image](https://media.discordapp.net/attachments/895371787209170984/994242577689743380/unknown.png?width=1193&height=671) 15 | ![image](https://media.discordapp.net/attachments/895371787209170984/994241897939873884/unknown.png) 16 | -------------------------------------------------------------------------------- /server/main.lua: -------------------------------------------------------------------------------- 1 | local QBCore = exports['qb-core']:GetCoreObject() 2 | 3 | RegisterNetEvent('elite-electrician:server:Payslip', function(drops) 4 | local src = source 5 | local Player = QBCore.Functions.GetPlayer(src) 6 | Player.Functions.AddMoney("cash", 150, "electrician-salary") 7 | TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = Lang:t("success.reward")}) 8 | end) 9 | 10 | RegisterNetEvent('elite-electrician:server:Reward', function(drops) 11 | local chance = math.random(1,100) 12 | if chance < 25 then 13 | local xPlayer = QBCore.Functions.GetPlayer(tonumber(source)) 14 | xPlayer.Functions.AddItem("iron", math.random(5,10), false) 15 | TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items["iron"], "add") 16 | TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = Lang:t("success.material")}) 17 | end 18 | end) 19 | -------------------------------------------------------------------------------- /locales/bg.lua: -------------------------------------------------------------------------------- 1 | local Translations = { 2 | error = { 3 | beware = 'Електричното табло е леко нестабилно, тресна те тока!', 4 | buckle = 'Този път те зашемети яко тока!', 5 | 6 | }, 7 | success = { 8 | reward = 'Получи $150 от този сигнал!', 9 | material = 'Получи интересен материал!', 10 | 11 | }, 12 | info = { 13 | pik = 'Извади МПС', 14 | store_veh = '~g~E~w~ - Прибери МПС', 15 | not_serv_veh = 'Това не е служебното МПС', 16 | driver = 'Трябва да бъдеш шофьор!', 17 | gps = 'Сигналите са маркирани на GPS! Отиди и ги завърши!', 18 | dashboard = '~g~E~w~ - Поправи', 19 | nextd = 'Поправено - давай към следващото табло!', 20 | finished = 'Работата е завършена!Върни се в централата!', 21 | job_label = 'Електро Централа', 22 | vehs = 'Автомобили', 23 | p1 = 'Счупено електронно табло 1', 24 | p2 = 'Счупено електронно табло 2', 25 | p3 = 'Счупено електронно табло 3', 26 | p4 = 'Счупено електронно табло 4', 27 | p5 = 'Счупено електронно табло 5', 28 | p6 = 'Счупено електронно табло 6', 29 | } 30 | } 31 | 32 | Lang = Locale:new({ 33 | phrases = Translations, 34 | warnOnMissing = true 35 | }) 36 | -------------------------------------------------------------------------------- /locales/en.lua: -------------------------------------------------------------------------------- 1 | local Translations = { 2 | error = { 3 | beware = 'The electric current is unstable, beware of shock', 4 | buckle = 'The buckle snapped hard', 5 | 6 | }, 7 | success = { 8 | reward = 'You got $150 from this signal!', 9 | material = 'You found interesting material!', 10 | 11 | }, 12 | info = { 13 | pik = 'Pick Vehicle', 14 | store_veh = '~g~E~w~ - Store Vehicle', 15 | not_serv_veh = 'This is not a service vehicle', 16 | driver = 'You must be the driver of the car!', 17 | gps = 'Signals are marked on GPS! Go and finish them!', 18 | dashboard = '~g~E~w~ - Fix the dashboard', 19 | nextd = 'Fixed, go to the next signal!', 20 | finished = 'The job is done! Return to headquarters to leave the vehicle!', 21 | job_label = 'Electric Power Station', 22 | vehs = 'Vehicles', 23 | p1 = 'Broken electrical panel 1', 24 | p2 = 'Broken electrical panel 2', 25 | p3 = 'Broken electrical panel 3', 26 | p4 = 'Broken electrical panel 4', 27 | p5 = 'Broken electrical panel 5', 28 | p6 = 'Broken electrical panel 6', 29 | } 30 | } 31 | 32 | Lang = Locale:new({ 33 | phrases = Translations, 34 | warnOnMissing = true 35 | }) 36 | -------------------------------------------------------------------------------- /locales/de.lua: -------------------------------------------------------------------------------- 1 | local Translations = { 2 | error = { 3 | beware = 'Ich habe einen Schock bekommen, sei vorsichtig!', 4 | buckle = 'Es hat dich fassungslos gemacht!', 5 | 6 | }, 7 | success = { 8 | reward = 'Erhalten $150 von diesem Signal!', 9 | material = 'Habe interessantes Material bekommen!', 10 | 11 | }, 12 | info = { 13 | pik = 'Nehmen Sie das Fahrzeug heraus', 14 | store_veh = '~g~E~w~ - Nimm es weg Wagen', 15 | not_serv_veh = 'Dies ist nicht das offizielle Fahrzeug', 16 | driver = 'Sie müssen ein Fahrer sein!', 17 | gps = 'Melden Sie sich für die GPS-Markierung an! Geh und beende sie!', 18 | dashboard = '~g~E~w~ - Repariere es', 19 | nextd = 'Behoben - gehe zum nächsten Armaturenbrett!', 20 | finished = 'Job erledigt! Kehre zum Hauptquartier zurück!', 21 | job_label = 'Kraftwerk', 22 | vehs = 'Kraftfahrzeug', 23 | p1 = 'Defekte elektronische Platine 1', 24 | p2 = 'Defekte elektronische Platine 2', 25 | p3 = 'Defekte elektronische Platine 3', 26 | p4 = 'Defekte elektronische Platine 4', 27 | p5 = 'Defekte elektronische Platine 5', 28 | p6 = 'Defekte elektronische Platine 6', 29 | } 30 | } 31 | 32 | Lang = Locale:new({ 33 | phrases = Translations, 34 | warnOnMissing = true 35 | }) 36 | -------------------------------------------------------------------------------- /config.lua: -------------------------------------------------------------------------------- 1 | Config = Config or {} 2 | 3 | Config.ShowBlip = true 4 | 5 | Config.JobPrice = math.random(36, 250) 6 | 7 | Config.PaymentTax = 5 8 | 9 | Config.Invincible = true 10 | Config.Frozen = true 11 | Config.Stoic = true 12 | Config.FadeIn = true 13 | Config.DistanceSpawn = 20.0 14 | 15 | Config.MinusOne = true 16 | 17 | 18 | Config.Locations = { 19 | ["job"] = { 20 | label = Lang:t("info.job_label"), 21 | coords = vector4(728.24, 132.25, 80.96, 65.91), 22 | }, 23 | ["vehicle"] = { 24 | label = Lang:t("info.vehs"), 25 | coords = vector4(741.19, 127.17, 79.98, 246.09), 26 | }, 27 | 28 | ["jobset1"] = { 29 | [1] = { 30 | name = Lang:t("info.p1"), 31 | coords = vector4(-3242.0, 1012.94, 12.4, 177.68), 32 | }, 33 | [2] = { 34 | name = Lang:t("info.p2"), 35 | coords = vector4(-768.13, 353.6, 88.0, 175.11), 36 | }, 37 | [3] = { 38 | name = Lang:t("info.p3"), 39 | coords = vector4(149.55, 323.56, 112.31, 287.87), 40 | }, 41 | [4] = { 42 | name = Lang:t("info.p4"), 43 | coords = vector4(1884.17, 2705.03, 45.83, 27.93), 44 | }, 45 | [5] = { 46 | name = Lang:t("info.p5"), 47 | coords = vector4(211.51, 1154.74, 227.01, 202.78), 48 | }, 49 | [6] = { 50 | name = Lang:t("info.p6"), 51 | coords = vector4(-441.46, 5995.63, 31.49, 314.51), 52 | }, 53 | }, 54 | ["jobset2"] = { 55 | [1] = { 56 | name = Lang:t("info.p1"), 57 | coords = vector4(-452.59, 1081.3, 327.69, 265.64), 58 | }, 59 | [2] = { 60 | name = Lang:t("info.p2"), 61 | coords = vector4(-39.33, 1909.69, 195.36, 96.73), 62 | }, 63 | [3] = { 64 | name = Lang:t("info.p3"), 65 | coords = vector4(-1591.71, -846.03, 9.95, 231.51), 66 | }, 67 | [4] = { 68 | name = Lang:t("info.p4"), 69 | coords = vector4(1142.24, -795.23, 57.59, 264.28), 70 | }, 71 | [5] = { 72 | name = Lang:t("info.p5"), 73 | coords = vector4(33.36, -726.57, 31.64, 75.64), 74 | }, 75 | [6] = { 76 | name = Lang:t("info.p6"), 77 | coords = vector4(-1511.63, 1521.82, 115.29, 277.02), 78 | }, 79 | }, 80 | ["jobset3"] = { 81 | [1] = { 82 | name = Lang:t("info.p1"), 83 | coords = vector4(-35.75, -722.49, 33.0, 346.1), 84 | }, 85 | [2] = { 86 | name = Lang:t("info.p2"), 87 | coords = vector4(-356.72, -641.5, 31.81, 0.96), 88 | }, 89 | [3] = { 90 | name = Lang:t("info.p3"), 91 | coords = vector4(-992.1, -716.33, 21.66, 92.2), 92 | }, 93 | [4] = { 94 | name = Lang:t("info.p4"), 95 | coords = vector4(-1367.31, -649.59, 28.6, 312.46), 96 | }, 97 | [5] = { 98 | name = Lang:t("info.p5"), 99 | coords = vector4(-1462.46, -684.64, 26.47, 140.51), 100 | }, 101 | [6] = { 102 | name = Lang:t("info.p6"), 103 | coords = vector4(-1837.27, 789.76, 138.65, 313.12), 104 | }, 105 | }, 106 | ["jobset4"] = { 107 | [1] = { 108 | name = Lang:t("info.p1"), 109 | coords = vector4(-1533.93, -692.02, 28.79, 231.33), 110 | }, 111 | [2] = { 112 | name = Lang:t("info.p2"), 113 | coords = vector4(-1586.83, -924.87, 9.55, 231.95), 114 | }, 115 | [3] = { 116 | name = Lang:t("info.p3"), 117 | coords = vector4(-1328.54, -1136.79, 4.32, 95.64), 118 | }, 119 | [4] = { 120 | name = Lang:t("info.p4"), 121 | coords = vector4(-1324.6, -1255.69, 4.61, 112.56), 122 | }, 123 | [5] = { 124 | name = Lang:t("info.p5"), 125 | coords = vector4(-1148.85, -1380.75, 5.08, 121.18), 126 | }, 127 | [6] = { 128 | name = Lang:t("info.p6"), 129 | coords = vector4(602.83, 2784.06, 42.22, 185.43), 130 | }, 131 | }, 132 | ["jobset5"] = { 133 | [1] = { 134 | name = Lang:t("info.p1"), 135 | coords = vector4(-973.92, -1562.85, 5.04, 201.55), 136 | }, 137 | [2] = { 138 | name = Lang:t("info.p2"), 139 | coords = vector4(-417.61, 185.68, 80.77, 0.26), 140 | }, 141 | [3] = { 142 | name = Lang:t("info.p3"), 143 | coords = vector4(-423.81, 285.86, 83.23, 86.28), 144 | }, 145 | [4] = { 146 | name = Lang:t("info.p4"), 147 | coords = vector4(-621.25, 323.54, 82.26, 83.19), 148 | }, 149 | [5] = { 150 | name = Lang:t("info.p5"), 151 | coords = vector4(-941.21, 321.92, 71.35, 95.0), 152 | }, 153 | [6] = { 154 | name = Lang:t("info.p6"), 155 | coords = vector4(634.69, 2778.32, 42.01, 97.25), 156 | }, 157 | } 158 | } 159 | 160 | Config.JobVehicles = { 161 | [1] = "burrito", 162 | } 163 | 164 | Config.GenderNumbers = { -- No reason to touch these. 165 | ['male'] = 4, 166 | ['female'] = 5 167 | } 168 | 169 | Config.PedList = { 170 | 171 | { 172 | model = `ig_andreas`, 173 | coords = vector4(728.24, 132.25, 80.96, 65.91), 174 | gender = 'male' 175 | }, 176 | 177 | 178 | } 179 | -------------------------------------------------------------------------------- /client/main.lua: -------------------------------------------------------------------------------- 1 | local QBCore = exports['qb-core']:GetCoreObject() 2 | 3 | local spawnedPeds = {} 4 | local ped = PlayerPedId() 5 | local PlayerJob = {} 6 | CompleteRepairs = 0 7 | JobsinSession = {} 8 | 9 | local function DrawText3D(x, y, z, text) 10 | SetTextScale(0.35, 0.35) 11 | SetTextFont(4) 12 | SetTextProportional(1) 13 | SetTextColour(255, 255, 255, 215) 14 | SetTextEntry("STRING") 15 | SetTextCentre(true) 16 | AddTextComponentString(text) 17 | SetDrawOrigin(x,y,z, 0) 18 | DrawText(0.0, 0.0) 19 | local factor = (string.len(text)) / 370 20 | DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75) 21 | ClearDrawOrigin() 22 | end 23 | 24 | -- Blip Function 25 | local function SetJobBlip(title) 26 | local JobBlip = AddBlipForCoord(Config.Locations[title].coords.x, Config.Locations[title].coords.y, Config.Locations[title].coords.z) 27 | SetBlipSprite(JobBlip, 354) 28 | SetBlipDisplay(JobBlip, 4) 29 | SetBlipScale(JobBlip, 0.9) 30 | SetBlipAsShortRange(JobBlip, true) 31 | SetBlipColour(JobBlip, 1) 32 | BeginTextCommandSetBlipName("STRING") 33 | AddTextComponentSubstringPlayerName(Config.Locations[title].label) 34 | EndTextCommandSetBlipName(JobBlip) 35 | end 36 | 37 | -- Job Blip Function 38 | local function SetWorkBlip(d) 39 | for k, v in pairs(Config.Locations["jobset" ..d]) do 40 | WorkBlip = AddBlipForCoord(v.coords.x, v.coords.y, v.coords.z) 41 | SetBlipSprite(WorkBlip, 456) 42 | SetBlipDisplay(WorkBlip, 4) 43 | SetBlipScale(WorkBlip, 0.5) 44 | SetBlipAsShortRange(WorkBlip, true) 45 | SetBlipColour(WorkBlip, 1) 46 | BeginTextCommandSetBlipName("STRING") 47 | AddTextComponentSubstringPlayerName(v.name) 48 | EndTextCommandSetBlipName(WorkBlip) 49 | table.insert(JobsinSession, {id = k, x = v.coords.x, y = v.coords.y, z = v.coords.z, BlipId = WorkBlip}) 50 | end 51 | TriggerEvent('elite-electrician:client:JobMarkers') 52 | end 53 | 54 | 55 | -- Checks if car is a Job Vehicle 56 | local function VehicleCheck(vehicle) 57 | local retval = false 58 | for k, v in pairs(Config.JobVehicles) do 59 | print(v) 60 | if GetEntityModel(vehicle) == GetHashKey(v) then 61 | retval = true 62 | end 63 | end 64 | return retval 65 | end 66 | 67 | 68 | 69 | RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() 70 | PlayerJob = QBCore.Functions.GetPlayerData().job 71 | end) 72 | 73 | 74 | RegisterNetEvent('elite-electrician:client:VehPick', function() 75 | local choice = math.random(1, #Config.JobVehicles) 76 | ElecVeh = Config.JobVehicles[choice] 77 | TriggerEvent('elite-electrician:client:SpawnVehicle', ElecVeh) 78 | end) 79 | 80 | CreateThread(function() 81 | if Config.ShowBlip then 82 | SetJobBlip("job") 83 | end 84 | end) 85 | 86 | 87 | function Tok() 88 | local chance = math.random(0,100) 89 | if chance < 100 then 90 | TokAnim() 91 | exports['mythic_notify']:DoHudText('error', Lang:t("error.beware")) 92 | elseif chance < 2 then 93 | exports['mythic_notify']:DoHudText('error', Lang:t("error.buckle")) 94 | TriggerEvent('hospital:client:KillPlayer', PlayerPedId()) 95 | end 96 | 97 | end 98 | 99 | function TokAnim() 100 | local ped = PlayerPedId() 101 | LoadAnim('melee@unarmed@streamed_variations') 102 | TaskPlayAnim(ped, 'melee@unarmed@streamed_variations', 'victim_takedown_front_slap', 6.0, -6.0, 6000, 2, 0, 0, 0, 0) 103 | end 104 | 105 | -- // За да се заредят анимациите // 106 | function LoadAnim(dict) 107 | while not HasAnimDictLoaded(dict) do 108 | RequestAnimDict(dict) 109 | Citizen.Wait(1) 110 | end 111 | end 112 | 113 | CreateThread(function() 114 | local inRange = false 115 | while true do 116 | Wait(0) 117 | local pos = GetEntityCoords(PlayerPedId()) 118 | if #(pos - vector3(Config.Locations["vehicle"].coords.x, Config.Locations["vehicle"].coords.y, Config.Locations["vehicle"].coords.z)) < 10 then 119 | inRange = true 120 | DrawMarker(2, Config.Locations["vehicle"].coords.x, Config.Locations["vehicle"].coords.y, Config.Locations["vehicle"].coords.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.2, 0.15, 200, 200, 200, 222, false, false, false, true, false, false, false) 121 | if #(pos - vector3(Config.Locations["vehicle"].coords.x, Config.Locations["vehicle"].coords.y, Config.Locations["vehicle"].coords.z)) < 1.5 then 122 | if IsPedInAnyVehicle(PlayerPedId(), false) then 123 | DrawText3D(Config.Locations["vehicle"].coords.x, Config.Locations["vehicle"].coords.y, Config.Locations["vehicle"].coords.z, Lang:t("info.store_veh")) 124 | end 125 | if IsControlJustReleased(0, 38) then 126 | if IsPedInAnyVehicle(PlayerPedId(), false) then 127 | if GetPedInVehicleSeat(GetVehiclePedIsIn(PlayerPedId()), -1) == PlayerPedId() then 128 | if VehicleCheck(GetVehiclePedIsIn(PlayerPedId(), false)) then 129 | DeleteVehicle(GetVehiclePedIsIn(PlayerPedId())) 130 | for k,v in ipairs(JobsinSession) do 131 | RemoveBlip(v.BlipId) 132 | end 133 | else 134 | exports['mythic_notify']:DoHudText('error', Lang:t("info.not_serv_veh")) 135 | end 136 | else 137 | exports['mythic_notify']:DoHudText('error', Lang:t("info.driver")) 138 | end 139 | end 140 | end 141 | end 142 | end 143 | if not inRange then 144 | Wait(1000) 145 | end 146 | 147 | end 148 | end) 149 | 150 | 151 | 152 | 153 | RegisterNetEvent('elite-electrician:client:SpawnVehicle', function(vehicleInfo) 154 | local coords = Config.Locations["vehicle"].coords 155 | QBCore.Functions.SpawnVehicle(vehicleInfo, function(veh) 156 | SetVehicleNumberPlateText(veh, "ELEC") 157 | SetEntityHeading(veh, coords.w) 158 | exports['LegacyFuel']:SetFuel(veh, 100.0) 159 | TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1) 160 | SetEntityAsMissionEntity(veh, true, true) 161 | TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(veh)) 162 | SetVehicleEngineOn(veh, true, true) 163 | CurrentPlate = QBCore.Functions.GetPlate(veh) 164 | StartJobLocations() 165 | end, coords, true) 166 | end) 167 | 168 | function StartJobLocations() 169 | jobchoice = math.random(1,5) 170 | SetWorkBlip(jobchoice) 171 | exports['mythic_notify']:DoHudText('inform', Lang:t("info.gps")) 172 | end 173 | 174 | -- Individual Job Site Interactions 175 | RegisterNetEvent('elite-electrician:client:JobMarkers', function(k, v) 176 | local inRange = false 177 | CompleteRepairs = 0 178 | while true do 179 | Wait(0) 180 | for k, v in ipairs(JobsinSession) do 181 | local pos = GetEntityCoords(PlayerPedId()) 182 | if CompleteRepairs < 5 then 183 | -- if PlayerJob.name == "electrician" then 184 | if #(pos - vector3(v.x, v.y, v.z)) < 10 then 185 | inRange = true 186 | DrawMarker(2, v.x, v.y, v.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.2, 0.15, 200, 200, 200, 222, false, false, false, true, false, false, false) 187 | if #(pos - vector3(v.x, v.y, v.z)) < 1.5 then 188 | DrawText3D(v.x, v.y, v.z, Lang:t("info.dashboard")) 189 | if IsControlJustReleased(0, 38) then 190 | TriggerEvent('animations:client:EmoteCommandStart', {"weld"}) 191 | exports['ps-ui']:Circle(function(success) 192 | if success then 193 | if CompleteRepairs <= 4 then 194 | exports['mythic_notify']:DoHudText('inform', Lang:t("info.nextd")) 195 | TriggerServerEvent("elite-electrician:server:Reward"); 196 | TriggerServerEvent("elite-electrician:server:Payslip"); 197 | 198 | else 199 | exports['mythic_notify']:DoHudText('inform', Lang:t("info.finished")) 200 | TriggerServerEvent("elite-electrician:server:Payslip"); 201 | 202 | end 203 | RemoveBlip(v.BlipId) 204 | TriggerEvent('animations:client:EmoteCommandStart', {"c"}) 205 | table.remove(JobsinSession, k) 206 | else 207 | Tok() 208 | end 209 | end, 5, 8) -- NumberOfCircles, MS 210 | 211 | end 212 | end 213 | 214 | end 215 | if not inRange then 216 | Wait(1000) 217 | end 218 | -- end 219 | end 220 | end 221 | end 222 | end) 223 | 224 | 225 | Citizen.CreateThread(function() 226 | while true do 227 | Citizen.Wait(500) 228 | for k,v in pairs(Config.PedList) do 229 | local playerCoords = GetEntityCoords(PlayerPedId()) 230 | local distance = #(playerCoords - v.coords.xyz) 231 | 232 | if distance < Config.DistanceSpawn and not spawnedPeds[k] then 233 | local spawnedPed = NearPed(v.model, v.coords, v.gender, v.animDict, v.animName, v.scenario) 234 | spawnedPeds[k] = { spawnedPed = spawnedPed } 235 | end 236 | 237 | if distance >= Config.DistanceSpawn and spawnedPeds[k] then 238 | if Config.FadeIn then 239 | for i = 255, 0, -51 do 240 | Citizen.Wait(50) 241 | SetEntityAlpha(spawnedPeds[k].spawnedPed, i, false) 242 | end 243 | end 244 | DeletePed(spawnedPeds[k].spawnedPed) 245 | spawnedPeds[k] = nil 246 | end 247 | end 248 | end 249 | end) 250 | 251 | function NearPed(model, coords, gender, animDict, animName, scenario) 252 | RequestModel(model) 253 | while not HasModelLoaded(model) do 254 | Citizen.Wait(50) 255 | end 256 | 257 | if Config.MinusOne then 258 | spawnedPed = CreatePed(Config.GenderNumbers[gender], model, coords.x, coords.y, coords.z - 1.0, coords.w, false, true) 259 | else 260 | spawnedPed = CreatePed(Config.GenderNumbers[gender], model, coords.x, coords.y, coords.z, coords.w, false, true) 261 | end 262 | 263 | SetEntityAlpha(spawnedPed, 0, false) 264 | 265 | if Config.Frozen then 266 | FreezeEntityPosition(spawnedPed, true) 267 | end 268 | 269 | if Config.Invincible then 270 | SetEntityInvincible(spawnedPed, true) 271 | end 272 | 273 | if Config.Stoic then 274 | SetBlockingOfNonTemporaryEvents(spawnedPed, true) 275 | end 276 | 277 | if animDict and animName then 278 | RequestAnimDict(animDict) 279 | while not HasAnimDictLoaded(animDict) do 280 | Citizen.Wait(50) 281 | end 282 | 283 | TaskPlayAnim(spawnedPed, animDict, animName, 8.0, 0, -1, 1, 0, 0, 0) 284 | end 285 | 286 | if scenario then 287 | TaskStartScenarioInPlace(spawnedPed, scenario, 0, true) 288 | end 289 | 290 | if Config.FadeIn then 291 | for i = 0, 255, 51 do 292 | Citizen.Wait(50) 293 | SetEntityAlpha(spawnedPed, i, false) 294 | end 295 | end 296 | 297 | return spawnedPed 298 | end 299 | --------------------------------------------------------------------------------