esx_xp
esx_xp copied to clipboard
How can player get 2xp for playing 1 minute?
Hello, I need code, that would add 2 XP to player when his playtime will be 1minute, I need this loop.
Im playing 1 minute I will get 2 XP, I play another minute I will get again 2 XP.
It's like SA-MP, can u help me?
Nvm. If someone need it to:
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(60000) -- 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)