# Sunset Bleach

## Introduction

**Sunset Bleach is a Cleaning Job that adds a new style of job to your Server.**

This job currently providers the player with 2 different tasks on each location, The cleaning task requires the player to utilize the mop and bucket that is supplied in the back of their work vehicle, the mop and bucket have added animations to enhance the player immersion in the job progress, the dirt on the ground will be slowly cleaned with each pass of the mop and also the trash task requires players to take out the trash located around the locations out to the nearest dumpster.

**This script is written to work with** [**QBCore**](https://qbcore-framework.github.io/qb-docs/) **and** [**Zap Hosting ESX Pack**](https://github.com/zaphosting/esx_12)

{% hint style="info" %}
This script comes with a custom decal texture that adds the sunset bleach decals to the players clothing for added immersion.
{% endhint %}

Players can change their username, profile picture, and phone size on the settings page.

This is a standalone script, however, you can enable QBCore support within the config.

***

## Installation

* Download the power\_sunsetbleach from Keymaster
* Add the files to your resources folder
* Ensure that the resource file will start (either ensure your resource in the server.cfg or inside a folder which is started on server start)
* Edit the config file to your needs
* Restart your server

***

## Configuration

Select the tab below for your framework to see the configuration options available.

{% tabs %}
{% tab title="Framework Options" %}

```lua
-- The name of the job that will be used in qbcore/esx
jobName = 'sunsetbleach'

---======================---
---==== QBCore Support ====---
---======================---
-- Enabling Support
enableQBCore = true 
-- Name of your qb-core resource, incase you have renamed it. 
QBC_resourceName = 'qb-core'

---======================---
---===== ESX Support ====---
---======================---
-- Enabling Support
enableESX = false

---======================---
---===== Standalone ====---
---======================---

-- The location that players will go to clock on/off shift.
jobShiftLocation = vector3(-281.804, -2656.844, 6.415861)

-- The location that the vehicle will spawn.
jobShiftVehicleLocation = vector4(-286.2495, -2650.008, 5.804349, 45.0)

-- the amount of pay per task, example job 1 has 10 tasks. so the pay would be, $5000 for the job. 
taskAmount = 500

-- Enable the job location blip 
enableJobBlip = true
```

{% endtab %}

{% tab title="Configuration Options" %}
{% hint style="info" %}
You can add additional job locations or remove job locations by following the format under jobLocations.
{% endhint %}

```lua
-- The location that players will go to clock on/off shift.
jobShiftLocation = vector3(-281.804, -2656.844, 6.415861)

-- The location that the vehicle will spawn.
jobShiftVehicleLocation = vector4(-286.2495, -2650.008, 5.804349, 45.0)

-- the amount of pay per task, example job 1 has 10 tasks. so the pay would be, $5000 for the job. 
taskAmount = 500

-- Enable the job location blip 
enableJobBlip = true

-- The available job locations to players. 
-- You can add as many jobs as you want by simply following the job locations below.
jobLocations = {
 [1] = { -- Grove Street Gas Station
  ['location'] = vector3(-54.11219, -1753.584, 29.42101), -- The job location.
  ['cleanTasks'] = {
   vector3(-54.11219, -1753.584, 29.42101), -- The locations of the dirt on the floor
   vector3(-53.75867, -1749.8, 29.42101), 
   vector3(-50.94836, -1750.826, 29.42101), 
   vector3(-48.29272, -1753.341, 29.42101), 
   vector3(-44.84763, -1755.177, 29.42101), 
   vector3(-43.10236, -1751.351, 29.42104), 
   vector3(-49.20177, -1750.624, 29.42101), 
  },
  ['trashTasks'] = {
   vector3(-40.04084, -1751.646, 29.42101), -- The locations of the bag.
   vector3(-40.96629, -1751.247, 29.42101), 
   vector3(-40.57495, -1752.116, 29.42101), 
  }
 },
 [2] = { -- Life Invader Building - Downstairs
  ['location'] = vector3(-1080.999, -251.6795, 37.76328),
  ['cleanTasks'] = {
   vector3(-1084.781, -250.8581, 37.76328), 
   vector3(-1085.807, -255.5686, 37.76328), 
   vector3(-1078.034, -252.188, 37.76328), 
   vector3(-1067.354, -246.1295, 39.73111), 
   vector3(-1056.522, -237.8269, 39.73315), 
   vector3(-1078.9, -244.1272, 37.7633), 
   vector3(-1089.113, -258.5271, 37.76329), 
  },
  ['trashTasks'] = {
   vector3(-1069.11, -241.9466, 39.73318), 
   vector3(-1081.332, -244.6732, 37.76329), 
  }
 },
 [3] = { -- Life Invader Building - Upstairs
  ['location'] = vector3(-1074.947, -243.6279, 44.03567), 
  ['cleanTasks'] = {
   vector3(-1081.821, -247.255, 44.0213), 
   vector3(-1080.515, -249.6434, 44.0213), 
   vector3(-1076.269, -248.5858, 44.02126), 
   vector3(-1070.726, -250.1191, 44.02115), 
   vector3(-1066.143, -243.2166, 44.02113), 
   vector3(-1051.575, -235.4251, 44.02117), 
   vector3(-1081.317, -253.2922, 44.02115), 
  },
  ['trashTasks'] = {
   vector3(-1063.956, -250.3854, 44.02107), 
   vector3(-1051.082, -232.5481, 44.02089), 
  }
 },
 [4] = { -- Strawberry 24/7
  ['location'] = vector3(29.43475, -1346.012, 29.49702), 
  ['cleanTasks'] = {
   vector3(29.43475, -1346.012, 29.49702), 
   vector3(30.77909, -1347.686, 29.49702), 
   vector3(32.07889, -1344.867, 29.49702), 
   vector3(33.47377, -1343.528, 29.49702), 
   vector3(25.27234, -1343.146, 29.49702), 
   vector3(26.46838, -1340.291, 29.49702), 
   vector3(29.55153, -1339.92, 29.49702), 
  },
  ['trashTasks'] = {
   vector3(24.66826, -1339.077, 29.49702), 
  }
 },
 [5] = { -- Grapeseed Gas Station
  ['location'] = vector3(1702.749, 4932.333, 42.06367), 
  ['cleanTasks'] = {
   vector3(1702.749, 4932.333, 42.06367), 
   vector3(1707.444, 4930.537, 42.06367), 
   vector3(1706.083, 4929.602, 42.06367), 
   vector3(1704.351, 4927.836, 42.06367), 
   vector3(1704.971, 4926.093, 42.06367), 
   vector3(1701.875, 4926.683, 42.06367), 
   vector3(1700.018, 4926.174, 42.06367), 
   vector3(1701.218, 4921.097, 42.06367), 
   vector3(1703.231, 4918.79, 42.06367), 
   vector3(1705.396, 4921.717, 42.06367), 
  },
  ['trashTasks'] = {
   vector3(1705.346, 4922.332, 42.06363), 
   vector3(1705.335, 4917.672, 42.06406), 
   vector3(1704.043, 4933.371, 42.06367), 
  }
 },
 [6] = { -- Great Ocean Gas Station / 24/7
  ['location'] = vector3(1733.578, 6416.666, 35.03722), 
  ['cleanTasks'] = {
   vector3(1733.578, 6416.666, 35.03722), 
   vector3(1732.962, 6413.89, 35.03722), 
   vector3(1734.135, 6411.771, 35.03722), 
   vector3(1735.419, 6413.23, 35.03722), 
   vector3(1730.607, 6415.263, 35.03722), 
   vector3(1732.809, 6420.516, 35.03722), 
  },
  ['trashTasks'] = {
   vector3(1736.63, 6417.383, 35.03723), 
  }
 },
 [7] = { -- Bob's Liqour - San Andreas Avenue
  ['location'] = vector3(-1223.235, -903.2563, 12.32635), 
  ['cleanTasks'] = {
   vector3(-1223.235, -903.2563, 12.32635), 
   vector3(-1221.869, -905.6379, 12.32635), 
   vector3(-1223.874, -906.3369, 12.32635), 
   vector3(-1225.697, -906.1785, 12.32635), 
   vector3(-1225.674, -908.1896, 12.32635), 
   vector3(-1219.303, -915.2161, 11.32716), 
  },
  ['trashTasks'] = {
   vector3(-1219.552, -910.2709, 12.32634), 
   vector3(-1217.849, -915.7509, 11.32634), 
  }
 },
 [8] = { -- Mirror Park Gas Station
  ['location'] = vector3(1157.888, -325.4932, 69.20507), 
  ['cleanTasks'] = {
   vector3(1157.888, -325.4932, 69.20507), 
   vector3(1155.472, -325.2441, 69.20507), 
   vector3(1156.088, -322.698, 69.20507), 
   vector3(1157.417, -320.9739, 69.20507), 
   vector3(1161.043, -320.1905, 69.20507), 
   vector3(1163.86, -319.2863, 69.20507), 
   vector3(1161.053, -313.9672, 69.20507), 
  },
  ['trashTasks'] = {
   vector3(1159.966, -317.1761, 69.20506), 
   vector3(1160.72, -316.9471, 69.20506), 
  }
 },
 [9] = { -- Route 68 - Store 
  ['location'] = vector3(542.0971, 2670.978, 42.1565), 
  ['cleanTasks'] = {
   vector3(542.0971, 2670.978, 42.1565), 
   vector3(541.7849, 2668.737, 42.1565), 
   vector3(544.5588, 2666.812, 42.1565), 
   vector3(544.6942, 2668.819, 42.1565), 
   vector3(546.5933, 2669.283, 42.1565), 
   vector3(548.7273, 2667.16, 42.1565), 
   vector3(544.826, 2663.436, 42.1565), 
  },
  ['trashTasks'] = {
   vector3(544.775, 2664.872, 42.54423), 
  }
 },
 [10] = { -- Route 68 - Bobs Liquor 
  ['location'] = vector3(1163.902, 2706.206, 38.15771), 
  ['cleanTasks'] = {
   vector3(1163.902, 2706.206, 38.15771), 
   vector3(1166.411, 2707.123, 38.15771), 
   vector3(1167.768, 2707.187, 38.15771), 
   vector3(1168.349, 2708.484, 38.15771), 
   vector3(1168.892, 2710.598, 38.15771), 
   vector3(1165.219, 2711.488, 38.15771), 
   vector3(1167.304, 2714.383, 38.15771), 
   vector3(1167.939, 2718.323, 37.15781), 
   vector3(1166.879, 2718.341, 37.15745), 
  },
  ['trashTasks'] = {
   vector3(1164.708, 2713.49, 38.15771), 
   vector3(1169.862, 2713.493, 38.15771), 
  }
 },
}
```

{% endtab %}

{% tab title="Language" %}
In this section you can edit the language if you need to translate to another language or edit the wording.

```lua
-- The language configuration
Lang = {
 -- Prompts
 ['clockOn'] = "~w~Press ~g~E~w~ To Clock On Shift", -- \n~w~Press ~g~H~w~ To Clock On with Friend
 ['clockOff'] = "~w~Press ~g~E~w~ To Clock Off Shift",
 ['takeMopFromVehicle'] = "~w~Press ~g~E~w~ To Take Mop",
 ['storeMopInVehicle'] = "~w~Press ~g~E~w~ To Store Mop",
 ['pickupTrash'] = "~w~Press ~g~E~w~ To Pickup Trash",
 ['storeTrash'] = "~w~Press ~g~E~w~ To Store Trash",
 ['putDownBucket'] = "~w~Press ~g~E~w~ To Put Down Bucket",
 ['holdingBucket'] = "~w~Press ~g~E~w~ To Clean Mop\nPress ~g~H~w~ To Pickup Bucket",
 ['useMop'] = "~w~Press ~g~LMB~w~ To Use Mop",
 ['cleanMop'] = "~r~You Must Clean Your Mop.",

 -- Blips
 ['workPlace'] = "Work Place",
 ['jobVehicle'] = "Job Vehicle",
 ['jobLocation'] = "Job Location",

 -- Messages
 ['jobFound'] = "New Cleaning Job Found, Drive to the Marked Destination.",
 ['jobComplete'] = "Job Complete, you have been paid $", -- Amount is added at the end.
 ['jobCompleteScreen'] = "<span style='color: #03fc17'>Job Complete</span><br>Return To Van",
}
```

{% endtab %}

{% tab title="Clothing" %}
You can change the numbers for the clothing outfit with the below:

```lua
-- Clothing 
maleClothing = {
 -- 0: Face\ 1: Mask\ 2: Hair\ 3: Torso\ 4: Leg\ 5: Parachute / bag\ 6: Shoes\ 7: Accessory\ 8: Undershirt\ 9: Kevlar\ 10: Badge\ 11: Torso 2
 ["drawables"] = {0, 0, 2, 86, 38, 0, 12, 96, 0, 39, 66, 65},
 ["textures"] = {0, 0, 0, 1, 3, 0, 6, 0, 240, 0, 1, 3},
 ["palette"] = {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}

femaleClothing = {
 -- 0: Face\ 1: Mask\ 2: Hair\ 3: Torso\ 4: Leg\ 5: Parachute / bag\ 6: Shoes\ 7: Accessory\ 8: Undershirt\ 9: Kevlar\ 10: Badge\ 11: Torso 2
 ["drawables"] = {0, 0, 1, 14, 38, 0, 27, 0, 0, 0, 75, 59},
 ["textures"] = {0, 0, 0, 0, 2, 0, 0, 0, 240, 0, 1, 2},
 ["palette"] = {0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0}
}
```

{% endtab %}
{% endtabs %}

***

## Editable files

### client.lua

#### Custom Notifications

If you would like to edit the notifications to add your own custom notifications or to match them to your other server notifications, you can edit them in the client.lua file. Default notifications are as follows:

```lua
RegisterNetEvent('power:sunsetbleach:notification')
AddEventHandler('power:sunsetbleach:notification', function(message)
 TriggerEvent('QBCore:Notify', message, "primary")
end)
```

#### Framework compatibility

If you need to edit the framework compatibility they can be edited in the client.lua file. Default compatibilities are as below:

```lua
local QBCore = nil 

if enableQBCore then 
 QBCore = exports[QBC_resourceName]:GetCoreObject()

 AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
  local player = QBCore.Functions.GetPlayerData()
  local PlayerJob = player.job
  hasJob = false

  if PlayerJob then 
   if PlayerJob.name == jobName then 
    hasJob = true
   end 
  end 
 end)

 RegisterNetEvent('QBCore:Client:OnJobUpdate')
 AddEventHandler('QBCore:Client:OnJobUpdate', function()
  local player = QBCore.Functions.GetPlayerData()
  local PlayerJob = player.job
  hasJob = false

  if PlayerJob then 
   if PlayerJob.name == jobName then 
    hasJob = true
   end 
  end 
 end)
end

if enableESX then 
 RegisterNetEvent('esx:playerLoaded')
 AddEventHandler('esx:playerLoaded', function(player)
  hasJob = false
  if player then 
   if player.job.name == jobName then 
    hasJob = true
   end 
  end 
 end)

 RegisterNetEvent('esx:setJob')
 AddEventHandler('esx:setJob', function(job)
  hasJob = false
  if job then 
   if job.name == jobName then 
    hasJob = true
   end 
  end 
 end)
end

```

#### Custom Fuel, Key, and Parking scripts

If you are using a custom fuel and/or key script that requires you to use it's own functions, we have set up some functions where you can add these in:

```lua
function jobVehicleSpawned(jobVehicle)
 if enableQBCore then 
  exports['LegacyFuel']:SetFuel(jobVehicle, 100.0)
  TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(jobVehicle))
 end 

 if enableESX then 
  -- set fuel for esx.
 end 
end 

function vehicleDeleted(vehicle)
 -- TriggerServerEvent("AdvancedParking:deleteVehicle", GetVehicleNumberPlateText(vehicle), true)
end 
```

### server.lua

#### Money Management

If needed, you can edit the functions here on how money calculated and added to your players for the jobs they complete.

```lua
if enableQBCore then 
 local QBCore = exports[QBC_resourceName]:GetCoreObject()

 RegisterNetEvent('power:sunsetbleach:payClient')
 AddEventHandler('power:sunsetbleach:payClient', function(tasks)
  local source = tonumber(source)
  local player = QBCore.Functions.GetPlayer(source)
  local pay = math.floor(tasks * taskAmount)
  player.Functions.AddMoney('cash', pay) 
 end)
end 

if enableESX then 
 ESX = nil

 TriggerEvent('esx:getSharedObject', function(obj) 
  ESX = obj  
 end)

 RegisterNetEvent('power:sunsetbleach:payClient')
 AddEventHandler('power:sunsetbleach:payClient', function(tasks)
  local source = tonumber(source)
  local xPlayer = ESX.GetPlayerFromId(source)
  local pay = math.floor(tasks * taskAmount)
  xPlayer.addMoney(pay)
 end)
end 
```

***

### HTML

#### HTML files are able to be edited.

* index.html
  * Additional language translations can be edited here listed as:
    * <pre><code><strong>Current Job
      </strong></code></pre>
* script.js
* style.css

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.power-scripts.com/sunset-bleach.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
