diff --git a/client/main.lua b/client/main.lua index 245c8976..b0d78e43 100644 --- a/client/main.lua +++ b/client/main.lua @@ -61,7 +61,7 @@ AddEventHandler('playerSpawned', function() Citizen.CreateThread(function() while not ESX.PlayerLoaded do - Citizen.Wait(0) + Citizen.Wait(1) end local playerPed = GetPlayerPed(-1) @@ -81,13 +81,21 @@ AddEventHandler('playerSpawned', function() end) +AddEventHandler('baseevents:onPlayerDied', function(killerType, coords) + TriggerEvent('esx:onPlayerDeath') +end) + +AddEventHandler('baseevents:onPlayerKilled', function(killerId, data) + TriggerEvent('esx:onPlayerDeath') +end) + AddEventHandler('skinchanger:loadDefaultModel', function() - LoadoutLoaded = false + LoadoutLoaded = false end) AddEventHandler('skinchanger:modelLoaded', function() while not ESX.PlayerLoaded do - Citizen.Wait(0) + Citizen.Wait(1) end TriggerEvent('esx:restoreLoadout') @@ -194,7 +202,7 @@ AddEventHandler('esx:teleport', function(pos) while not HasCollisionLoadedAroundEntity(GetPlayerPed(-1)) do RequestCollisionAtCoord(pos.x, pos.y, pos.z) - Citizen.Wait(0) + Citizen.Wait(1) end SetEntityCoords(GetPlayerPed(-1), pos.x, pos.y, pos.z) @@ -239,7 +247,7 @@ AddEventHandler('esx:playAnim', function(dict, anim) RequestAnimDict(dict) while not HasAnimDictLoaded(dict) do - Wait(0) + Citizen.Wait(1) end TaskPlayAnim(pid, dict, anim, 1.0, -1.0, 20000, 0, 1, true, true, true) @@ -256,7 +264,7 @@ AddEventHandler('esx:playEmote', function(emote) local playerPed = GetPlayerPed(-1) TaskStartScenarioInPlace(playerPed, emote, 0, false); - Wait(20000) + Citizen.Wait(20000) ClearPedTasks(playerPed) end) @@ -357,7 +365,7 @@ AddEventHandler('esx:spawnPed', function(model) RequestModel(model) while not HasModelLoaded(model) do - Citizen.Wait(0) + Citizen.Wait(1) end CreatePed(5, model, x, y, z, 0.0, true, false) @@ -408,7 +416,7 @@ Citizen.CreateThread(function() while true do - Wait(0) + Citizen.Wait(1) local playerPed = GetPlayerPed(-1) local loadout = {} @@ -462,7 +470,7 @@ end) Citizen.CreateThread(function() while true do - Wait(0) + Citizen.Wait(10) if IsControlPressed(0, Keys["F2"]) and GetLastInputMethod(2) and not ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') and (GetGameTimer() - GUI.Time) > 150 then ESX.ShowInventory() @@ -500,7 +508,7 @@ if Config.DisableWantedLevel then Citizen.CreateThread(function() while true do - Citizen.Wait(0) + Citizen.Wait(10) local playerId = PlayerId() @@ -573,7 +581,7 @@ Citizen.CreateThread(function() while true do - Citizen.Wait(0) + Citizen.Wait(10) local playerPed = GetPlayerPed(-1) diff --git a/locales/en.lua b/locales/en.lua index 12bc40f7..d6cfa6d7 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -6,13 +6,13 @@ Locales['en'] = { ['return'] = 'return', ['amount'] = 'amount', ['amountammo'] = 'amount of ammo', - ['noammo'] = 'You dont have all these ammo !', + ['noammo'] = 'you do not have enough ammo!', ['withammo'] = '~s~ with x', ['ammogiven'] = '~s~ bullets', ['giveammo'] = 'Give ammo', ['amount_invalid'] = 'invalid amount', ['players_nearby'] = 'no players nearby', - ['ex_inv_lim'] = 'action not possible, exceeding invetory limit for ~b~', + ['ex_inv_lim'] = 'action not possible, exceeding inventory limit for ~b~', ['yougave'] = 'you gave', ['youreceived'] = 'you received', ['to'] = '~s~ to ~b~', @@ -27,7 +27,8 @@ Locales['en'] = { ['company_nomoney'] = 'Your company is broke!', ['state_paid'] = 'You received a state check', ['act_imp'] = 'action impossible', - ['in_vehicle'] = 'You can\'t give anything to someone in vehicle', + ['in_vehicle'] = 'you can\'t give anything to someone in a vehicle', + ['cannot_pickup_room'] = 'you do not have enough space in your inventory to pick up ~y~%s~s~!', -- Commands ['setjob'] = 'assign a job to a user', ['id_param'] = 'the ID of the player', diff --git a/locales/fr.lua b/locales/fr.lua index 1f447f78..c8d40f32 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -28,6 +28,7 @@ Locales['fr'] = { ['state_paid'] = 'L\'état vous a payé ', ['act_imp'] = 'action impossible', ['in_vehicle'] = 'Vous ne pouvez rien donner à quelqu\'un dans un véhicule', + ['cannot_pickup_room'] = 'vous n\'avez plus de place pour ~y~%s~s~!', -- Commands ['setjob'] = 'assigner job', ['id_param'] = 'identification du joueur', diff --git a/locales/sv.lua b/locales/sv.lua index bda695af..95912ed7 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -22,6 +22,7 @@ Locales['sv'] = { ['company_nomoney'] = 'Ditt företag är för fattigt!!', ['state_paid'] = 'Du fick en statlig check', ['act_imp'] = 'åtgärd omöjlig', + ['cannot_pickup_room'] = 'du har inte plats för att plocka upp ~y~%s~s~!', -- Commands ['setjob'] = 'tilldela ett jobb till en användare', ['id_param'] = 'spelarens ID', diff --git a/server/main.lua b/server/main.lua index 2e2e10cb..94bfc585 100644 --- a/server/main.lua +++ b/server/main.lua @@ -569,7 +569,7 @@ AddEventHandler('esx:onPickup', function(id) end if remaining > 0 then - TriggerClientEvent('esx:showNotification', _source, 'Vous n\'avez plus de place pour ~b~' .. item.label .. '~s~') + TriggerClientEvent('esx:showNotification', _source, _U('cannot_pickup_room', item.label)) ESX.CreatePickup('item_standard', pickup.name, remaining, item.label .. ' [' .. remaining .. ']', _source) end diff --git a/server/paycheck_company.lua b/server/paycheck_company.lua index 76773f27..892c0281 100644 --- a/server/paycheck_company.lua +++ b/server/paycheck_company.lua @@ -1,30 +1,30 @@ ESX.StartPayCheck = function () - function payCheck () - local xPlayers = ESX.GetPlayers() - for i=1, #xPlayers, 1 do - local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) - if xPlayer.job.grade_name == 'interim' or xPlayer.job.grade_name == 'rsa' or xPlayer.job.grade_name == 'employee' then -- Si il n'est pas dans une société, je prends chez l'état - if xPlayer.job.grade_salary > 0 then - xPlayer.addAccountMoney('bank',xPlayer.job.grade_salary) - TriggerClientEvent('esx:showNotification', xPlayer.source, ('L\'état vous a payé ') .. '~g~$' .. xPlayer.job.grade_salary) - end - else -- Sinon je prends l'argent dans la société - TriggerEvent('esx_society:getSociety', xPlayer.job.name, function (society) - TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function (account) - if account.money >= xPlayer.job.grade_salary then - xPlayer.addAccountMoney('bank',xPlayer.job.grade_salary) - account.removeMoney(xPlayer.job.grade_salary) - TriggerClientEvent('esx:showNotification', xPlayer.source, ('Votre entreprise vous a payé ') .. '~g~$' .. xPlayer.job.grade_salary) - else - TriggerClientEvent('esx:showNotification', xPlayer.source, 'Votre entreprise n\'a plus d\'argent pour vous payer !') - end - end) - end) - end - end +function payCheck () + local xPlayers = ESX.GetPlayers() + for i=1, #xPlayers, 1 do + local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) + if xPlayer.job.grade_name == 'interim' or xPlayer.job.grade_name == 'rsa' or xPlayer.job.grade_name == 'employee' then -- only if the player is employeed in a company + if xPlayer.job.grade_salary > 0 then + xPlayer.addAccountMoney('bank', xPlayer.job.grade_salary) + TriggerClientEvent('esx:showNotification', xPlayer.source, ('L\'état vous a payé ') .. '~g~$' .. xPlayer.job.grade_salary) + end + else -- Else take money from society + TriggerEvent('esx_society:getSociety', xPlayer.job.name, function (society) + TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function (account) + if account.money >= xPlayer.job.grade_salary then + xPlayer.addAccountMoney('bank',xPlayer.job.grade_salary) + account.removeMoney(xPlayer.job.grade_salary) + TriggerClientEvent('esx:showNotification', xPlayer.source, ('Votre entreprise vous a payé ') .. '~g~$' .. xPlayer.job.grade_salary) + else + TriggerClientEvent('esx:showNotification', xPlayer.source, 'Votre entreprise n\'a plus d\'argent pour vous payer !') + end + end) + end) + end + end - SetTimeout(Config.PaycheckInterval, payCheck) + SetTimeout(Config.PaycheckInterval, payCheck) end SetTimeout(Config.PaycheckInterval, payCheck) end