SA-MP Forums Archive
Blackout script, Sets screen black on Spawn, OnPlayerUpdate. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Blackout script, Sets screen black on Spawn, OnPlayerUpdate. (/showthread.php?tid=563709)



Blackout script, Sets screen black on Spawn, OnPlayerUpdate. - Dokins - 16.02.2015

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.


Re: Blackout script, Sets screen black on Spawn, OnPlayerUpdate. - sw3das - 16.02.2015

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



Re: Blackout script, Sets screen black on Spawn, OnPlayerUpdate. - Dokins - 16.02.2015

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


Re: Blackout script, Sets screen black on Spawn, OnPlayerUpdate. - sw3das - 16.02.2015

Код:
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


Re: Blackout script, Sets screen black on Spawn, OnPlayerUpdate. - Dokins - 16.02.2015

I'll give that a try, thanks!

EDIT: WORKS, THANK YOU!