Get Armor Script

So I have a script that gives me health when I do /heal I want the same thing but when I do /armor it gives me armor. I figured that I could just send in the script that does /heal and someone could re write to give me armor, I tried it myself but spent like an hour of trying and could not do it.

RegisterNetEvent("ARPF:heal")

AddEventHandler("ARPF:heal", function()

local prop = "prop_ld_health_pack"

playerPed = GetPlayerPed(-1)

local pedPos = GetEntityCoords(playerPed, false)

exports['progressBars']:startUI(7000, "Healing") -- Progress Bar can be changed if you dont have it

RequestAnimDict("[email protected]_a")

while not HasAnimDictLoaded("[email protected]_a") do

  Citizen.Wait(100)

end

TaskPlayAnim(GetPlayerPed(PlayerId()), "[email protected]_a", "idle_a", 1.0, -1, -1, 50, 0, 0, 0, 0)

local bone = GetPedBoneIndex(GetPlayerPed(-1), 18905) -- 18905  28422

local heals = CreateObject(GetHashKey(prop), 1.0, 1.0, 1.0, 1, 1, 0)

shieldEntitys = heals

--AttachEntityToEntity(shieldEntitys, playerPed, bone, 0.18, 0.0, 0.0, 135.0, -100.0, 0.0, 1, 0, 0, 0, 2, 1)

AttachEntityToEntity(shieldEntitys, playerPed, bone, 0.15, 0.05, -0.01, 180.0, 220.0, 20.0, 1, 1, 0, 0, 2, 1)

-- ["xR"] = 315.0,["yR"] = 288.0, ["zR"] = 0.0

Citizen.Wait(7000)

DeleteEntity(shieldEntitys)

health = GetEntityHealth(playerPed)

chelth = health + 30

SetEntityHealth(playerPed, chelth)

StopAnimTask(PlayerPedId(), '[email protected]_a', 'idle_a', 1.0)
1 Like

I think u need this maybe

RegisterNetEvent("ARPF:armor")

AddEventHandler("ARPF:armor", function()

local prop = "prop_ld_health_pack"

playerPed = GetPlayerPed(-1)

local pedPos = GetEntityCoords(playerPed, false)

exports['progressBars']:startUI(7000, "Shielding") -- Progress Bar can be changed if you dont have it

RequestAnimDict("[email protected]_a")

while not HasAnimDictLoaded("[email protected]_a") do

  Citizen.Wait(100)

end

TaskPlayAnim(GetPlayerPed(PlayerId()), "[email protected]_a", "idle_a", 1.0, -1, -1, 50, 0, 0, 0, 0)

local bone = GetPedBoneIndex(GetPlayerPed(-1), 18905) -- 18905  28422

local heals = CreateObject(GetHashKey(prop), 1.0, 1.0, 1.0, 1, 1, 0)

shieldEntitys = heals

--AttachEntityToEntity(shieldEntitys, playerPed, bone, 0.18, 0.0, 0.0, 135.0, -100.0, 0.0, 1, 0, 0, 0, 2, 1)

AttachEntityToEntity(shieldEntitys, playerPed, bone, 0.15, 0.05, -0.01, 180.0, 220.0, 20.0, 1, 1, 0, 0, 2, 1)

-- ["xR"] = 315.0,["yR"] = 288.0, ["zR"] = 0.0

Citizen.Wait(7000)

DeleteEntity(shieldEntitys)

SetPedArmor(playerPed, 30) --30 is the amount of armor

StopAnimTask(PlayerPedId(), '[email protected]_a', 'idle_a', 1.0)
1 Like

Ill give this a shot I believe I tried this same thing but maybe not we will see.

You shoud create armor command and trigger this armor event to the command

Yeah I will.

Okay I just put it in and tried it and then it comes up with this error after using the script.

1 Like

OH I GOT IT, I changed it from SetPedArmor to SetPedArmour.

Thanks for the help man.

2 Likes

Sorry but im on phone so i writed wrong but u solved that.
no problem :blush: