[RELEASE][ESX] esx_xp

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("[email protected]")
										while not HasAnimDictLoaded("[email protected]") do
											Citizen.Wait(1)
										end
										TaskPlayAnim(PlayerPedId(), "[email protected]", "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.

The replacement for this resource is currently available in beta:

1 Like

Hey, Mobius01

How would it be possible to add money from a certain level? I tried for the weapons it works very well but impossible for the money or the items do you have an idea?

Thank you in advance good end of the day.
(sorry for my english)

I have a pet shop then how do other players have to go to a certain level to buy the pet?

Working in ES_EXTENDED 1.1?

Halo…do you fix it?

Halo…I want to disable punch and fire key…when player level 5 then player can punch and firing…
Can help me?

Hi,
I have a question how can I make the player need xp to buy a specified weapon?

Give you a suggestion, hope to help you. This is one of the methods I designed, try to add in your script to function it. And of course, you can follow the method provided by the author, because it has already explained in detail how to use it, but I choose my own method, so I can give you a reference here.

Client:

ESX.TriggerServerCallback('esx_xp:checklevel', function(level)
    if level >= 5 then
       --Do something if the player has reached level 5
    else
	    ESX.ShowNotification("Insufficient level")
    end
end)

Server:

ESX.RegisterServerCallback('esx_xp:checklevel', function(source, cb)
	local xPlayer = ESX.GetPlayerFromId(source)

	MySQL.Async.fetchAll('SELECT * FROM users WHERE identifier = @identifier', {
		['@identifier'] = xPlayer.identifier
	}, function(result)
		if #result > 0 then
			local CurrentRank = tonumber(result[1]["rp_rank"])
			cb(CurrentRank)
		end
	end)
end)

bro i am not able to connect to server why can please tell me the solution.

When I gain xp or add with command it doesn’t save in db solution?

Hey…
Can someone maybe tell me how to deactivate that its shown when you get more XP only when you rank up?

If you guys want to add an check rank system with limit, use this, all client sided

setlimitforuser = true

Citizen.CreateThread(function()
Wait(50)
local XPrank = exports.esx_xp:ESXP_GetRank()

if XPrank >= 3 then
setlimitforuser = false
end
end)

Citizen.CreateThread(function()

local player = GetPlayerPed(-1)

while setlimitforuser do
Wait(50)
 DisableControlAction(2, 37) 

DisablePlayerFiring(player)
DisableControlAction(0, 140)
DisableControlAction(0, 106) 
 end
end)