Blackout script, Sets screen black on Spawn, OnPlayerUpdate.
#1

pawn Код:
if(LoggedIn[playerid] == 1 && GetPlayerHealth(playerid, health) <= 40 && KnockedOut[playerid] == 0)
        {
            KnockedOut[playerid] = 1;
            ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0,1);
            TextDrawShowForPlayer(playerid,BFText);
            new string[128];
            format(string, sizeof(string), "* %s has lost consciousness due to their injuries *", GetNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
        }
This is the detection I use, but when I spawn it processes all of that and doesn't apply the animation, could anyone assist me?

Thanks.
Reply
#2

Have you tried to preload that animation ?
Код:
OnPlayerSpawn( playerid )
{
    ApplyAnimation( playerid, "CRACK", "NULL", 0, 0, 0, 0, 0, 0 );
}
Reply
#3

Already reload it, also. It doesn't explain when I login that I'm instantly blackscreened.
Reply
#4

Код:
OnPlayerSpawn( playerid )
{
    ApplyAnimation( playerid, "CRACK", "NULL", 0, 0, 0, 0, 0, 0 );
}

OnPlayerUpdate( playerid )
{
    new Float:health;
    GetPlayerHealth( playerid, health );

    if( LoggedIn[playerid] == 1 && health <= 40 && KnockedOut[playerid] == 0)
    {
        KnockedOut[playerid] = 1;
        ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0,1);
	TextDrawShowForPlayer(playerid,BFText);

        new string[128];
	format(string, sizeof(string), "* %s has lost consciousness due to their injuries *", GetNameEx(playerid));
			ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
    }
}
GetPlayerHealth( playerid, &health ) shouldn't be used in 'if' statement
Reply
#5

I'll give that a try, thanks!

EDIT: WORKS, THANK YOU!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)