esx_xp icon indicating copy to clipboard operation
esx_xp copied to clipboard

xp for killing AI and other players

Open rahafuf opened this issue 4 years ago • 12 comments

how would I go about getting XP to be given when killing AI and how would I do it for killing players plus removing xp from the player that was killed

rahafuf avatar Jan 05 '21 05:01 rahafuf

Were you able to figure it out?

siddharth220 avatar May 23 '21 11:05 siddharth220

this will ca use you to gain 10 XP every time you kill an AI

Citizen.CreateThread(function() _,trash = AddRelationshipGroup("TRASH") while true do Citizen.Wait(0) for _, ped in ipairs(GetGamePool('CPed')) do pedrelation = GetPedRelationshipGroupHash(ped) if DoesEntityExist(ped) and IsEntityDead(ped) and pedrelation ~= trash and not IsPedAPlayer(ped) then if GetPedSourceOfDeath(ped) == PlayerPedId() then TriggerEvent("BattlePass:AddXP",10,source) SetPedRelationshipGroupHash(ped, trash) end end end end end)

On Sun, May 23, 2021, 6:59 AM Swampert220 @.***> wrote:

Were you able to figure it out?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846551534, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMUZSZ26QKOVAC4MC63TPDU3ZANCNFSM4VUKIAQA .

rahafuf avatar May 23 '21 12:05 rahafuf

this will ca use you to gain 10 XP every time you kill an AI Citizen.CreateThread(function() _,trash = AddRelationshipGroup("TRASH") while true do Citizen.Wait(0) for _, ped in ipairs(GetGamePool('CPed')) do pedrelation = GetPedRelationshipGroupHash(ped) if DoesEntityExist(ped) and IsEntityDead(ped) and pedrelation ~= trash and not IsPedAPlayer(ped) then if GetPedSourceOfDeath(ped) == PlayerPedId() then TriggerEvent("BattlePass:AddXP",10,source) SetPedRelationshipGroupHash(ped, trash) end end end end end) On Sun, May 23, 2021, 6:59 AM Swampert220 @.***> wrote: Were you able to figure it out? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMUZSZ26QKOVAC4MC63TPDU3ZANCNFSM4VUKIAQA .

Any way to configure it for actual players

siddharth220 avatar May 23 '21 12:05 siddharth220

Remove the part that says "not IsPedAPlayer(ped)"

On Sun, May 23, 2021, 7:25 AM Swampert220 @.***> wrote:

this will ca use you to gain 10 XP every time you kill an AI Citizen.CreateThread(function() _,trash = AddRelationshipGroup("TRASH") while true do Citizen.Wait(0) for , ped in ipairs(GetGamePool('CPed')) do pedrelation = GetPedRelationshipGroupHash(ped) if DoesEntityExist(ped) and IsEntityDead(ped) and pedrelation ~= trash and not IsPedAPlayer(ped) then if GetPedSourceOfDeath(ped) == PlayerPedId() then TriggerEvent("BattlePass:AddXP",10,source) SetPedRelationshipGroupHash(ped, trash) end end end end end) … <#m_6702939521741169624> On Sun, May 23, 2021, 6:59 AM Swampert220 @.***> wrote: Were you able to figure it out? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 (comment) https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846551534>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMUZSZ26QKOVAC4MC63TPDU3ZANCNFSM4VUKIAQA .

Any way to configure it for actual players

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846555049, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMVJRPO5RIAVXFJK3YTTPDX45ANCNFSM4VUKIAQA .

rahafuf avatar May 23 '21 12:05 rahafuf

Remove the part that says "not IsPedAPlayer(ped)" On Sun, May 23, 2021, 7:25 AM Swampert220 @.> wrote: this will ca use you to gain 10 XP every time you kill an AI Citizen.CreateThread(function() _,trash = AddRelationshipGroup("TRASH") while true do Citizen.Wait(0) for , ped in ipairs(GetGamePool('CPed')) do pedrelation = GetPedRelationshipGroupHash(ped) if DoesEntityExist(ped) and IsEntityDead(ped) and pedrelation ~= trash and not IsPedAPlayer(ped) then if GetPedSourceOfDeath(ped) == PlayerPedId() then TriggerEvent("BattlePass:AddXP",10,source) SetPedRelationshipGroupHash(ped, trash) end end end end end) … <#m_6702939521741169624> On Sun, May 23, 2021, 6:59 AM Swampert220 @.> wrote: Were you able to figure it out? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 (comment) <#20 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMUZSZ26QKOVAC4MC63TPDU3ZANCNFSM4VUKIAQA . Any way to configure it for actual players — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMVJRPO5RIAVXFJK3YTTPDX45ANCNFSM4VUKIAQA .

