Skip to content

Commit

Permalink
Merge pull request #812 from bitpredator/dev
Browse files Browse the repository at this point in the history
chore: various fixes
  • Loading branch information
bitpredator authored Sep 2, 2024
2 parents 379a939 + d3cd143 commit e44ec79
Show file tree
Hide file tree
Showing 15 changed files with 301 additions and 301 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-unused-vars
let timeout;
let opened;
let recipes;
Expand Down Expand Up @@ -101,6 +102,7 @@ function openCategory() {

}

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

$('#main').html('');
Expand Down Expand Up @@ -285,6 +287,7 @@ 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 @@ -296,9 +299,11 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const lastClick = 0;
function getRandomQuestion() {
let random = Math.floor(Math.random() * nbPossibleQuestions);

// eslint-disable-next-line no-constant-condition
while (true) {
if (questionUsed.indexOf(random) === -1) {
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ DrawText3D = function(x, y, z, text)
if onScreen then
SetTextScale(scale, scale)
SetTextFont(4)
SetTextProportional(1)
SetTextProportional(true)
SetTextColour(255, 255, 255, 215)
SetTextOutline()
SetTextEntry("STRING")
SetTextCentre(1)
SetTextCentre(true)
AddTextComponentString(text)
DrawText(_x, _y)
local _ = (string.len(text)) / 650
Expand Down
12 changes: 6 additions & 6 deletions server-data/resources/[bpt_addons]/bpt_hunting/client/main.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ESX = exports["es_extended"]:getSharedObject()

local oPlayer, playerpos = false, false
local oPlayer = false

CreateThread(function()
while true do
oPlayer = PlayerPedId()
playerpos = GetEntityCoords(oPlayer)
OPlayer = PlayerPedId()
Playerpos = GetEntityCoords(oPlayer)
Wait(500)
end
end)
Expand All @@ -18,7 +18,7 @@ CreateThread(function()
repeat
success, ped = FindNextPed(handle)
local pos = GetEntityCoords(ped)
local distance = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, playerpos.x, playerpos.y, playerpos.z, true)
local distance = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, Playerpos.x, Playerpos.y, Playerpos.z, true)
if distance < 2 and CanSlaughterPed(ped) then
DrawText3D(pos.x, pos.y, pos.z + 0.6, "[H] ~b~Skin Animal ~s~")
while IsControlPressed(0, 30) do
Expand All @@ -27,8 +27,8 @@ CreateThread(function()
if IsControlJustPressed(1, 74) then
if GetSelectedPedWeapon(PlayerPedId()) == GetHashKey("WEAPON_KNIFE") then
local oldped = ped
SetEntityHeading(ped, GetHeadingFromVector_2d(pos.x - playerpos.x - playerpos.y) + 180)
SetEntityHeading(oPlayer, GetHeadingFromVector_2d(pos.x - playerpos.x, pos.y - playerpos.y))
SetEntityHeading(ped, GetHeadingFromVector_2d(pos.x - Playerpos.x - Playerpos.y) + 180)
SetEntityHeading(OPlayer, GetHeadingFromVector_2d(pos.x - Playerpos.x, pos.y - Playerpos.y))

exports.rprogress:Custom({
Async = true,
Expand Down
35 changes: 19 additions & 16 deletions server-data/resources/[esx]/vSync/server/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ AddEventHandler("vSync:requestSync", function()
TriggerClientEvent("vSync:updateTime", -1, baseTime, timeOffset, freezeTime)
end)

function isAllowedToChange(player)
function IsAllowedToChange(player)
if Config.AdminById then
for k, v in ipairs(Config.Admins) do
for k2, v2 in ipairs(GetPlayerIdentifiers(player)) do
for _, v in ipairs(Config.Admins) do
for _, v2 in ipairs(GetPlayerIdentifiers(player)) do
if string.lower(v2) == string.lower(v) then
return true
end
end
end
else
for k, v in ipairs(Config.Ace) do
for _, v in ipairs(Config.Ace) do
if IsPlayerAceAllowed(player, v) then
return true
end
Expand All @@ -30,9 +30,9 @@ function isAllowedToChange(player)
return false
end

RegisterCommand("freezetime", function(source, args)
RegisterCommand("freezetime", function(source)
if source ~= 0 then
if isAllowedToChange(source) then
if IsAllowedToChange(source) then
freezeTime = not freezeTime
if freezeTime then
TriggerClientEvent("vSync:notify", source, _U("time_frozenc"))
Expand All @@ -54,7 +54,7 @@ end)

RegisterCommand("freezeweather", function(source, args)
if source ~= 0 then
if isAllowedToChange(source) then
if IsAllowedToChange(source) then
Config.DynamicWeather = not Config.DynamicWeather
if not Config.DynamicWeather then
TriggerClientEvent("vSync:notify", source, _U("dynamic_weather_disabled"))
Expand All @@ -81,7 +81,7 @@ RegisterCommand("weather", function(source, args)
print(_U("weather_invalid_syntax"))
return
else
for i, wtype in ipairs(Config.AvailableWeatherTypes) do
for _, wtype in ipairs(Config.AvailableWeatherTypes) do
if wtype == string.upper(args[1]) then
validWeatherType = true
end
Expand All @@ -96,12 +96,12 @@ RegisterCommand("weather", function(source, args)
end
end
else
if isAllowedToChange(source) then
if IsAllowedToChange(source) then
local validWeatherType = false
if args[1] == nil then
TriggerClientEvent("chatMessage", source, "", { 255, 255, 255 }, _U("weather_invalid_syntaxc"))
else
for i, wtype in ipairs(Config.AvailableWeatherTypes) do
for _, wtype in ipairs(Config.AvailableWeatherTypes) do
if wtype == string.upper(args[1]) then
validWeatherType = true
end
Expand Down Expand Up @@ -131,7 +131,7 @@ RegisterCommand("blackout", function(source)
print(_U("blackout_disabled"))
end
else
if isAllowedToChange(source) then
if IsAllowedToChange(source) then
blackout = not blackout
if blackout then
TriggerClientEvent("vSync:notify", source, _U("blackout_enabledc"))
Expand All @@ -148,43 +148,46 @@ RegisterCommand("morning", function(source)
print(_U("time_console"))
return
end
if isAllowedToChange(source) then
if IsAllowedToChange(source) then
ShiftToMinute(0)
ShiftToHour(9)
TriggerClientEvent("vSync:notify", source, _U("time_morning"))
TriggerEvent("vSync:requestSync")
end
end)

RegisterCommand("noon", function(source)
if source == 0 then
print(_U("time_console"))
return
end
if isAllowedToChange(source) then
if IsAllowedToChange(source) then
ShiftToMinute(0)
ShiftToHour(12)
TriggerClientEvent("vSync:notify", source, _U("time_noon"))
TriggerEvent("vSync:requestSync")
end
end)

RegisterCommand("evening", function(source)
if source == 0 then
print(_U("time_console"))
return
end
if isAllowedToChange(source) then
if IsAllowedToChange(source) then
ShiftToMinute(0)
ShiftToHour(18)
TriggerClientEvent("vSync:notify", source, _U("time_evening"))
TriggerEvent("vSync:requestSync")
end
end)

RegisterCommand("night", function(source)
if source == 0 then
print(_U("time_console"))
return
end
if isAllowedToChange(source) then
if IsAllowedToChange(source) then
ShiftToMinute(0)
ShiftToHour(23)
TriggerClientEvent("vSync:notify", source, _U("time_night"))
Expand All @@ -200,7 +203,7 @@ function ShiftToHour(hour)
timeOffset = timeOffset - ((((baseTime + timeOffset) / 60) % 24) - hour) * 60
end

RegisterCommand("time", function(source, args, rawCommand)
RegisterCommand("time", function(source, args)
if source == 0 then
if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then
local argh = tonumber(args[1])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
--- CrazyFox Discord Channel: https://discord.gg/4E8sth5
local Keys = {
["ESC"] = 322,
["F1"] = 288,
Expand Down
Loading

0 comments on commit e44ec79

Please sign in to comment.