Skip to content

Commit

Permalink
Merge pull request #903 from bitpredator/dev
Browse files Browse the repository at this point in the history
fixes before the 1.0.2 release patch 1
  • Loading branch information
bitpredator authored Nov 29, 2024
2 parents a15a361 + 724d4da commit 91ebcf5
Show file tree
Hide file tree
Showing 141 changed files with 1,009 additions and 1,948 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---@diagnostic disable: undefined-global

local CurrentActionData, handcuffTimer, dragStatus, blipsCops, currentTask = {}, {}, {}, {}, {}
local HasAlreadyEnteredMarker, isDead, isHandcuffed, hasAlreadyJoined, playerInService = false, false, false, false, false
local LastStation, LastPart, LastPartNum, LastEntity, CurrentAction, CurrentActionMsg
Expand Down
2 changes: 2 additions & 0 deletions server-data/resources/[esx]/esx_menu_default/client/main.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---@diagnostic disable: undefined-global

local GUI, MenuType, OpenedMenus, CurrentNameSpace = {}, "default", 0, nil
GUI.Time = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ function OpenJailMenu()
})
end

ESX.UI.Menu.Open("default", GetCurrentResourceName(), "jailTranslateCapnjail_menu", {
ESX.UI.Menu.Open("default", GetCurrentResourceName(), "jail", TranslateCap("jail_menu"), {
title = "Unjail Player",
align = "center",
elements = elements,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ Citizen.CreateThread(function()
if IsControlJustReleased(0, Keys["F10"]) and IsInputDisabled(0) then
ToggleScoreBoard()
Citizen.Wait(200)

-- D-pad up on controllers works, too!
elseif IsControlJustReleased(0, 172) and not IsInputDisabled(0) then
ToggleScoreBoard()
Citizen.Wait(200)
Expand Down
190 changes: 93 additions & 97 deletions server-data/resources/[esx_addons]/esx_scoreboard/server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,150 +3,146 @@ local connectedPlayers = {}
ESX = exports["es_extended"]:getSharedObject()

ESX.RegisterServerCallback("esx_scoreboard:getConnectedPlayers", function(_, cb)
cb(connectedPlayers)
cb(connectedPlayers)
end)

AddEventHandler("esx:playerLoaded", function(_, xPlayer)
AddPlayerToScoreboard(xPlayer, true)
AddPlayerToScoreboard(xPlayer, true)
end)

AddEventHandler("esx:playerDropped", function(playerId)
connectedPlayers[playerId] = nil
connectedPlayers[playerId] = nil

TriggerClientEvent("esx_scoreboard:updateConnectedPlayers", -1, connectedPlayers)
TriggerClientEvent("esx_scoreboard:updateConnectedPlayers", -1, connectedPlayers)
end)

Citizen.CreateThread(function()
while true do
Citizen.Wait(5000)
UpdatePing()
end
while true do
Citizen.Wait(5000)
UpdatePing()
end
end)

AddEventHandler("onResourceStart", function(resource)
if resource == GetCurrentResourceName() then
Citizen.CreateThread(function()
Citizen.Wait(1000)
AddPlayersToScoreboard()
end)
end
if resource == GetCurrentResourceName() then
Citizen.CreateThread(function()
Citizen.Wait(1000)
AddPlayersToScoreboard()
end)
end
end)

function AddPlayerToScoreboard(xPlayer, update)
local playerId = xPlayer.source

connectedPlayers[playerId] = {}
connectedPlayers[playerId].ping = GetPlayerPing(playerId)
connectedPlayers[playerId].id = playerId
connectedPlayers[playerId].name = GetPlayerName(playerId)

if update then
TriggerClientEvent("esx_scoreboard:updateConnectedPlayers", -1, connectedPlayers)
end

if xPlayer.permission_level == 0 then
Citizen.CreateThread(function()
Citizen.Wait(3000)
TriggerClientEvent("esx_scoreboard:toggleID", playerId, false)
end)
end
local playerId = xPlayer.source

connectedPlayers[playerId] = {}
connectedPlayers[playerId].ping = GetPlayerPing(playerId)
connectedPlayers[playerId].id = playerId
connectedPlayers[playerId].name = GetPlayerName(playerId)

if update then
TriggerClientEvent("esx_scoreboard:updateConnectedPlayers", -1, connectedPlayers)
end

if xPlayer.permission_level == 0 then
Citizen.CreateThread(function()
Citizen.Wait(3000)
TriggerClientEvent("esx_scoreboard:toggleID", playerId, false)
end)
end
end

function AddPlayersToScoreboard()
local players = ESX.GetPlayers()
local players = ESX.GetPlayers()

for i = 1, #players, 1 do
local xPlayer = ESX.GetPlayerFromId(players[i])
AddPlayerToScoreboard(xPlayer, false)
end
for i = 1, #players, 1 do
local xPlayer = ESX.GetPlayerFromId(players[i])
AddPlayerToScoreboard(xPlayer, false)
end

TriggerClientEvent("esx_scoreboard:updateConnectedPlayers", -1, connectedPlayers)
TriggerClientEvent("esx_scoreboard:updateConnectedPlayers", -1, connectedPlayers)
end

function UpdatePing()
for k, v in pairs(connectedPlayers) do
v.ping = GetPlayerPing(k)
TriggerClientEvent("status:updatePing", k, v.ping)
end
TriggerClientEvent("esx_scoreboard:updatePing", -1, connectedPlayers)
for k, v in pairs(connectedPlayers) do
v.ping = GetPlayerPing(k)
TriggerClientEvent("status:updatePing", k, v.ping)
end
TriggerClientEvent("esx_scoreboard:updatePing", -1, connectedPlayers)
end

RegisterCommand("screfresh", function(source)
local xPlayer = ESX.GetPlayerFromId(source)
local xPlayer = ESX.GetPlayerFromId(source)

if xPlayer.getGroup() == "admin" or xPlayer.getGroup() == "admin" then
AddPlayersToScoreboard()
else
TriggerClientEvent("chatMessage", source, "[CONSOLE]", { 255, 0, 0 }, " ^0Shoma ^1Admin ^0nistid!")
end
if xPlayer.getGroup() == "admin" or xPlayer.getGroup() == "admin" then
AddPlayersToScoreboard()
else
TriggerClientEvent("chatMessage", source, "[CONSOLE]", { 255, 0, 0 }, " ^0Shoma ^1Admin ^0nistid!")
end
end, false)

RegisterCommand("sctoggle", function(source)
local xPlayer = ESX.GetPlayerFromId(source)
local xPlayer = ESX.GetPlayerFromId(source)

if xPlayer.getGroup() == "admin" or xPlayer.getGroup() == "admin" then
TriggerClientEvent("esx_scoreboard:toggleID", source)
else
TriggerClientEvent("chatMessage", source, "[CONSOLE]", { 255, 0, 0 }, " ^0Shoma ^1Admin ^0nistid!")
end
if xPlayer.getGroup() == "admin" or xPlayer.getGroup() == "admin" then
TriggerClientEvent("esx_scoreboard:toggleID", source)
else
TriggerClientEvent("chatMessage", source, "[CONSOLE]", { 255, 0, 0 }, " ^0Shoma ^1Admin ^0nistid!")
end
end, false)

-- Ping Kick
local limit = GetConvarInt("pingkick", 200)
local limit = GetConvarInt("pingkick", 600)
local checkInterval = GetConvarInt("pingkick_interval", 5000)
local warningStr = GetConvar("pingkick_warning", "Your ping is too high. Fix it. (%dms, Warning: %d/3)")
local reasonStr = GetConvar("pingkick_reason", "You were kicked for having a high ping. (%dms)")
local warningStr = GetConvar("pingkick_warning", "Il tuo ping è troppo alto. (%dms, Warning: %d/3)")
local reasonStr = GetConvar("pingkick_reason", "Sei stato espulso perché avevi un ping alto. (%dms)")

local pingHits = {}

print("Limit set to " .. limit)

local function CheckPing(player)
CreateThread(function()
if GetPlayerPed(player) == 0 then
return
end -- Don't do anything if player doesn't have a ped yet

local name = GetPlayerName(player)
local ping = GetPlayerPing(player)

if pingHits[player] == nil then
pingHits[player] = 0
end

if ping >= limit then
pingHits[player] = pingHits[player] + 1

print(name .. " was warned. (Ping: " .. ping .. "ms, Warning: " .. pingHits[player] .. "/3)")
TriggerClientEvent(
"chat:addMessage",
player,
{ args = { "Ping", warningStr:format(ping, pingHits[player]) } }
)
elseif pingHits[player] > 0 then
pingHits[player] = pingHits[player] - 1
end

if pingHits[player] == 3 then
pingHits[player] = 0

print(name .. " was kicked. (Ping: " .. ping .. "ms)")

DropPlayer(player, reasonStr:format(ping))
end
end)
CreateThread(function()
if GetPlayerPed(player) == 0 then
return
end -- Don't do anything if player doesn't have a ped yet

local name = GetPlayerName(player)
local ping = GetPlayerPing(player)

if pingHits[player] == nil then
pingHits[player] = 0
end

if ping >= limit then
pingHits[player] = pingHits[player] + 1

print(name .. " was warned. (Ping: " .. ping .. "ms, Warning: " .. pingHits[player] .. "/3)")
TriggerClientEvent("chat:addMessage", player, { args = { "Ping", warningStr:format(ping, pingHits[player]) } })
elseif pingHits[player] > 0 then
pingHits[player] = pingHits[player] - 1
end

if pingHits[player] == 3 then
pingHits[player] = 0

print(name .. " was kicked. (Ping: " .. ping .. "ms)")

DropPlayer(player, reasonStr:format(ping))
end
end)
end

CreateThread(function() -- Loop trough all players and check their pings
while true do
for _, player in ipairs(GetPlayers()) do
CheckPing(player)
end
while true do
for _, player in ipairs(GetPlayers()) do
CheckPing(player)
end

Wait(checkInterval)
end
Wait(checkInterval)
end
end)

AddEventHandler("playerDropped", function()
pingHits[source] = 0
pingHits[source] = 0
end)
27 changes: 27 additions & 0 deletions server-data/resources/[maps]/int_prisonfull/client.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
RegisterCommand("alarm_on", function(source, args, rawCommand)
local alarmIpl = GetInteriorAtCoordsWithType(1787.004,2593.1984,45.7978,"int_prison_main")

RefreshInterior(alarmIpl)
EnableInteriorProp(alarmIpl, "prison_alarm")

Citizen.CreateThread(function()
while not PrepareAlarm("PRISON_ALARMS") do
Citizen.Wait(100)
end
StartAlarm("PRISON_ALARMS", true)
end)
end, false)

RegisterCommand("alarm_off", function(source, args, rawCommand)
local alarmIpl = GetInteriorAtCoordsWithType(1787.004,2593.1984,45.7978,"int_prison_main")

RefreshInterior(alarmIpl)
DisableInteriorProp(alarmIpl, "prison_alarm")

Citizen.CreateThread(function()
while not PrepareAlarm("PRISON_ALARMS") do
Citizen.Wait(100)
end
StopAllAlarms(true)
end)
end, false)
5 changes: 5 additions & 0 deletions server-data/resources/[maps]/int_prisonfull/fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fx_version("adamant")
game("gta5")
this_is_a_map("yes")
version("1.0.2")
client_script 'client.lua'
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions server-data/resources/[maps]/prisonprops/fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fx_version("adamant")
game("gta5")
this_is_a_map("yes")
version("1.0.2")
data_file('DLC_ITYP_REQUEST')('stream/prison_props.ytyp')

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions server-data/resources/[ox]/ox_inventory/data/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -434,13 +434,13 @@ return {

["potato"] = {
label = "Patate",
weight = 100,
weight = 20,
stack = true,
},

["chips"] = {
label = "Patatine fritte",
weight = 100,
weight = 25,
stack = true,
},

Expand Down Expand Up @@ -547,7 +547,7 @@ return {

["grain"] = {
label = "grano",
weight = 100,
weight = 5,
stack = true,
},

Expand Down
2 changes: 1 addition & 1 deletion server-data/resources/[ox]/ox_lib/fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aw

name 'ox_lib'
author 'Overextended'
version '3.26.0'
version '3.27.0'
license 'LGPL-3.0-or-later'
repository 'https://github.com/overextended/ox_lib'
description 'A library of shared functions to utilise in other resources.'
Expand Down
Loading

0 comments on commit 91ebcf5

Please sign in to comment.