Should add this in client or server?

siddharth220 avatar May 23 '21 12:05 siddharth220

Client I believe. I'll have to look later once I'm off work

On Sun, May 23, 2021, 7:57 AM Swampert220 @.***> wrote:

Remove the part that says "not IsPedAPlayer(ped)" … <#m_5085039287984978194_> On Sun, May 23, 2021, 7:25 AM Swampert220 @.> wrote: this will ca use you to gain 10 XP every time you kill an AI Citizen.CreateThread(function() _,trash = AddRelationshipGroup("TRASH") while true do Citizen.Wait(0) for , ped in ipairs(GetGamePool('CPed')) do pedrelation = GetPedRelationshipGroupHash(ped) if DoesEntityExist(ped) and IsEntityDead(ped) and pedrelation ~= trash and not IsPedAPlayer(ped) then if GetPedSourceOfDeath(ped) == PlayerPedId() then TriggerEvent("BattlePass:AddXP",10,source) SetPedRelationshipGroupHash(ped, trash) end end end end end) … <#m_6702939521741169624> On Sun, May 23, 2021, 6:59 AM Swampert220 @.> wrote: Were you able to figure it out? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 https://github.com/Mobius1/esx_xp/issues/20 (comment) <#20 (comment) https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846551534>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMUZSZ26QKOVAC4MC63TPDU3ZANCNFSM4VUKIAQA . Any way to configure it for actual players — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 (comment) https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846555049>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMVJRPO5RIAVXFJK3YTTPDX45ANCNFSM4VUKIAQA .

Should add this in client or server?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846559279, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMVTQPMVNEICOYCYQE3TPD3T3ANCNFSM4VUKIAQA .

rahafuf avatar May 23 '21 13:05 rahafuf

Client I believe. I'll have to look later once I'm off work On Sun, May 23, 2021, 7:57 AM Swampert220 @.*> wrote: Remove the part that says "not IsPedAPlayer(ped)" … <#m_5085039287984978194_> On Sun, May 23, 2021, 7:25 AM Swampert220 @.> wrote: this will ca use you to gain 10 XP every time you kill an AI Citizen.CreateThread(function() _,trash = AddRelationshipGroup("TRASH") while true do Citizen.Wait(0) for , ped in ipairs(GetGamePool('CPed')) do pedrelation = GetPedRelationshipGroupHash(ped) if DoesEntityExist(ped) and IsEntityDead(ped) and pedrelation ~= trash and not IsPedAPlayer(ped) then if GetPedSourceOfDeath(ped) == PlayerPedId() then TriggerEvent("BattlePass:AddXP",10,source) SetPedRelationshipGroupHash(ped, trash) end end end end end) … <#m_6702939521741169624> On Sun, May 23, 2021, 6:59 AM Swampert220 @.> wrote: Were you able to figure it out? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 <#20> (comment) <#20 (comment) <#20 (comment)>>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMUZSZ26QKOVAC4MC63TPDU3ZANCNFSM4VUKIAQA . Any way to configure it for actual players — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 (comment) <#20 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMVJRPO5RIAVXFJK3YTTPDX45ANCNFSM4VUKIAQA . Should add this in client or server? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMVTQPMVNEICOYCYQE3TPD3T3ANCNFSM4VUKIAQA .

Thanks man that would be really helpful, I have been looking for this for quite some time

siddharth220 avatar May 23 '21 14:05 siddharth220

Join the discord. There are channels set up for snippets

On Sun, May 23, 2021, 9:24 AM Swampert220 @.***> wrote:

Client I believe. I'll have to look later once I'm off work … <#m_-4253752457682759071_> On Sun, May 23, 2021, 7:57 AM Swampert220 @.**> wrote: Remove the part that says "not IsPedAPlayer(ped)" … <#m_5085039287984978194_> On Sun, May 23, 2021, 7:25 AM Swampert220 @.> wrote: this will ca use you to gain 10 XP every time you kill an AI Citizen.CreateThread(function() _,trash = AddRelationshipGroup("TRASH") while true do Citizen.Wait(0) for , ped in ipairs(GetGamePool('CPed')) do pedrelation = GetPedRelationshipGroupHash(ped) if DoesEntityExist(ped) and IsEntityDead(ped) and pedrelation ~= trash and not IsPedAPlayer(ped) then if GetPedSourceOfDeath(ped) == PlayerPedId() then TriggerEvent("BattlePass:AddXP",10,source) SetPedRelationshipGroupHash(ped, trash) end end end end end) … <#m_6702939521741169624> On Sun, May 23, 2021, 6:59 AM Swampert220 @.*> wrote: Were you able to figure it out? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 https://github.com/Mobius1/esx_xp/issues/20 <#20 https://github.com/Mobius1/esx_xp/issues/20> (comment) <#20 https://github.com/Mobius1/esx_xp/issues/20 (comment) <#20 (comment) https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846551534>>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMUZSZ26QKOVAC4MC63TPDU3ZANCNFSM4VUKIAQA . Any way to configure it for actual players — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 https://github.com/Mobius1/esx_xp/issues/20 (comment) <#20 (comment) https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846555049>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMVJRPO5RIAVXFJK3YTTPDX45ANCNFSM4VUKIAQA . Should add this in client or server? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 (comment) https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846559279>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMVTQPMVNEICOYCYQE3TPD3T3ANCNFSM4VUKIAQA .

Thanks man that would be really helpful, I have been looking for this for quite some time

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846571456, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMWTFDB22RMBM7YN4WTTPEF2LANCNFSM4VUKIAQA .

rahafuf avatar May 23 '21 14:05 rahafuf

Join the discord. There are channels set up for snippets On Sun, May 23, 2021, 9:24 AM Swampert220 @.> wrote: Client I believe. I'll have to look later once I'm off work … <#m_-4253752457682759071_> On Sun, May 23, 2021, 7:57 AM Swampert220 @.> wrote: Remove the part that says "not IsPedAPlayer(ped)" … <#m_5085039287984978194_> On Sun, May 23, 2021, 7:25 AM Swampert220 @.> wrote: this will ca use you to gain 10 XP every time you kill an AI Citizen.CreateThread(function() _,trash = AddRelationshipGroup("TRASH") while true do Citizen.Wait(0) for , ped in ipairs(GetGamePool('CPed')) do pedrelation = GetPedRelationshipGroupHash(ped) if DoesEntityExist(ped) and IsEntityDead(ped) and pedrelation ~= trash and not IsPedAPlayer(ped) then if GetPedSourceOfDeath(ped) == PlayerPedId() then TriggerEvent("BattlePass:AddXP",10,source) SetPedRelationshipGroupHash(ped, trash) end end end end end) … <#m_6702939521741169624> On Sun, May 23, 2021, 6:59 AM Swampert220 @.> wrote: Were you able to figure it out? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 <#20> <#20 <#20>> (comment) <#20 <#20> (comment) <#20 (comment) <#20 (comment)>>>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMUZSZ26QKOVAC4MC63TPDU3ZANCNFSM4VUKIAQA . Any way to configure it for actual players — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 <#20> (comment) <#20 (comment) <#20 (comment)>>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMVJRPO5RIAVXFJK3YTTPDX45ANCNFSM4VUKIAQA . Should add this in client or server? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 (comment) <#20 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMVTQPMVNEICOYCYQE3TPD3T3ANCNFSM4VUKIAQA . Thanks man that would be really helpful, I have been looking for this for quite some time — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMWTFDB22RMBM7YN4WTTPEF2LANCNFSM4VUKIAQA .

link?

siddharth220 avatar May 24 '21 05:05 siddharth220

https://discord.gg/cyjTu5mE

On Mon, May 24, 2021, 12:05 AM Swampert220 @.***> wrote:

