manve1 Posted January 4, 2013 Share Posted January 4, 2013 How can i make that when player health changes, an image file that has been expanded changes, something like vehicle health in race gamemode but with ped health (( i looked into race gamemode but couldn't figure out how to make it myself )). Link to comment
Castillo Posted January 4, 2013 Share Posted January 4, 2013 Do you mean like an image which simulates the health of the player? Link to comment
manve1 Posted January 4, 2013 Author Share Posted January 4, 2013 Yeh something like it shows how much person has health with an image Link to comment
manve1 Posted January 4, 2013 Author Share Posted January 4, 2013 Maybe : Dx ? I know i can use Dx functions, but i'm not sure how to make it to move up and down when player increases/decreases his health Link to comment
iPrestege Posted January 4, 2013 Share Posted January 4, 2013 Maybe : Dx ? I know i can use Dx functions, but i'm not sure how to make it to move up and down when player increases/decreases his health You can use dx when player helth from 1 to 100 so you have to draw 100 dx line if player helth 100 then set it full or if player helth 50 set it half ~ Link to comment
manve1 Posted January 4, 2013 Author Share Posted January 4, 2013 You don't get what i mean by IMAGE? not DX LINE? Link to comment
iPrestege Posted January 4, 2013 Share Posted January 4, 2013 You don't get what i mean by IMAGE? not DX LINE? Ok .. Link to comment
Blaawee Posted January 4, 2013 Share Posted January 4, 2013 (edited) if you take a look in the race gamemode good you find it how [race]\race\fancyprogress * Read This File Good here is the syntax : FancyProgress.create( Minvalue, Maxvalue, 'BackGroundName', X, Y, Width, Height, 'Barname', BarOffset X, BarOffsetY, BarWidth, BarHeight ) an example and it's actully in the race gamemode : healthbar = FancyProgress.create( 250, 1000, 'img/progress_health_bg.png', -65, 60, 123, 30, 'img/progress_health.png', 8, 8, 108, 15 ) healthbar:setProgress( getElementHealth( getPedOccupiedVehicle( localPlayer ) ) ) Edited January 4, 2013 by Guest Link to comment
TAPL Posted January 4, 2013 Share Posted January 4, 2013 Not sure, but i think you need this: dxDrawImageSection Link to comment
manve1 Posted January 4, 2013 Author Share Posted January 4, 2013 if you take a look in the race gamemode good you find it how [race]\race\fancyprogress * Read This File Good here is the syntax : FancyProgress.create( Minvalue, Maxvalue, 'BackGroundName', X, Y, Width, Height, 'Barname', BarOffset X, BarOffsetY, BarWidth, BarHeight ) an example and it's actully in the race gamemode : healthbar = FancyProgress.create( 250, 1000, 'img/progress_health_bg.png', -65, 60, 123, 30, 'img/progress_health.png', 8, 8, 108, 15 ) healthbar:setProgress( getElementHealth( getPedOccupiedVehicle( localPlayer ) ) ) Is the 'FancyProgress.create' exported or something, because i looked into the script and i didn't get anything in there just the resolution. Link to comment
Anderl Posted January 4, 2013 Share Posted January 4, 2013 It isn't, but since race gamemode code is well organised you can simply use the "fancyprogress" or something with "fancy" name ( file ) in your scripts ( might need some things from race so you better check before using it ). Link to comment
Blaawee Posted January 4, 2013 Share Posted January 4, 2013 if you take a look in the race gamemode good you find it how [race]\race\fancyprogress * Read This File Good here is the syntax : FancyProgress.create( Minvalue, Maxvalue, 'BackGroundName', X, Y, Width, Height, 'Barname', BarOffset X, BarOffsetY, BarWidth, BarHeight ) an example and it's actully in the race gamemode : healthbar = FancyProgress.create( 250, 1000, 'img/progress_health_bg.png', -65, 60, 123, 30, 'img/progress_health.png', 8, 8, 108, 15 ) healthbar:setProgress( getElementHealth( getPedOccupiedVehicle( localPlayer ) ) ) Is the 'FancyProgress.create' exported or something, because i looked into the script and i didn't get anything in there just the resolution. no it's hasn't any exported function . what you have to do is take the "fancyprogress " file and put it in your script files and create your script with "fancyprogress" functions , hope you got me Link to comment
manve1 Posted January 4, 2013 Author Share Posted January 4, 2013 Sorry to bother you, but i still don't get how to make it to expand when person loses/gain's health Link to comment
Anderl Posted January 4, 2013 Share Posted January 4, 2013 no it's hasn't any exported function .what you have to do is take the "fancyprogress " file and put it in your script files and create your script with "fancyprogress" functions , hope you got me Did you realise that what you just said is the same I did above? Anyway.. @manve1, you can export functions by yourself in race gamemode but you'd need to have race gamemode started for it to work. Just copy the fancy progress "class" file and use the functions to do it. You create a fancy progress this way: local p_HealthBar = FancyProgress.create( 250, 1000, "PATH_TO_YOUR_BACKGROUND_HEALTH_BAR.png", -65, 60, 123, 30, "PATH_TO_A_LINE_THAT_WILL_COVER_BACKGROUND_AND_WILL_SHOW_HEALTH_STATE.png", 8, 8, 108, 15 ); You might be able to pass nil to some variables like the background picture to put only the "cover" but I haven't checked fancy progress "class" code. You can also make your own "class" of health bars. To set "cover" 's size ( width/height depending on how you put the image on the screen ) simply use the method "setProgress": p_HealthBar:setProgress( SOME_NUMBER_HERE ); Link to comment
manve1 Posted January 4, 2013 Author Share Posted January 4, 2013 Thank you guys, helped Link to comment
manve1 Posted January 5, 2013 Author Share Posted January 5, 2013 How can i get a team's health, for example if one player joins and there is 17people online and then some leave and health bar changes? Link to comment
Anderl Posted January 5, 2013 Share Posted January 5, 2013 Team health? I don't understand you. Link to comment
manve1 Posted January 5, 2013 Author Share Posted January 5, 2013 For instance there is a Team with few members in it. How can i get the image progress bar to change when someone loses/gains/leaves/joins ? Link to comment
TAPL Posted January 5, 2013 Share Posted January 5, 2013 function getTeamHealth(team) if team then HP = 0 for i, player in ipairs(getPlayersInTeam(team)) do HP = HP + getElementHealth(player) end return HP end end Use it with event onPlayerJoin and onPlayerQuit and onPlayerDamage or a timer or whatever. Link to comment
Anderl Posted January 5, 2013 Share Posted January 5, 2013 @TAPL, use local variables. Link to comment
manve1 Posted January 5, 2013 Author Share Posted January 5, 2013 function getTeamHealth(team) if team then HP = 0 for i, player in ipairs(getPlayersInTeam(team)) do HP = HP + getElementHealth(player) end return HP end end Use it with event onPlayerJoin and onPlayerQuit and onPlayerDamage or a timer or whatever. Will this work for an client sided script on a timer? Link to comment
TAPL Posted January 5, 2013 Share Posted January 5, 2013 Yes, since getPlayersInTeam and getElementHealth available client/server side, it should work. 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