local useItem = {};
function onPlayerUseMedicObject(itemName)
local playersource = source
if ( not useItem[playersource] ) then
useItem[playersource] = true;
setPedAnimation (playersource,"BOMBER","BOM_Plant",2,true,false,nil,false)
setTimer( function ()
if itemName == "Bandage" then
setElementData(playersource,"bleeding",0)
setElementData(playersource,itemName,getElementData(playersource,itemName)-1)
elseif itemName == "First Aid Kit" then
setElementData(playersource,"blood",getElementData(playersource,"blood")+math.random(3000,9000))
setElementData(playersource,"bleeding",0)
setElementData(playersource,itemName,getElementData(playersource,itemName)-1)
elseif itemName == "Warmer" then
setElementData(playersource,"cold",false)
setElementData(playersource,"temperature",37)
setElementData(playersource,itemName,getElementData(playersource,itemName)-1)
elseif itemName == "Painkiller" then
setElementData(playersource,"pain",false)
setElementData(playersource,itemName,getElementData(playersource,itemName)-1)
elseif itemName == "Morphine" then
setElementData(playersource,"brokenbone",false)
setElementData(playersource,itemName,getElementData(playersource,itemName)-1)
elseif itemName == "Antibiotics" then
setElementData(playersource,"bleeding",0)
setElementData(playersource,"infection",false)
setElementData(playersource,itemName,getElementData(playersource,itemName)-1)
end
useItem[playersource] = nil;
end,2500,1)
triggerClientEvent(playersource,"refreshInventoryManual",playersource)
end
end
addEvent("onPlayerUseMedicObject",true)
addEventHandler("onPlayerUseMedicObject",getRootElement(),onPlayerUseMedicObject)