Join the discord. There are channels set up for snippets … <#m_5884218801376491686_> On Sun, May 23, 2021, 9:24 AM Swampert220 @.> wrote: Client I believe. I'll have to look later once I'm off work … <#m_-4253752457682759071_> On Sun, May 23, 2021, 7:57 AM Swampert220 @.> wrote: Remove the part that says "not IsPedAPlayer(ped)" … <#m_5085039287984978194_> On Sun, May 23, 2021, 7:25 AM Swampert220 @.> wrote: this will ca use you to gain 10 XP every time you kill an AI Citizen.CreateThread(function() _,trash = AddRelationshipGroup("TRASH") while true do Citizen.Wait(0) for , ped in ipairs(GetGamePool('CPed')) do pedrelation = GetPedRelationshipGroupHash(ped) if DoesEntityExist(ped) and IsEntityDead(ped) and pedrelation ~= trash and not IsPedAPlayer(ped) then if GetPedSourceOfDeath(ped) == PlayerPedId() then TriggerEvent("BattlePass:AddXP",10,source) SetPedRelationshipGroupHash(ped, trash) end end end end end) … <#m_6702939521741169624> On Sun, May 23, 2021, 6:59 AM Swampert220 @.> wrote: Were you able to figure it out? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 https://github.com/Mobius1/esx_xp/issues/20 <#20 https://github.com/Mobius1/esx_xp/issues/20> <#20 https://github.com/Mobius1/esx_xp/issues/20 <#20 https://github.com/Mobius1/esx_xp/issues/20>> (comment) <#20 https://github.com/Mobius1/esx_xp/issues/20 <#20 https://github.com/Mobius1/esx_xp/issues/20> (comment) <#20 https://github.com/Mobius1/esx_xp/issues/20 (comment) <#20 (comment) https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846551534>>>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMUZSZ26QKOVAC4MC63TPDU3ZANCNFSM4VUKIAQA . Any way to configure it for actual players — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 https://github.com/Mobius1/esx_xp/issues/20 <#20 https://github.com/Mobius1/esx_xp/issues/20> (comment) <#20 https://github.com/Mobius1/esx_xp/issues/20 (comment) <#20 (comment) https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846555049>>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMVJRPO5RIAVXFJK3YTTPDX45ANCNFSM4VUKIAQA . Should add this in client or server? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 https://github.com/Mobius1/esx_xp/issues/20 (comment) <#20 (comment) https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846559279>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMVTQPMVNEICOYCYQE3TPD3T3ANCNFSM4VUKIAQA . Thanks man that would be really helpful, I have been looking for this for quite some time — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 (comment) https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846571456>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMWTFDB22RMBM7YN4WTTPEF2LANCNFSM4VUKIAQA .

link?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Mobius1/esx_xp/issues/20#issuecomment-846739223, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMSXKTWOS3ELDK5LAPTTPHNAXANCNFSM4VUKIAQA .

rahafuf avatar May 24 '21 06:05 rahafuf

Hi, I have been trying to make it work for when you kill a player, but when testing it with your code, upload the xp all the time until the player revives, do you know any way to fix it?

TheChrisHp avatar Jun 30 '21 19:06 TheChrisHp

esto puede usarlo para ganar 10 XP cada vez que mata a un AI Citizen.CreateThread (function () _, trash = AddRelationshipGroup ("TRASH") mientras que es verdadero Citizen.Wait (0) for _, ped in ipairs (GetGamePool ( 'CPed')) do pedrelation = GetPedRelationshipGroupHash (ped) if DoesEntityExist (ped) y IsEntityDead (ped) y pedrelation ~ = basura y no IsPedAPlayer (ped) entonces si GetPedSourceOfDeath (ped) == PlayerPedId () entonces TriggerEvent (" AddXP ", 10, fuente) SetPedRelationshipGroupHash (ped, trash) end end end end end) ... On Sun, May 23, 2021, 6:59 AM Swampert220 @.***> wrote: Were you able to figure it out? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#20 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILTDMUZSZ26QKOVAC4MC63TPDU3ZANCNFSM4VUKIAQA . Hi, I have been trying to make it work for when you kill a player, but when testing it with your code, upload the xp all the time until the player revives, do you know any way to fix it?

TheChrisHp avatar Jul 01 '21 18:07 TheChrisHp