[ESX] [Help] [Request] bandage scirpt

i am trying to make script for bandage that heals you for amount of hp but i don’t think the script i wrote it’s right and makes sense but i am new to this, any chances for helping me doing it right? and how i need to add and icon to my inventory just a script and i will do the other thing :smile:

Cluent lua

AddEventHandler(‘esx_bandage:bandage’, function()
local playerPed = GetPlayerPed(-1)

  local Medkit = AttachEntityToPed('prop_med_bag_01',60309, 0,0,0, 0,0,0) 
  PlayAnim(GetPlayerPed(-1),'[email protected]@[email protected]','base',4,3000)
            StopAnimTask(GetPlayerPed(-1), '[email protected]@[email protected]','idle_c',2.0)

  local newHealth = (health + 25)
       health = GetEntityHealth(GetPlayerPed(-1))
  SetEntityHealth(GetPlayerPed(-1), health + 25)

Server lua

ESX = nil

ESX.RegisterUsableItem(‘bandage’, function(source)
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.removeInventoryItem(‘bandage’, 1)
TriggerClientEvent(‘esx_bandage:bandage’, source)
1 Like

First remove the thread, that’s unnecessary if u only need to call this once. After that remove the newHealth line, it’s calling to a nil var(health is defined on next line). Then run the script, it’s should work I think

1 Like

did you get this working?

Working on it :smiley: i am doing and many other stuff and i don’t really have time to test out things,if i get it to work i will maybe post it if someone wants to use it.

hey man I found a bandage on the Esx Ambulancejob script

i don’t really wanna do copy from others because if i touch something the whole script is breaking,normally that’s happening,making it by my own is better. :smiley:

Not working this way.i’ve been told “You aren’t making the object and you aren’t requesting the animation” and i can’t do anything :smiley: i don’t know how.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.