Skip to content

Commit

Permalink
Merge pull request #809 from bitpredator/dev
Browse files Browse the repository at this point in the history
chore: fixed formatting errors in some functions
  • Loading branch information
bitpredator authored Sep 1, 2024
2 parents d319642 + dc97d77 commit 49d2dab
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function OpenShopMenu(elements, restoreCoords, shopCoords)

DeleteSpawnedVehicles()
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
SetEntityVisible(PlayerPedId(), true, true)

ESX.Game.Teleport(playerPed, restoreCoords)
elseif element3.value == "buy" then
Expand All @@ -249,7 +249,7 @@ function OpenShopMenu(elements, restoreCoords, shopCoords)
ESX.CloseContext()
DeleteSpawnedVehicles()
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
SetEntityVisible(PlayerPedId(), true, true)

ESX.Game.Teleport(playerPed, restoreCoords)
else
Expand All @@ -264,7 +264,7 @@ function OpenShopMenu(elements, restoreCoords, shopCoords)

DeleteSpawnedVehicles()
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
SetEntityVisible(PlayerPedId(), true, true)

ESX.Game.Teleport(playerPed, restoreCoords)
end)
Expand Down
4 changes: 2 additions & 2 deletions server-data/resources/[bpt_addons]/bpt_boat/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function OpenBoatShop(shop)
CurrentActionMsg = TranslateCap("boat_shop_open")

FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
SetEntityVisible(PlayerPedId(), true, true)
SetEntityCoords(playerPed, shop.Outside.x, shop.Outside.y, shop.Outside.z)
else
ESX.ShowNotification(TranslateCap("boat_shop_nomoney"))
Expand Down Expand Up @@ -235,7 +235,7 @@ function reset(shop)
CurrentActionMsg = TranslateCap("boat_shop_open")
DeleteSpawnedVehicles()
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
SetEntityVisible(PlayerPedId(), true, true)
SetEntityCoords(playerPed, shop.Outside.x, shop.Outside.y, shop.Outside.z)
ESX.CloseContext()
end
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function OpenShopMenu()
local playerPed = PlayerPedId()

FreezeEntityPosition(playerPed, true)
SetEntityVisible(playerPed, false)
SetEntityVisible(PlayerPedId(), true, true)
SetEntityCoords(playerPed, Config.Zones.ShopInside.Pos.x, Config.Zones.ShopInside.Pos.y, Config.Zones.ShopInside.Pos.z)

local vehiclesByCategory = {}
Expand Down Expand Up @@ -226,7 +226,7 @@ function OpenShopMenu()
FreezeEntityPosition(playerPed, false)

SetEntityCoords(playerPed, Config.Zones.Katalog.Pos.x, Config.Zones.Katalog.Pos.y, Config.Zones.Katalog.Pos.z)
SetEntityVisible(playerPed, true)
SetEntityVisible(PlayerPedId(), true, true)

IsInShopMenu = false
end, function(data, menu)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ AddEventHandler("esx:setJob", function(j)
grade = j.grade
end)

function isNearWorkbench()
function IsNearWorkbench()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local near = false
Expand All @@ -126,7 +126,7 @@ CreateThread(function()
while true do
Wait(1000)
if craftingQueue[1] ~= nil then
if not Config.CraftingStopWithDistance or (Config.CraftingStopWithDistance and isNearWorkbench()) then
if not Config.CraftingStopWithDistance or (Config.CraftingStopWithDistance and IsNearWorkbench()) then
craftingQueue[1].time = craftingQueue[1].time - 1

SendNUIMessage({
Expand All @@ -145,7 +145,7 @@ CreateThread(function()
end
end)

function openWorkbench(val)
function OpenWorkbench(val)
ESX.TriggerServerCallback("bpt_crafting:getXP", function(xp)
SetNuiFocus(true, true)
TriggerScreenblurFadeIn(1000)
Expand Down Expand Up @@ -200,7 +200,7 @@ CreateThread(function()
end

if open or #v.jobs == 0 then
openWorkbench(v)
OpenWorkbench(v)
else
ESX.ShowNotification(TranslateCap("wrong_job"))
end
Expand Down
2 changes: 1 addition & 1 deletion server-data/resources/[bpt_addons]/bpt_crafting/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Config = {
requireBlueprint = false,
Time = 60,
Ingredients = {
["iron"] = 4,
["iron"] = 2,
["wood"] = 1,
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line no-unused-vars
let timeout;
let opened;
let recipes;
Expand Down Expand Up @@ -102,7 +101,6 @@ function openCategory() {

}

// eslint-disable-next-line no-unused-vars
function openCrafting(t) {

$('#main').html('');
Expand Down Expand Up @@ -287,7 +285,6 @@ function addToQueue(item, time, id) {

}

// eslint-disable-next-line no-unused-vars
function craft(t) {
const item = t.dataset.item;
$.post('https://bpt_crafting/craft', JSON.stringify({
Expand All @@ -299,11 +296,9 @@ function setProgress(p) {
const prog = (398 / 100) * p;
$('#u136').animate({
width: prog,
// eslint-disable-next-line no-empty-function
}, 500, function() {});
}

// eslint-disable-next-line no-unused-vars
function inspect(t) {
if (opened != t) {
opened = t;
Expand Down
20 changes: 10 additions & 10 deletions server-data/resources/[bpt_addons]/bpt_crafting/server/main.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ESX = exports["es_extended"]:getSharedObject()
function setCraftingLevel(identifier, level)
function SetCraftingLevel(identifier, level)
MySQL.Async.execute(
"UPDATE `users` SET `crafting_level`= @xp WHERE `identifier` = @identifier",
{ ["@xp"] = level, ["@identifier"] = identifier },
function() end
)
end

function getCraftingLevel(identifier)
function GetCraftingLevel(identifier)
return tonumber(
MySQL.Sync.fetchScalar(
"SELECT `crafting_level` FROM users WHERE identifier = @identifier ",
Expand All @@ -16,7 +16,7 @@ function getCraftingLevel(identifier)
)
end

function giveCraftingLevel(identifier, level)
function GiveCraftingLevel(identifier, level)
MySQL.Async.execute(
"UPDATE `users` SET `crafting_level`= `crafting_level` + @xp WHERE `identifier` = @identifier",
{ ["@xp"] = level, ["@identifier"] = identifier },
Expand All @@ -26,15 +26,15 @@ end

RegisterServerEvent("bpt_crafting:setExperiance")
AddEventHandler("bpt_crafting:setExperiance", function(identifier, xp)
setCraftingLevel(identifier, xp)
SetCraftingLevel(identifier, xp)
end)

RegisterServerEvent("bpt_crafting:giveExperiance")
AddEventHandler("bpt_crafting:giveExperiance", function(identifier, xp)
giveCraftingLevel(identifier, xp)
GiveCraftingLevel(identifier, xp)
end)

function craft(src, item, retrying)
function Craft(src, item, retrying)
local xPlayer = ESX.GetPlayerFromId(src)
local cancraft = true

Expand Down Expand Up @@ -111,7 +111,7 @@ AddEventHandler("bpt_crafting:itemCrafted", function(item, count)
xPlayer.addInventoryItem(item, count)
end
TriggerClientEvent("bpt_crafting:sendMessage", src, TranslateCap("item_crafted"))
giveCraftingLevel(xPlayer.identifier, Config.ExperiancePerCraft)
GiveCraftingLevel(xPlayer.identifier, Config.ExperiancePerCraft)
else
TriggerEvent("bpt_crafting:craft", item)
TriggerClientEvent("bpt_crafting:sendMessage", src, TranslateCap("inv_limit_exceed"))
Expand All @@ -124,7 +124,7 @@ AddEventHandler("bpt_crafting:itemCrafted", function(item, count)
xPlayer.addInventoryItem(item, count)
end
TriggerClientEvent("bpt_crafting:sendMessage", src, TranslateCap("item_crafted"))
giveCraftingLevel(xPlayer.identifier, Config.ExperiancePerCraft)
GiveCraftingLevel(xPlayer.identifier, Config.ExperiancePerCraft)
else
TriggerClientEvent("bpt_crafting:sendMessage", src, TranslateCap("inv_limit_exceed"))
end
Expand All @@ -137,13 +137,13 @@ end)
RegisterServerEvent("bpt_crafting:craft")
AddEventHandler("bpt_crafting:craft", function(item, retrying)
local src = source
craft(src, item, retrying)
Craft(src, item, retrying)
end)

ESX.RegisterServerCallback("bpt_crafting:getXP", function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)

cb(getCraftingLevel(xPlayer.identifier))
cb(GetCraftingLevel(xPlayer.identifier))
end)

ESX.RegisterServerCallback("bpt_crafting:getItemNames", function(_, cb)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function OpenShopMenu(elements, restoreCoords, shopCoords)

DeleteSpawnedVehicles()
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
SetEntityVisible(PlayerPedId(), true, true)

ESX.Game.Teleport(playerPed, restoreCoords)
elseif element3.value == "buy" then
Expand All @@ -253,7 +253,7 @@ function OpenShopMenu(elements, restoreCoords, shopCoords)
ESX.CloseContext()
DeleteSpawnedVehicles()
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
SetEntityVisible(PlayerPedId(), true, true)

ESX.Game.Teleport(playerPed, restoreCoords)
else
Expand All @@ -268,7 +268,7 @@ function OpenShopMenu(elements, restoreCoords, shopCoords)

DeleteSpawnedVehicles()
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
SetEntityVisible(PlayerPedId(), true, true)

ESX.Game.Teleport(playerPed, restoreCoords)
end)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if ESX.GetConfig().Multichar then
for i = 1, #keys do
EnableControlAction(0, keys[i], true)
end
SetEntityVisible(PlayerPedId(), 0, 0)
SetEntityVisible(PlayerPedId(), true, true)
SetLocalPlayerVisibleLocally(1)
SetPlayerInvincible(PlayerId(), 1)
ThefeedHideThisFrame()
Expand All @@ -72,7 +72,7 @@ if ESX.GetConfig().Multichar then
end
local playerId, playerPed = PlayerId(), PlayerPedId()
MumbleSetVolumeOverride(playerId, -1.0)
SetEntityVisible(playerPed, 1, 0)
SetEntityVisible(PlayerPedId(), true, true)
SetPlayerInvincible(playerId, 0)
FreezeEntityPosition(playerPed, false)
Wait(10000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ end

function Cutscene()
DoScreenFadeOut(100)

Wait(250)

local Male = GetHashKey("mp_m_freemode_01")

TriggerEvent("skinchanger:getSkin", function(skin)
if GetHashKey(GetEntityModel(PlayerPedId())) == Male then
local hash = GetEntityModel(PlayerPedId())
if hash == "mp_m_freemode_01" then
local clothesSkin = {
["tshirt_1"] = 20,
["tshirt_2"] = 15,
Expand Down Expand Up @@ -171,6 +168,6 @@ CreateThread(function()
SetBlipColour(blip, 49)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Boilingbroke Penitentiary")
AddTextComponentString("Penitentiary")
EndTextCommandSetBlipName(blip)
end)
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function CCTV(PropertyID)
FreezeEntityPosition(playerPed, true)
SetEntityCollision(playerPed, false, true)
local ShowButtons = true
SetEntityVisible(playerPed, false)
SetEntityVisible(PlayerPedId(), true, true)
SetTimecycleModifierStrength(2.0)
SetFocusArea(Property.Entrance.x, Property.Entrance.y, Property.Entrance.z, 0.0, 0.0, 0.0)
PointCamAtCoord(cctvcam, vector3(Property.Entrance.x, Property.Entrance.y, Property.Entrance.z + Config.CCTV.HeightAboveDoor))
Expand Down Expand Up @@ -246,7 +246,7 @@ function CCTV(PropertyID)
SetSeethrough(false)
SetEntityCollision(playerPed, true, true)
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
SetEntityVisible(PlayerPedId(), true, true)
Wait(1500)
DoScreenFadeIn(1000)
end
Expand Down
Loading

0 comments on commit 49d2dab

Please sign in to comment.