Regeneration Fade
#1

Okay i'm trying to make it so if a players health is 20 or lower, it slowly fades the screen in and out until it regenerates higher then 20.

I'm using seifader. this is what I tried to do;

if(pHealth <= 20)
{
FadeColorForPlayer(playerid,255,0,0,0,255,0,0,255, 25,1000);
return 1;
}

It give's me error's and I don't know how to make it slowly fade back into normal.

Errors: error 010: invalid function or declaration (phealth part)
error 021: symbol already defined: "FadeColorForPlayer" (FadeColorForPlayer part)
error 010: invalid function or declaration (return 1

I want it to be like call of duty regeneration (not perfect but something like it)
Reply
#2

Quote:
Originally Posted by Postalityjr
Посмотреть сообщение
Okay i'm trying to make it so if a players health is 20 or lower, it slowly fades the screen in and out until it regenerates higher then 20.

I'm using seifader. this is what I tried to do;

if(pHealth <= 20)
{
FadeColorForPlayer(playerid,255,0,0,0,255,0,0,255, 25,1000);
return 1;
}

It give's me error's and I don't know how to make it slowly fade back into normal.

Errors: error 010: invalid function or declaration (phealth part)
error 021: symbol already defined: "FadeColorForPlayer" (FadeColorForPlayer part)
error 010: invalid function or declaration (return 1

I want it to be like call of duty regeneration (not perfect but something like it)
pawn Код:
// After #includes

#define healthSecs ( 10 ) // Health will gain every 10 seconds. Change it if you want
#define healthGain ( 1.0 ) // How much health will player get after he waited the desired seconds.

new
    fadeTimer[ MAX_PLAYERS ],
    healTimer[ MAX_PLAYERS ]
;

//OnPlayerConnect

fadeTimer[ playerid ] = SetTimerEx( "healthFade", 100, true, "i", playerid );

// OnPlayerDeath

KillTimer( fadeTimer[ playerid ] );

// Somewhere in your script ( not in a callback / function )

forward healthFade( player ); public healthFade( player )
{
    new Float: pHealth;
    GetPlayerHealth( player, pHealth );

    if ( pHealth <= 20 )
    {
        FadeColorForPlayer( player, 255, 0, 0, 0, 255, 0, 0, 255, 25, 1000 );
        healTimer[ playerid ] = SetTimerEx( "healUser", healthGain * 1000, true, "i", playerid );        
    }

    if ( pHealth > 20 )
    {
        KillTimer( healthFade[ playerid ] );
        KillTimer( healTimer[ playerid ] );
    }

    return 1;
}

forward healUser( player ); public healUser( player )
{
    new Float: pHealth;
    GetPlayerHealth( player, pHealth );
    SetPlayerHealth( player, pHealth + healthGain );

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)