boro Posted September 29, 2012 Share Posted September 29, 2012 Hi all,today I tried to make a script to display kills and deaths on-screen player but not run and no error in the log and the script don't work what is wrong? Please advise anyone thx. this is lua addEventHandler ( "onClientRender", root, playerstatus1 ) function playerstatus ( ) if isPedJoin (localPlayer) == false then return end kills = getElementKills (getPedJoin(localPlayer)) deaths = getElementDeaths (getPedJoin(localPlayer)) screenWidth, screenHeight = guiGetScreenSize() windowWidth, windowHeight = 300,170 left = screenWidth/1.15 - windowWidth/9.8 top = screenHeight/1.15 - windowHeight/20 dxDrawText ( "Kills: "..tostring(speed).."Kills", left, top, screenWidth, screenHeight, tocolor ( 200, 200, 200, 255 ), 1.5, "arial" ) dxDrawText ( "Deaths: "..tostring(currenthealth).."Deaths", left, top -25, screenWidth, screenHeight, tocolor ( 200, 200, 200, 255 ), 1.5, "arial" ) end Link to comment
Mossy Posted September 29, 2012 Share Posted September 29, 2012 try addEventHandler ( "onClientRender", root, getElementData ) function getElementData ( ) if isPedJoin (localPlayer) == false then return end kills = getElementKills (getPedJoin(localPlayer)) deaths = getElementDeaths (getPedJoin(localPlayer)) screenWidth, screenHeight = guiGetScreenSize() windowWidth, windowHeight = 300,170 left = screenWidth/1.15 - windowWidth/9.8 top = screenHeight/1.15 - windowHeight/20 dxDrawText ( "Kills: "..tostring(speed).."Kills", left, top, screenWidth, screenHeight, tocolor ( 200, 200, 200, 255 ), 1.5, "arial" ) dxDrawText ( "Deaths: "..tostring(currenthealth).."Deaths", left, top -25, screenWidth, screenHeight, tocolor ( 200, 200, 200, 255 ), 1.5, "arial" ) end Link to comment
Anderl Posted September 29, 2012 Share Posted September 29, 2012 addEventHandler('onClientRender', root, function() --if (not isPedJoin(localPlayer)) then return end || I can't really understand what you want with this and it makes no sense unless you say what 'isPedJoin' means --local nKills = getElementKills(getPedJoin(localPlayer)) || this makes no sense too local nKills = getElementKills(localPlayer) -- is 'getElementKills' function defined? --local nDeath = getElementDeaths(getPedJoin(localPlayer)) || this makes no sense too local nDeath = getElementDeaths(localPlayer) -- is 'getElementDeaths' defined? -- local fScreenX, fScreenY = guiGetScreenSize() local nWndWidth, nWndHeight = 300, 170 local fLeft, fTop = fScreenX/1.15 - nWndWidth/9.8, fScreenY/1.15 - nWndHeight/20 -- local szKills = string.format('Kills: %s', nKills) local szDeath = string.format('Deaths: %s', nDeath) dxDrawText(szKills, fLeft, fTop, fScreenX, fScreenY, tocolor(200, 200, 200, 255), 1.5, "arial") dxDrawText(szDeath, fLeft, fTop-25, fScreenX, fScreenY, tocolor(200, 200, 200, 255), 1.5, "arial") end ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now