diff --git a/server-data/resources/[bpt_addons]/bpt_streetfight/client/client.lua b/server-data/resources/[bpt_addons]/bpt_streetfight/client/client.lua index 8d8259a98..fe0aec30a 100644 --- a/server-data/resources/[bpt_addons]/bpt_streetfight/client/client.lua +++ b/server-data/resources/[bpt_addons]/bpt_streetfight/client/client.lua @@ -16,287 +16,377 @@ local winner = nil ESX = exports["es_extended"]:getSharedObject() CreateThread(function() - CreateBlip(Config.BLIP.coords, Config.BLIP.text, Config.BLIP.sprite, Config.BLIP.color, Config.BLIP.scale) - RunThread() + CreateBlip(Config.BLIP.coords, Config.BLIP.text, Config.BLIP.sprite, Config.BLIP.color, Config.BLIP.scale) + RunThread() end) RegisterNetEvent("bpt_streetfight:playerJoined") AddEventHandler("bpt_streetfight:playerJoined", function(side, id) - if side == 1 then - blueJoined = true - else - redJoined = true - end + if side == 1 then + blueJoined = true + else + redJoined = true + end - if id == GetPlayerServerId(PlayerId()) then - participating = true - putGloves() - end - players = players + 1 - fightStatus = STATUS_JOINED + if id == GetPlayerServerId(PlayerId()) then + participating = true + putGloves() + end + players = players + 1 + fightStatus = STATUS_JOINED end) RegisterNetEvent("bpt_streetfight:startFight") AddEventHandler("bpt_streetfight:startFight", function(fightData) - for _, value in ipairs(fightData) do - if value.id ~= GetPlayerServerId(PlayerId()) then - rival = value.id - elseif value.id == GetPlayerServerId(PlayerId()) then - participating = true - end - end + for _, value in ipairs(fightData) do + if value.id ~= GetPlayerServerId(PlayerId()) then + rival = value.id + elseif value.id == GetPlayerServerId(PlayerId()) then + participating = true + end + end - fightStatus = STATUS_STARTED - showCountDown = true - countdown() + fightStatus = STATUS_STARTED + showCountDown = true + countdown() end) RegisterNetEvent("bpt_streetfight:playerLeaveFight") AddEventHandler("bpt_streetfight:playerLeaveFight", function(id) - if id == GetPlayerServerId(PlayerId()) then - ESX.ShowNotification(_U("you_toofar")) - SetPedMaxHealth(PlayerPedId(), 200) - SetEntityHealth(PlayerPedId(), 200) - removeGloves() - elseif participating == true then - TriggerServerEvent("bpt_streetfight:pay", betAmount) - ESX.ShowNotification(_U("you_win") .. (betAmount * 2) .. "$") - SetPedMaxHealth(PlayerPedId(), 200) - SetEntityHealth(PlayerPedId(), 200) - removeGloves() - end - reset() + if id == GetPlayerServerId(PlayerId()) then + ESX.ShowNotification(_U("you_toofar")) + SetPedMaxHealth(PlayerPedId(), 200) + SetEntityHealth(PlayerPedId(), 200) + removeGloves() + elseif participating == true then + TriggerServerEvent("bpt_streetfight:pay", betAmount) + ESX.ShowNotification(_U("you_win") .. (betAmount * 2) .. "$") + SetPedMaxHealth(PlayerPedId(), 200) + SetEntityHealth(PlayerPedId(), 200) + removeGloves() + end + reset() end) RegisterNetEvent("bpt_streetfight:fightFinished") AddEventHandler("bpt_streetfight:fightFinished", function(looser) - if participating == true then - if looser ~= GetPlayerServerId(PlayerId()) and looser ~= -2 then - TriggerServerEvent("bpt_streetfight:pay", betAmount) - ESX.ShowNotification(_U("you_win") .. (betAmount * 2) .. "$") - SetPedMaxHealth(PlayerPedId(), 200) - SetEntityHealth(PlayerPedId(), 200) + if participating == true then + if looser ~= GetPlayerServerId(PlayerId()) and looser ~= -2 then + TriggerServerEvent("bpt_streetfight:pay", betAmount) + ESX.ShowNotification(_U("you_win") .. (betAmount * 2) .. "$") + SetPedMaxHealth(PlayerPedId(), 200) + SetEntityHealth(PlayerPedId(), 200) - TriggerServerEvent("bpt_streetfight:showWinner", GetPlayerServerId(PlayerId())) - end + TriggerServerEvent("bpt_streetfight:showWinner", GetPlayerServerId(PlayerId())) + end - if looser == GetPlayerServerId(PlayerId()) and looser ~= -2 then - ESX.ShowNotification(_U("you_lost") .. betAmount .. "$") - SetPedMaxHealth(PlayerPedId(), 200) - SetEntityHealth(PlayerPedId(), 200) - end + if looser == GetPlayerServerId(PlayerId()) and looser ~= -2 then + ESX.ShowNotification(_U("you_lost") .. betAmount .. "$") + SetPedMaxHealth(PlayerPedId(), 200) + SetEntityHealth(PlayerPedId(), 200) + end - if looser == -2 then - ESX.ShowNotification(_U("time_out")) - SetPedMaxHealth(PlayerPedId(), 200) - SetEntityHealth(PlayerPedId(), 200) - end + if looser == -2 then + ESX.ShowNotification(_U("time_out")) + SetPedMaxHealth(PlayerPedId(), 200) + SetEntityHealth(PlayerPedId(), 200) + end - removeGloves() - end - reset() + removeGloves() + end + reset() end) RegisterNetEvent("bpt_streetfight:raiseActualBet") AddEventHandler("bpt_streetfight:raiseActualBet", function() - betAmount = betAmount * 2 - if betAmount == 0 then - betAmount = 2000 - elseif betAmount > 100000 then - betAmount = 0 - end + betAmount = betAmount * 2 + if betAmount == 0 then + betAmount = 2000 + elseif betAmount > 100000 then + betAmount = 0 + end end) RegisterNetEvent("bpt_streetfight:winnerText") AddEventHandler("bpt_streetfight:winnerText", function(id) - showWinner = true - winner = id - Wait(5000) - showWinner = false - winner = nil + showWinner = true + winner = id + Wait(5000) + showWinner = false + winner = nil end) local actualCount = 0 function countdown() - for i = 5, 0, -1 do - actualCount = i - Wait(1000) - end - showCountDown = false - actualCount = 0 + for i = 5, 0, -1 do + actualCount = i + Wait(1000) + end + showCountDown = false + actualCount = 0 - if participating == true then - SetPedMaxHealth(PlayerPedId(), 500) - SetEntityHealth(PlayerPedId(), 500) - end + if participating == true then + SetPedMaxHealth(PlayerPedId(), 500) + SetEntityHealth(PlayerPedId(), 500) + end end function putGloves() - local ped = GetPlayerPed(-1) - local hash = GetHashKey("prop_boxing_glove_01") - while not HasModelLoaded(hash) do - RequestModel(hash) - Wait(0) - end - local pos = GetEntityCoords(ped) - local gloveA = CreateObject(hash, pos.x, pos.y, pos.z + 0.50, true, false, false) - local gloveB = CreateObject(hash, pos.x, pos.y, pos.z + 0.50, true, false, false) - table.insert(Gloves, gloveA) - table.insert(Gloves, gloveB) - SetModelAsNoLongerNeeded(hash) - FreezeEntityPosition(gloveA, false) - SetEntityCollision(gloveA, false, true) - ActivatePhysics(gloveA) - FreezeEntityPosition(gloveB, false) - SetEntityCollision(gloveB, false, true) - ActivatePhysics(gloveB) - if not ped then - ped = GetPlayerPed(-1) - end -- gloveA = L, gloveB = R - AttachEntityToEntity(gloveA, ped, GetPedBoneIndex(ped, 0xEE4F), 0.05, 0.00, 0.04, 00.0, 90.0, -90.0, true, true, false, true, 1, true) -- object is attached to right hand - AttachEntityToEntity(gloveB, ped, GetPedBoneIndex(ped, 0xAB22), 0.05, 0.00, -0.04, 00.0, 90.0, 90.0, true, true, false, true, 1, true) -- object is attached to right hand + local ped = GetPlayerPed(-1) + local hash = GetHashKey("prop_boxing_glove_01") + while not HasModelLoaded(hash) do + RequestModel(hash) + Wait(0) + end + local pos = GetEntityCoords(ped) + local gloveA = CreateObject(hash, pos.x, pos.y, pos.z + 0.50, true, false, false) + local gloveB = CreateObject(hash, pos.x, pos.y, pos.z + 0.50, true, false, false) + table.insert(Gloves, gloveA) + table.insert(Gloves, gloveB) + SetModelAsNoLongerNeeded(hash) + FreezeEntityPosition(gloveA, false) + SetEntityCollision(gloveA, false, true) + ActivatePhysics(gloveA) + FreezeEntityPosition(gloveB, false) + SetEntityCollision(gloveB, false, true) + ActivatePhysics(gloveB) + if not ped then + ped = GetPlayerPed(-1) + end -- gloveA = L, gloveB = R + AttachEntityToEntity( + gloveA, + ped, + GetPedBoneIndex(ped, 0xEE4F), + 0.05, + 0.00, + 0.04, + 00.0, + 90.0, + -90.0, + true, + true, + false, + true, + 1, + true + ) -- object is attached to right hand + AttachEntityToEntity( + gloveB, + ped, + GetPedBoneIndex(ped, 0xAB22), + 0.05, + 0.00, + -0.04, + 00.0, + 90.0, + 90.0, + true, + true, + false, + true, + 1, + true + ) -- object is attached to right hand end function removeGloves() - for _, v in pairs(Gloves) do - DeleteObject(v) - end + for _, v in pairs(Gloves) do + DeleteObject(v) + end end function spawnMarker(coords) - local centerRing = GetDistanceBetweenCoords(coords, vector3(-517.61, -1712.04, 20.46), true) - if centerRing < Config.DISTANCE and fightStatus ~= STATUS_STARTED then - DrawMarker(1, Config.BETZONE.x, Config.BETZONE.y, Config.BETZONE.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 1.5, 1.5, 1.0, 204, 204, 0, 100, false, true, 2, false, false, false, false) - DrawText3D(Config.CENTER.x, Config.CENTER.y, Config.CENTER.z + 1.5, "Giocatori: ~r~" .. players .. "/2 \n ~w~Scommessa: ~r~" .. betAmount .. "$ ", 0.8) - local blueZone = GetDistanceBetweenCoords(coords, vector3(Config.BLUEZONE.x, Config.BLUEZONE.y, Config.BLUEZONE.z), true) - local redZone = GetDistanceBetweenCoords(coords, vector3(Config.REDZONE.x, Config.REDZONE.y, Config.REDZONE.z), true) - local betZone = GetDistanceBetweenCoords(coords, vector3(Config.BETZONE.x, Config.BETZONE.y, Config.BETZONE.z), true) + local centerRing = GetDistanceBetweenCoords(coords, vector3(-517.61, -1712.04, 20.46), true) + if centerRing < Config.DISTANCE and fightStatus ~= STATUS_STARTED then + DrawMarker( + 1, + Config.BETZONE.x, + Config.BETZONE.y, + Config.BETZONE.z, + 0.0, + 0.0, + 0.0, + 0, + 0.0, + 0.0, + 1.5, + 1.5, + 1.0, + 204, + 204, + 0, + 100, + false, + true, + 2, + false, + false, + false, + false + ) + DrawText3D( + Config.CENTER.x, + Config.CENTER.y, + Config.CENTER.z + 1.5, + "Giocatori: ~r~" .. players .. "/2 \n ~w~Scommessa: ~r~" .. betAmount .. "$ ", + 0.8 + ) + local blueZone = + GetDistanceBetweenCoords(coords, vector3(Config.BLUEZONE.x, Config.BLUEZONE.y, Config.BLUEZONE.z), true) + local redZone = + GetDistanceBetweenCoords(coords, vector3(Config.REDZONE.x, Config.REDZONE.y, Config.REDZONE.z), true) + local betZone = + GetDistanceBetweenCoords(coords, vector3(Config.BETZONE.x, Config.BETZONE.y, Config.BETZONE.z), true) - if blueJoined == false then - DrawText3D(Config.BLUEZONE.x, Config.BLUEZONE.y, Config.BLUEZONE.z + 1.5, "unisciti alla lotta [~b~E~w~]", 0.4) - if blueZone < Config.DISTANCE_INTERACTION then - ESX.ShowHelpNotification(_U("press_to_join_blue")) - if IsControlJustReleased(0, Config.E_KEY) and participating == false then - TriggerServerEvent("bpt_streetfight:join", betAmount, 0) - end - end - end + if blueJoined == false then + DrawText3D( + Config.BLUEZONE.x, + Config.BLUEZONE.y, + Config.BLUEZONE.z + 1.5, + "unisciti alla lotta [~b~E~w~]", + 0.4 + ) + if blueZone < Config.DISTANCE_INTERACTION then + ESX.ShowHelpNotification(_U("press_to_join_blue")) + if IsControlJustReleased(0, Config.E_KEY) and participating == false then + TriggerServerEvent("bpt_streetfight:join", betAmount, 0) + end + end + end - if redJoined == false then - DrawText3D(Config.REDZONE.x, Config.REDZONE.y, Config.REDZONE.z + 1.5, "unisciti alla lotta [~r~E~w~]", 0.4) - if redZone < Config.DISTANCE_INTERACTION then - ESX.ShowHelpNotification(_U("press_to_join_red")) - if IsControlJustReleased(0, Config.E_KEY) and participating == false then - TriggerServerEvent("bpt_streetfight:join", betAmount, 1) - end - end - end + if redJoined == false then + DrawText3D(Config.REDZONE.x, Config.REDZONE.y, Config.REDZONE.z + 1.5, "unisciti alla lotta [~r~E~w~]", 0.4) + if redZone < Config.DISTANCE_INTERACTION then + ESX.ShowHelpNotification(_U("press_to_join_red")) + if IsControlJustReleased(0, Config.E_KEY) and participating == false then + TriggerServerEvent("bpt_streetfight:join", betAmount, 1) + end + end + end - if betZone < Config.DISTANCE_INTERACTION and fightStatus ~= STATUS_JOINED and fightStatus ~= STATUS_STARTED then - ESX.ShowHelpNotification("premi ~INPUT_CONTEXT~ per cambiare la scommessa.") - if IsControlJustReleased(0, Config.E_KEY) then - TriggerServerEvent("bpt_streetfight:raiseBet", betAmount) - end - end - end + if betZone < Config.DISTANCE_INTERACTION and fightStatus ~= STATUS_JOINED and fightStatus ~= STATUS_STARTED then + ESX.ShowHelpNotification("premi ~INPUT_CONTEXT~ per cambiare la scommessa.") + if IsControlJustReleased(0, Config.E_KEY) then + TriggerServerEvent("bpt_streetfight:raiseBet", betAmount) + end + end + end end function get3DDistance(x1, y1, z1, x2, y2, z2) - local a = (x1 - x2) * (x1 - x2) - local b = (y1 - y2) * (y1 - y2) - local c = (z1 - z2) * (z1 - z2) - return math.sqrt(a + b + c) + local a = (x1 - x2) * (x1 - x2) + local b = (y1 - y2) * (y1 - y2) + local c = (z1 - z2) * (z1 - z2) + return math.sqrt(a + b + c) end function DrawText3D(x, y, z, text, scale) - local _, _x, _y = World3dToScreen2d(x, y, z) - local _, _, _ = table.unpack(GetGameplayCamCoords()) - SetTextScale(scale, scale) - SetTextFont(4) - SetTextProportional(1) - SetTextEntry("STRING") - SetTextCentre(1) - SetTextColour(255, 255, 255, 215) - AddTextComponentString(text) - DrawText(_x, _y) + local _, _x, _y = World3dToScreen2d(x, y, z) + local _, _, _ = table.unpack(GetGameplayCamCoords()) + SetTextScale(scale, scale) + SetTextFont(4) + SetTextProportional(1) + SetTextEntry("STRING") + SetTextCentre(1) + SetTextColour(255, 255, 255, 215) + AddTextComponentString(text) + DrawText(_x, _y) end function CreateBlip(coords, text, sprite, color, scale) - local blip = AddBlipForCoord(coords.x, coords.y) - SetBlipSprite(blip, sprite) - SetBlipScale(blip, scale) - SetBlipColour(blip, color) - SetBlipAsShortRange(blip, true) - BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName(text) - EndTextCommandSetBlipName(blip) + local blip = AddBlipForCoord(coords.x, coords.y) + SetBlipSprite(blip, sprite) + SetBlipScale(blip, scale) + SetBlipColour(blip, color) + SetBlipAsShortRange(blip, true) + BeginTextCommandSetBlipName("STRING") + AddTextComponentSubstringPlayerName(text) + EndTextCommandSetBlipName(blip) end function reset() - redJoined = false - blueJoined = false - participating = false - players = 0 - fightStatus = STATUS_INITIAL + redJoined = false + blueJoined = false + participating = false + players = 0 + fightStatus = STATUS_INITIAL end function RunThread() - CreateThread(function() - while true do - Wait(0) - local coords = GetEntityCoords(PlayerPedId()) - spawnMarker(coords) - end - end) + CreateThread(function() + while true do + Wait(0) + local coords = GetEntityCoords(PlayerPedId()) + spawnMarker(coords) + end + end) end -- Alejar player - 1000 loop CreateThread(function() - while true do - if fightStatus == STATUS_STARTED and participating == false and GetEntityCoords(PlayerPedId()) ~= rival then - local coords = GetEntityCoords(GetPlayerPed(-1)) - if get3DDistance(Config.CENTER.x, Config.CENTER.y, Config.CENTER.z, coords.x, coords.y, coords.z) < Config.TP_DISTANCE then - ESX.ShowNotification(_U("step_away")) - for _ = 1, 1000 do - SetPedCoordsKeepVehicle(GetPlayerPed(-1), -521.58, -1723.58, 19.16) - local foundGround = GetGroundZFor_3dCoord(-521.58, -1723.58, 19.16) - if foundGround then - SetPedCoordsKeepVehicle(GetPlayerPed(_), -521.58, -1723.58, 19.16) - break - end - Wait(5) - end - end - end - Wait(1000) - end + while true do + if fightStatus == STATUS_STARTED and participating == false and GetEntityCoords(PlayerPedId()) ~= rival then + local coords = GetEntityCoords(GetPlayerPed(-1)) + if + get3DDistance(Config.CENTER.x, Config.CENTER.y, Config.CENTER.z, coords.x, coords.y, coords.z) + < Config.TP_DISTANCE + then + ESX.ShowNotification(_U("step_away")) + for _ = 1, 1000 do + SetPedCoordsKeepVehicle(GetPlayerPed(-1), -521.58, -1723.58, 19.16) + local foundGround = GetGroundZFor_3dCoord(-521.58, -1723.58, 19.16) + if foundGround then + SetPedCoordsKeepVehicle(GetPlayerPed(_), -521.58, -1723.58, 19.16) + break + end + Wait(5) + end + end + end + Wait(1000) + end end) -- Main 0 loop CreateThread(function() - while true do - Wait(0) - if showCountDown == true then - DrawText3D(Config.CENTER.x, Config.CENTER.y, Config.CENTER.z + 1.5, "La lotta inizia in: " .. actualCount, 2.0) - elseif showCountDown == false and fightStatus == STATUS_STARTED then - if GetEntityHealth(PlayerPedId()) < 150 then - TriggerServerEvent("bpt_streetfight:finishFight", GetPlayerServerId(PlayerId())) - fightStatus = STATUS_INITIAL - end - end + while true do + Wait(0) + if showCountDown == true then + DrawText3D( + Config.CENTER.x, + Config.CENTER.y, + Config.CENTER.z + 1.5, + "La lotta inizia in: " .. actualCount, + 2.0 + ) + elseif showCountDown == false and fightStatus == STATUS_STARTED then + if GetEntityHealth(PlayerPedId()) < 150 then + TriggerServerEvent("bpt_streetfight:finishFight", GetPlayerServerId(PlayerId())) + fightStatus = STATUS_INITIAL + end + end - if participating == true then - local coords = GetEntityCoords(GetPlayerPed(-1)) - if get3DDistance(Config.CENTER.x, Config.CENTER.y, Config.CENTER.z, coords.x, coords.y, coords.z) > Config.LEAVE_FIGHT_DISTANCE then - TriggerServerEvent("bpt_streetfight:leaveFight", GetPlayerServerId(PlayerId())) - end - end + if participating == true then + local coords = GetEntityCoords(GetPlayerPed(-1)) + if + get3DDistance(Config.CENTER.x, Config.CENTER.y, Config.CENTER.z, coords.x, coords.y, coords.z) + > Config.LEAVE_FIGHT_DISTANCE + then + TriggerServerEvent("bpt_streetfight:leaveFight", GetPlayerServerId(PlayerId())) + end + end - if showWinner == true and winner ~= nil then - local coords = GetEntityCoords(GetPlayerPed(-1)) - if get3DDistance(Config.CENTER.x, Config.CENTER.y, Config.CENTER.z, coords.x, coords.y, coords.z) < 15 then - DrawText3D(Config.CENTER.x, Config.CENTER.y, Config.CENTER.z + 2.5, "~r~ID: " .. winner .. " gana!", 2.0) - end - end - end + if showWinner == true and winner ~= nil then + local coords = GetEntityCoords(GetPlayerPed(-1)) + if get3DDistance(Config.CENTER.x, Config.CENTER.y, Config.CENTER.z, coords.x, coords.y, coords.z) < 15 then + DrawText3D( + Config.CENTER.x, + Config.CENTER.y, + Config.CENTER.z + 2.5, + "~r~ID: " .. winner .. " gana!", + 2.0 + ) + end + end + end end) diff --git a/server-data/resources/[bpt_addons]/bpt_streetfight/config.lua b/server-data/resources/[bpt_addons]/bpt_streetfight/config.lua index 1f69848d3..f8f1958a6 100644 --- a/server-data/resources/[bpt_addons]/bpt_streetfight/config.lua +++ b/server-data/resources/[bpt_addons]/bpt_streetfight/config.lua @@ -12,9 +12,9 @@ Config.E_KEY = 38 -- Action key 'E' default Config.Locale = "en" Config.BLIP = { - coords = { x = -517.61, y = -1712.04, z = 20.45 }, - text = _U("street_fighting"), - sprite = 491, - color = 1, - scale = 1.0, + coords = { x = -517.61, y = -1712.04, z = 20.45 }, + text = _U("street_fighting"), + sprite = 491, + color = 1, + scale = 1.0, } diff --git a/server-data/resources/[bpt_addons]/bpt_streetfight/fxmanifest.lua b/server-data/resources/[bpt_addons]/bpt_streetfight/fxmanifest.lua index 9b3dad7d3..48a46a32e 100644 --- a/server-data/resources/[bpt_addons]/bpt_streetfight/fxmanifest.lua +++ b/server-data/resources/[bpt_addons]/bpt_streetfight/fxmanifest.lua @@ -4,22 +4,22 @@ game("gta5") description("bpt_streetfight") -version("1.0.0") +version("1.0.1") server_script({ - "@es_extended/locale.lua", - "server/server.lua", - "locales/*.lua", - "config.lua", + "@es_extended/locale.lua", + "server/server.lua", + "locales/*.lua", + "config.lua", }) client_script({ - "@es_extended/locale.lua", - "client/client.lua", - "locales/*.lua", - "config.lua", + "@es_extended/locale.lua", + "client/client.lua", + "locales/*.lua", + "config.lua", }) dependencies({ - "es_extended", + "es_extended", }) diff --git a/server-data/resources/[bpt_addons]/bpt_streetfight/locales/en.lua b/server-data/resources/[bpt_addons]/bpt_streetfight/locales/en.lua index 73d9126ce..01051ba6c 100644 --- a/server-data/resources/[bpt_addons]/bpt_streetfight/locales/en.lua +++ b/server-data/resources/[bpt_addons]/bpt_streetfight/locales/en.lua @@ -1,12 +1,12 @@ Locales["en"] = { - ["you_toofar"] = "you've gone too far", - ["you_win"] = "You have won the fight", - ["you_lost"] = "You have lost the fight", - ["time out"] = "The fight is over due to time limit", - ["step_away"] = "step away from the ring", - ["successfully_signed"] = "you have successfully signed up", - ["not_money"] = "not enough money", - ["press_to_join_blue"] = "press ~INPUT_CONTEXT~ to join the blue side", - ["press_to_join_red"] = "press ~INPUT_CONTEXT~ to join the red side.", - ["street_fighting"] = "Street fighting", + ["you_toofar"] = "you've gone too far", + ["you_win"] = "You have won the fight", + ["you_lost"] = "You have lost the fight", + ["time out"] = "The fight is over due to time limit", + ["step_away"] = "step away from the ring", + ["successfully_signed"] = "you have successfully signed up", + ["not_money"] = "not enough money", + ["press_to_join_blue"] = "press ~INPUT_CONTEXT~ to join the blue side", + ["press_to_join_red"] = "press ~INPUT_CONTEXT~ to join the red side.", + ["street_fighting"] = "Street fighting", } diff --git a/server-data/resources/[bpt_addons]/bpt_streetfight/locales/it.lua b/server-data/resources/[bpt_addons]/bpt_streetfight/locales/it.lua index 21cf98c8b..7e04f0323 100644 --- a/server-data/resources/[bpt_addons]/bpt_streetfight/locales/it.lua +++ b/server-data/resources/[bpt_addons]/bpt_streetfight/locales/it.lua @@ -1,12 +1,12 @@ Locales["it"] = { - ["you_toofar"] = "ti sei allontanato troppo", - ["you_win"] = "Hai vinto il combattimento", - ["you_lost"] = "Hai perso il combattimento", - ["time out"] = "La lotta è finita per limite di tempo", - ["step_away"] = "allontanati dal ring", - ["successfully_signed"] = "Ti sei iscritto con successo", - ["not_money"] = "denaro non sufficente", - ["press_to_join_blue"] = "premi ~INPUT_CONTEXT~ per unirti al lato blu.", - ["press_to_join_red"] = "premi ~INPUT_CONTEXT~ per unirti al lato rosso.", - ["street_fighting"] = "Combattimenti di strada", + ["you_toofar"] = "ti sei allontanato troppo", + ["you_win"] = "Hai vinto il combattimento", + ["you_lost"] = "Hai perso il combattimento", + ["time out"] = "La lotta è finita per limite di tempo", + ["step_away"] = "allontanati dal ring", + ["successfully_signed"] = "Ti sei iscritto con successo", + ["not_money"] = "denaro non sufficente", + ["press_to_join_blue"] = "premi ~INPUT_CONTEXT~ per unirti al lato blu.", + ["press_to_join_red"] = "premi ~INPUT_CONTEXT~ per unirti al lato rosso.", + ["street_fighting"] = "Combattimenti di strada", } diff --git a/server-data/resources/[bpt_addons]/bpt_streetfight/server/server.lua b/server-data/resources/[bpt_addons]/bpt_streetfight/server/server.lua index 1d8618765..9a7e67364 100644 --- a/server-data/resources/[bpt_addons]/bpt_streetfight/server/server.lua +++ b/server-data/resources/[bpt_addons]/bpt_streetfight/server/server.lua @@ -6,86 +6,86 @@ ESX = exports["es_extended"]:getSharedObject() RegisterServerEvent("bpt_streetfight:join") AddEventHandler("bpt_streetfight:join", function(betAmount, side) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) - if side == 0 then - bluePlayerReady = true - else - redPlayerReady = true - end + if side == 0 then + bluePlayerReady = true + else + redPlayerReady = true + end - local fighter = { - id = source, - amount = betAmount, - } - table.insert(fight, fighter) + local fighter = { + id = source, + amount = betAmount, + } + table.insert(fight, fighter) - local balance = xPlayer.getAccount("money").money - if (balance > betAmount) or betAmount == 0 then - xPlayer.removeAccountMoney("money", betAmount) - TriggerClientEvent("esx:showNotification", source, _U("successfully_signed")) - if side == 0 then - TriggerClientEvent("bpt_streetfight:playerJoined", -1, 1, source) - else - TriggerClientEvent("bpt_streetfight:playerJoined", -1, 2, source) - end + local balance = xPlayer.getAccount("money").money + if (balance > betAmount) or betAmount == 0 then + xPlayer.removeAccountMoney("money", betAmount) + TriggerClientEvent("esx:showNotification", source, _U("successfully_signed")) + if side == 0 then + TriggerClientEvent("bpt_streetfight:playerJoined", -1, 1, source) + else + TriggerClientEvent("bpt_streetfight:playerJoined", -1, 2, source) + end - if redPlayerReady and bluePlayerReady then - TriggerClientEvent("bpt_streetfight:startFight", -1, fight) - end - else - TriggerClientEvent("esx:showNotification", source, _U("not_money")) - end + if redPlayerReady and bluePlayerReady then + TriggerClientEvent("bpt_streetfight:startFight", -1, fight) + end + else + TriggerClientEvent("esx:showNotification", source, _U("not_money")) + end end) local count = 240 local _ = 0 function countdown(copyFight) - for i = count, 0, -1 do - _ = i - Wait(1000) - end + for i = count, 0, -1 do + _ = i + Wait(1000) + end - if copyFight == fight then - TriggerClientEvent("bpt_streetfight:fightFinished", -1, -2) - fight = {} - bluePlayerReady = false - redPlayerReady = false - end + if copyFight == fight then + TriggerClientEvent("bpt_streetfight:fightFinished", -1, -2) + fight = {} + bluePlayerReady = false + redPlayerReady = false + end end RegisterServerEvent("bpt_streetfight:finishFight") AddEventHandler("bpt_streetfight:finishFight", function(looser) - TriggerClientEvent("bpt_streetfight:fightFinished", -1, looser) - fight = {} - bluePlayerReady = false - redPlayerReady = false + TriggerClientEvent("bpt_streetfight:fightFinished", -1, looser) + fight = {} + bluePlayerReady = false + redPlayerReady = false end) RegisterServerEvent("bpt_streetfight:leaveFight") AddEventHandler("bpt_streetfight:leaveFight", function(id) - if bluePlayerReady or redPlayerReady then - bluePlayerReady = false - redPlayerReady = false - fight = {} - TriggerClientEvent("bpt_streetfight:playerLeaveFight", -1, id) - end + if bluePlayerReady or redPlayerReady then + bluePlayerReady = false + redPlayerReady = false + fight = {} + TriggerClientEvent("bpt_streetfight:playerLeaveFight", -1, id) + end end) RegisterServerEvent("bpt_streetfight:pay") AddEventHandler("bpt_streetfight:pay", function(amount) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - xPlayer.addAccountMoney("money", amount * 2) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + xPlayer.addAccountMoney("money", amount * 2) end) RegisterServerEvent("bpt_streetfight:raiseBet") AddEventHandler("bpt_streetfight:raiseBet", function() - TriggerClientEvent("bpt_streetfight:raiseActualBet", -1) + TriggerClientEvent("bpt_streetfight:raiseActualBet", -1) end) RegisterServerEvent("bpt_streetfight:showWinner") AddEventHandler("bpt_streetfight:showWinner", function(id) - TriggerClientEvent("bpt_streetfight:winnerText", -1, id) + TriggerClientEvent("bpt_streetfight:winnerText", -1, id) end)