Jump to content

Dayz medic binds.


21Skrivch

Recommended Posts

Hello ! Im fearly new to scripting and this was my first big "project" to say so i wanted to make it so you can use a bandage for example with a single click.

Everything seems to be okey in my 3 weeks of scripting eyes.



addEventHandler("onClientRender",getRootElement(),function()
    if getElementData(localPlayer,"medicine5") >= 1 then
		dxDrawImage ( 870, 1000, 100, 60, "images/bnd.png" )
	end
	if getElementData(localPlayer,"medicine6") >= 1 then
		dxDrawImage ( 1020, 1000, 70, 70, "images/pain.png")
	end
	if getElementData(localPlayer,"medicine8") >= 1 then
		dxDrawImage ( 720, 1000, 70, 70, "images/mor.png")
	end
	if getElementData(localPlayer,"medicine7") >= 1 then
		dxDrawImage ( 920, 1000, 70, 70, "images/med.png")
	end
end)	
	
	
function useMor ( )
	if show == true then
		if getElementData(localPlayer,"medicine8") >= 1 and getElementData(localPlayer,"brokenbone") then
			setPedAnimation (localPlayer,"BOMBER","BOM_Plant",-1,false,false,false,false)
			setElementData(localPlayer,"medicine8",getElementData(localPlayer,"medicine8")-1)
			setTimer( function ()
				setElementData(localPlayer,"brokenbone",false)
			end,1500,1)
		end
	end
end
bindKey ( "3", "down", useMor )	

function useBnd ( )
	if show == true then
		if getElementData(localPlayer,"medicine5") >= 1 and getElementData(localPlayer,"bleeding") >= 1 then
			setPedAnimation (localPlayer,"BOMBER","BOM_Plant",-1,false,false,false,false)
			setElementData(playersource,"medicine5",getElementData(playersource,"medicine5")-1)
			setTimer( function ()
			setElementData(playersource,"bleeding",0)
			end,1500,1)
		end
	end
end

bindKey ("1", "down", useBnd )

Also debugscript is completely empty so i have honestely no clue oh and it does show signs of life when i spam "1" it lags my framerate a bit (The animation should play do as it is used in medic items in the gamemode i have.spacer.png

 

Edited by 21Skrivch
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...