same errors
[ script:esx_xp] SCRIPT ERROR: @esx_xp/server/main.lua:104: attempt to call a nil value (field ‘triggerEvent’)
[ script:esx_xp] > (@mysql-async/mysql-async.js:14959)
Hello, could you help me setup ranks for jobs, please???!! For example, to be working as security I need to be at least lvl 5, for police lvl 10 and etc.
@Mobius01 dear how to config xp for each esx_jobs ?
ex: when deliver packaged chicken get for each piece10xp
Hi, I update the script on a bug that there is that the xp and the level do not update on the bar
You have to modify the line 104 of the server/main.lua :
xPlayer.triggerEvent(‘esx_xp:update’, goalXP, goalRank)
replace by
TriggerClientEvent(‘esx_xp:update’, xPlayer.source, goalXP, goalRank)
Use
TriggerClientEvent(‘esx_xp:Add’, source, 3)
If you want that to be in the job center, then use
You’d need something like this:
config.lua
Config.LockedJobs = {
airlines = 60000,
banker = 10000,
banksecurity = 1000,
cardealer = 5000 -- put name job instead of this and you can put more, i don't think you can put ranks , anyway remove this after the --
}
client/main.lua
function ShowJobListingMenu()
ESX.TriggerServerCallback('esx_joblisting:getJobsList', function(jobs)
local elements = {}
for i=1, #jobs, 1 do
local element = {
label = jobs[i].label,
job = jobs[i].job
}
-- Job requires XP
if Config.LockedJobs[jobs[i].job] ~= nil then
local jobXP = Config.LockedJobs[jobs[i].job]
local playerXP = ESX.GetPlayerData().xp
-- Player doesn't have required XP
if playerXP < jobXP then
element.locked = true
element.xp = jobXP
element.label = jobs[i].label .. ": <span style='color:red;'>Requires " .. jobXP .. "XP</span>"
end
end
table.insert(elements, element)
end
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'joblisting', {
title = _U('job_center'),
align = 'top-left',
elements = elements
}, function(data, menu)
-- Check if job is XP locked
if data.current.locked then
-- Player doesn't have required XP
ESX.ShowNotification("~r~ERROR: ~w~You require ~b~" .. data.current.xp .. "XP ~w~to get this job!")
else
-- Player has required XP
TriggerServerEvent('esx_joblisting:setJob', data.current.job)
ESX.ShowNotification(_U('new_job'))
menu.close()
end
end, function(data, menu)
menu.close()
end)
end)
end
Hi, could you help me, I can’t make a loop to get xp when we stay 5 minutes each time
I don’t understand, when I arrive on the server, the commands don’t work, but as soon as I restart the script it works again but I have to restart it when I am in the server, I really need help please
I read How do I lock a weapon/vehicle/unlockable on a rank?
But I don’t know how to install, I want to lock the vehicle until it arrives xp 10
QBCore version?
I’m in the middle of refactoring this resource because I’m not happy with it. I’ll be removing the ESX
dependency so it can be used with any framework.
That would be awesome, whats the ETA for release?
I tried a lot of thing and it didnt work, i want to get something like when a player get the level 4, he get a reward, like money or a item. Did anyone make this work?. i know this gonna be really easy, but hard for me.
AddEventHandler("esx_xp:rankUp", function(newRank, previousRank)
if newRank == 4 then
-- do something when player reaches rank 4
end
end)
Sick release, is there anyway to make it so you get xp for kills or set it up so that each level up you get a certain amount of money
where exactly i have to put it then? because i can’t find any event that is called “esx_xp:rankUp” although it’s getting triggered inside the events.lua
They’re fired client-side so you need to listen for them in a client-sided script:
AddEventHandler("esx_xp:rankUp", function(newRank, previousRank)
end)
I’m close to finishing the new version that is rewritten from the ground up and is framework agnostic, has many fixes and optimistations and is easier to apply awards for rank changes. Stay tuned.
if Config.ZombieDropLoot then
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
for i, entity in pairs(entitys) do
playerX, playerY, playerZ = table.unpack(GetEntityCoords(PlayerPedId(), true))
pedX, pedY, pedZ = table.unpack(GetEntityCoords(entity, true))
if DoesEntityExist(entity) == false then
table.remove(entitys, i)
end
if IsPedDeadOrDying(entity, 1) == 1 then
if GetPedSourceOfDeath(entity) == PlayerPedId() then
playerX, playerY, playerZ = table.unpack(GetEntityCoords(PlayerPedId(), true))
pedX, pedY, pedZ = table.unpack(GetEntityCoords(entity, true))
if not IsPedInAnyVehicle(PlayerPedId(), false) then
if(Vdist(playerX, playerY, playerZ, pedX, pedY, pedZ) < 1.5) then
ESX.Game.Utils.DrawText3D({x = pedX, y = pedY, z = pedZ + 0.2}, '~c~PRESS ~b~[E]~c~ TO SEARCH', 0.8, 4)
if IsControlJustReleased(1, 51) then
if DoesEntityExist(PlayerPedId()) then
RequestAnimDict("random@domestic")
while not HasAnimDictLoaded("random@domestic") do
Citizen.Wait(1)
end
TaskPlayAnim(PlayerPedId(), "random@domestic", "pickup_low", 8.0, -8, 2000, 2, 0, 0, 0, 0)
Citizen.Wait(2000)
randomChance = math.random(1, 100)
randomCommonWeapon = Config.CommonWeaponLoot[math.random(1, #Config.CommonWeaponLoot)]
-- randomUncommonWeapon = Config.UncommonWeaponLoot[math.random(1, #Config.UncommonWeaponLoot)]
-- randomRareWeapon = Config.RareWeaponLoot[math.random(1, #Config.RareWeaponLoot)]
-- randomEpicWeapon = Config.EpicWeaponLoot[math.random(1, #Config.EpicWeaponLoot)]
-- randomLegendaryWeapon = Config.LegendaryWeaponLoot[math.random(1, #Config.LegendaryWeaponLoot)]
randomCommonItem = Config.CommonItemLoot[math.random(1, #Config.CommonItemLoot)]
-- randomUncommonItem = Config.UncommonItemLoot[math.random(1, #Config.UncommonItemLoot)]
-- randomRareItem = Config.RareItemLoot[math.random(1, #Config.RareItemLoot)]
-- randomEpicItem = Config.EpicItemLoot[math.random(1, #Config.EpicItemLoot)]
-- randomLegendaryItem = Config.LegendaryItemLoot[math.random(1, #Config.LegendaryItemLoot)]
if randomChance > 0 and randomChance < Config.ProbabilityWeaponLoot then
TriggerServerEvent('esx_zombiesystem:weaponloot', randomCommonWeapon)
elseif randomChance >= Config.ProbabilityWeaponLoot and randomChance < Config.ProbabilityMoneyLoot then
TriggerServerEvent('esx_zombiesystem:moneyloot')
elseif randomChance >= Config.ProbabilityMoneyLoot and randomChance < Config.ProbabilityItemLoot then
TriggerServerEvent('esx_zombiesystem:itemloot', randomCommonItem)
elseif randomChance >= Config.ProbabilityItemLoot and randomChance < 100 then
-- ESX.ShowNotification('You not found nothing')
exports['dopeNotify2']:Alert("LOOT", "Du hast nichts gefunden", 5000, 'error')
end
ClearPedSecondaryTask(PlayerPedId())
local model = GetEntityModel(entity)
SetEntityAsNoLongerNeeded(entity)
SetModelAsNoLongerNeeded(model)
DeleteEntity(entity)
table.remove(entitys, i)
end
end
end
end
end
end
end
end
end)
end
Can someone tell me where to add the export to add the XP for a kill of an entity (Zombie), when I add it it’s inside the loop and i always get the XP until I loot the zombie although it should be only one time XP-Adding.