You’d need to loop through peds and check if they’re dead and if so, see if the cause of death was the player.
So far I’ve been eyeing this script I found here
My draft is looking something like this, I’m calling this .lua as a client script in my esx_xp fxmanifest.lua
If I get this working, it’ll unfortunately only work if they’re shot by me aiming at them but it’s a start.
function deleteEntity(entity)
Citizen.InvokeNative(0xAE3CBE5BF394C9C9, Citizen.PointerValueIntInitialized(entity))
end
function rewards()
aiming, ent = GetEntityPlayerIsFreeAimingAt(PlayerId(), Citizen.ReturnResultAnyway())
local playerPed = PlayerPedId()
if HasEntityBeenDamagedByEntity(targetPed, playerPed, 1) then
if IsEntityAPed(ent) then
if IsEntityDead(ent) then
deleteEntity(ent)
local cash
cash = GetPedMoney(GetPlayerPed(-1))
if type(cash) == "boolean" then
cash = 0
end
Wait(1)
--SetPedMoney(GetPlayerPed(-1), cash + 10)
TriggerClientEvent('esx_xp:Add', source, 100)
PlaySound(-1, "LOCAL_PLYR_CASH_COUNTER_INCREASE", "DLC_HEISTS_GENERAL_FRONTEND_SOUNDS", 0, 0, 1)
end
end
end
Citizen.CreateThread(function()
while true do
Wait(1)
rewards()
end
end)
end
I’m aware this is pretty far off, my actual coding knowledge is incredibly basic
Hi! I posted some issues on Github, along with some things that can solve them.
v1.2.2 Released
Fixes
- Fixed paging error on removing players
- Fixed performance issue when removing players
- Fixed error retrieving current player
- Fixed leaderboard page numbers remaining if pagination isn’t required
Links
Hey bro what is wrong here? im trying to make a passive xp add, it works but console says
SCRIPT ERROR: @esx_xp/client/main.lua:117: attempt to index a nil value (global ‘ESX’)
EDIT: Forget it, i think your script doesnt like restarts
if someone want to do this just add a client lua,
add it on the fxmanifest and put this code on it
– EXP PASIVA –
RegisterNetEvent("esx_xp:updateUI") AddEventHandler("esx_xp:updateUI", function(_xp) CurrentXP = tonumber(_xp) SendNUIMessage({ xpm_set = true, xp = CurrentXP })
end)
PlayerOnlineTime = 0
Citizen.CreateThread(function()
while true do Wait(10000) -- EDIT THIS, DEFAULT IS 10 SECONDS IN MS PlayerOnlineTime = PlayerOnlineTime + 1 if PlayerOnlineTime == 1 then exports('ESXP_Add', ESXP_Add) exports['mythic_notify']:SendAlert('success', '+100 XP') TriggerEvent('esx_xp:Add', 100) PlayerOnlineTime = 0 end end
end)
The easiest way is to require a licence for esx_weaponshop
and check the player’s rank in the license menu.
config.lua
Config.LicenseEnable = true -- enable this
Config.LicensePrice = 5000
Config.LicenseRank = 50 -- add this line
esx_weaponshop/client/main.lua
Find this line:
OpenBuyLicenseMenu(CurrentActionData.zone)
and replace it with this:
if ESX.GetPlayerData().rank >= Config.LicenseRank then
OpenBuyLicenseMenu(CurrentActionData.zone)
else
ESX.ShowNotification("~r~ERROR: ~w~A rank of ~g~".. Config.LicenseRank .. " ~w~is required to purchase a weapon license!")
end
Make sure you’re using esx_license
.
Hello,
maybe my english is bad, hope it can be understood
I have a weaponshop with inventoryhud. how to make several open weapons according to rank.
Config : config.lua (5.6 KB)
Client : main.lua (19.9 KB) shop.lua (10.8 KB).
Server : main.lua (19.6 KB)
Please help, Thank you for taking your time
bruh i love you i will try it, thanks <3
edit: works great ^^
How can I block weapons by level? For example, to buy a gun you have to be level 10
Hi, the scripts is working perfectly but i have a litte bit problem, there is random xp reset when player crash or disconnect and its appear happen everyday when i stop the server and kick the player when they online, still cant figure it out how to solve it, any idea anyone ? or fixed maybe ?
Why dont working?
how to make that give 100 xp every 10 minutes??
n i earn xp and how can i add jobs ?
i want to know it too
just posted that code a few comments upthere lol
how can i configure a job ? and how can i get xp ?
sorry im a beginner… i will add xp for playtime fofr example every 15 min 10 xp and i will add when jobs done get extra xp
Wow, this… This is awesome. Thank you so much for sharing this with us. Furthermore, thank you for making it so user friendly, the sets and gets alone are GOLD.
I REALLY like this, and it can be adapted for so many systems.
Great job!
how to add xp every 10 min 10xp ?