Jump to content

Simple question


manve1

Recommended Posts

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
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 :mrgreen: if player helth 100 then set it full or if player helth 50 set it half ~ :mrgreen:

Link to comment

if you take a look in the race gamemode good you find it how

[race]\race\fancyprogress

* Read This File Good :mrgreen:

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 by Guest
Link to comment
if you take a look in the race gamemode good you find it how

[race]\race\fancyprogress

* Read This File Good :mrgreen:

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
if you take a look in the race gamemode good you find it how

[race]\race\fancyprogress

* Read This File Good :mrgreen:

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 :D

Link to comment
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 :D

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
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
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

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...