Lally Posted January 22, 2017 Share Posted January 22, 2017 Hello community! I myself need a little help. I like when the car has 300 hp appear as an icon on the screen as the kicker motor. But I can not find the wiki community. Here is what I tried to do: Quote function createSpeedo() cars = getElementsByType("vehicle",root,true) for num, car in ipairs(cars) do local dividedCarHealth = getElementHealth(car) / 10 local motor = math.floor(getElementHealth(car)) if motor > 500 then dxDrawImage( screenWidth - 200, 32,32,37,"images/hud/damage.png") ax = ax - 34 end end end Link to comment
Abu-Solo Posted January 22, 2017 Share Posted January 22, 2017 7 minutes ago, Lally said: Hello community! I myself need a little help. I like when the car has 300 hp appear as an icon on the screen as the kicker motor. But I can not find the wiki community. Here is what I tried to do: Is there's anything comes up in debugscript 3? Link to comment
Lally Posted January 22, 2017 Author Share Posted January 22, 2017 It does not appear in debug anything Link to comment
idarrr Posted January 22, 2017 Share Posted January 22, 2017 function createSpeedo() cars = getElementsByType("vehicle",root,true) for num, car in ipairs(cars) do local carHP = math.floor(getElementHealth(car) / 10) if carHP < 500 then dxDrawImage( screenWidth - 200, 32,32,37,"images/hud/damage.png") ax = ax - 34 end end end 1 Link to comment
Lally Posted January 23, 2017 Author Share Posted January 23, 2017 Thank you very much! But now I have another problem. Gender car if I stay out of the picture and not get rid of it until you are back in that car hp. If you can help me with this problem. Link to comment
idarrr Posted January 23, 2017 Share Posted January 23, 2017 1 hour ago, Lally said: Thank you very much! But now I have another problem. Gender car if I stay out of the picture and not get rid of it until you are back in that car hp. If you can help me with this problem. Here you go. function createSpeedo() cars = getElementsByType("vehicle",root,true) for num, car in ipairs(cars) do local carHP = math.floor(getElementHealth(car) / 10) if carHP < 500 then local theVehicle = getPedOccupiedVehicle(getLocalPlayer()) if theVehicle then dxDrawImage( screenWidth - 200, 32,32,37,"images/hud/damage.png") ax = ax - 34 end end end end Or try this one, it's more simple and more efective. function createSpeedo() local theVehicle = getPedOccupiedVehicle(getLocalPlayer()) -- Check if the player is in Vehicle, if he is not in any vehicle then it will return false if theVehicle then -- If true (the player is in his Vehicle), this argument will pass this block and execute the code below local carHP = math.floor(getElementHealth(theVehicle) / 10) if carHP < 500 then dxDrawImage( screenWidth - 200, 32,32,37,"images/hud/damage.png") ax = ax - 34 end end end 1 Link to comment
Lally Posted January 23, 2017 Author Share Posted January 23, 2017 (edited) When leaving the car damaged the image disappears but when I climb into another car appears to me that it is not damaged though. I did something but nush if you can help solve the problem cars = getElementsByType("vehicle",root,true) for num, car in ipairs(cars) do local carHP = math.floor (getElementHealth(car)) if carHP < 640 then local getTickStart = getTickCount () getTickStart = math.floor(getTickStart / 1000) if math.mod(getTickStart, 2) == 0 then local masina = getPedOccupiedVehicle(getLocalPlayer()) if masina then dxDrawImage( screenWidth - 200, 970,32,37,"images/hud/accident.png") ax = ax - 34 end end end end Edited January 23, 2017 by Lally Link to comment
idarrr Posted January 23, 2017 Share Posted January 23, 2017 15 minutes ago, Lally said: When leaving the car damaged the image disappears but when I climb into another car appears to me that it is not damaged though. I did something but nush if you can help solve the problem cars = getElementsByType("vehicle",root,true) for num, car in ipairs(cars) do local carHP = math.floor (getElementHealth(car)) if carHP < 640 then local getTickStart = getTickCount () getTickStart = math.floor(getTickStart / 1000) if math.mod(getTickStart, 2) == 0 then local masina = getPedOccupiedVehicle(getLocalPlayer()) if masina then dxDrawImage( screenWidth - 200, 970,32,37,"images/hud/accident.png") ax = ax - 34 end end end end Yes because you are looping all vehicles that streamed by client. Try this. function createSpeedo() local theVehicle = getPedOccupiedVehicle(getLocalPlayer()) -- Check if the player is in Vehicle, if he is not in any vehicle then it will return false if theVehicle then -- If true (the player is in his Vehicle), this argument will pass this block and execute the code below local carHP = math.floor(getElementHealth(theVehicle) / 10) if carHP < 500 then dxDrawImage( screenWidth - 200, 32,32,37,"images/hud/damage.png") ax = ax - 34 end end end 1 Link to comment
Lally Posted January 23, 2017 Author Share Posted January 23, 2017 I tried and there is no picture. If you look over what I've done is good in the sense that meaning appears disappears just do not adapt the car where you are. Link to comment
idarrr Posted January 23, 2017 Share Posted January 23, 2017 Try this. cars = getElementsByType("vehicle",root,true) for num, car in ipairs(cars) do local carHP = math.floor (getElementHealth(car)) if carHP < 640 then local getTickStart = getTickCount () getTickStart = math.floor(getTickStart / 1000) if math.mod(getTickStart, 2) == 0 then local masina = getPedOccupiedVehicle(getLocalPlayer()) if masina then if masina == car then dxDrawImage( screenWidth - 200, 970,32,37,"images/hud/accident.png") ax = ax - 34 end end end end end 1 Link to comment
Lally Posted January 23, 2017 Author Share Posted January 23, 2017 Man're brilliant. Thank you very much. If I can afford help if I need to give you and talk pm. Link to comment
idarrr Posted January 23, 2017 Share Posted January 23, 2017 36 minutes ago, Lally said: Man're brilliant. Thank you very much. If I can afford help if I need to give you and talk pm. Np dude, PM me if you need help, maybe I can help you 1 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