Something is blocking animations.
#1

Hello, I created an intro for my server. In the end there is an animation but it isn't applying. Why?

pawn Код:
public OnFadeComplete(playerid,beforehold)
{
    if (beforehold)
    {
        if (introstop[playerid] == 2)
        {
            TogglePlayerSpectating(playerid, 0);
            TogglePlayerControllable(playerid, 1);
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid, 1900.3048,-1600.3887,13.5526);
            SetPlayerFacingAngle(playerid, 276.2729);
            ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 1, 0, 0, 0, 0, 1);
            SetPlayerCameraPos(playerid, 1893.487548, -1602.461914, 19.122800);
            SetPlayerCameraLookAt(playerid, 1896.553955, -1601.187622, 16.892684);
            FadeColorForPlayer(playerid, 0, 0, 0, 255, 0, 0, 0, 0, 25, 0);
            SCM(playerid, COLOR_YELLOW, "Дrkasid mдluauguga tдnaval ning kьsid endalt mхttes \"Mis juhtus?\".");
            introstop[playerid] = 0;
        }
        else SetCameraBehindPlayer(playerid);
    }
    return 1;
}
Reply
#2

This is because the animation library has not been loaded for the player. Meaning the animation will only play the second time around. Add the following to your code:

Under OnPlayerConnect:
pawn Код:
PreloadAnimLib(playerid,"BOMBER");
PreloadAnimLib(playerid,"RAPPING");
PreloadAnimLib(playerid,"SHOP");
PreloadAnimLib(playerid,"BEACH");
PreloadAnimLib(playerid,"SMOKING");
PreloadAnimLib(playerid,"FOOD");
PreloadAnimLib(playerid,"ON_LOOKERS");
PreloadAnimLib(playerid,"DEALER");
PreloadAnimLib(playerid,"CRACK");
PreloadAnimLib(playerid,"CARRY");
PreloadAnimLib(playerid,"COP_AMBIENT");
PreloadAnimLib(playerid,"PARK");
PreloadAnimLib(playerid,"INT_HOUSE");
PreloadAnimLib(playerid,"FOOD" );
PreloadAnimLib(playerid,"PED" );
Anywhere in your script (NOT UNDER A CALLBACK!):
pawn Код:
PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}
Example:
pawn Код:
public OnPlayerConnect(playerid)
{
    PreloadAnimLib(playerid,"BOMBER");
    PreloadAnimLib(playerid,"RAPPING");
    PreloadAnimLib(playerid,"SHOP");
    PreloadAnimLib(playerid,"BEACH");
    PreloadAnimLib(playerid,"SMOKING");
    PreloadAnimLib(playerid,"FOOD");
    PreloadAnimLib(playerid,"ON_LOOKERS");
    PreloadAnimLib(playerid,"DEALER");
    PreloadAnimLib(playerid,"CRACK");
    PreloadAnimLib(playerid,"CARRY");
    PreloadAnimLib(playerid,"COP_AMBIENT");
    PreloadAnimLib(playerid,"PARK");
    PreloadAnimLib(playerid,"INT_HOUSE");
    PreloadAnimLib(playerid,"FOOD" );
    PreloadAnimLib(playerid,"PED" );
    return 1;
}

PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}
Reply
#3

Already preloaded...
Reply
#4

Ah... the chances are that TogglePlayerSpectating(playerid, 0); may be causing the issue. When you are disabling spectate, OnPlayerSpawn is called. So I think you would be better off placing this under OnPlayerSpawn, like so:

pawn Код:
public OnPlayerSpawn(playerid)
{
    if (beforehold)
    {
        if (introstop[playerid] == 2)
        {
            TogglePlayerControllable(playerid, 1);
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid, 1900.3048,-1600.3887,13.5526);
            SetPlayerFacingAngle(playerid, 276.2729);
            ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 1, 0, 0, 0, 0, 1);
            SetPlayerCameraPos(playerid, 1893.487548, -1602.461914, 19.122800);
            SetPlayerCameraLookAt(playerid, 1896.553955, -1601.187622, 16.892684);
            FadeColorForPlayer(playerid, 0, 0, 0, 255, 0, 0, 0, 0, 25, 0);
            SCM(playerid, COLOR_YELLOW, "Дrkasid mдluauguga tдnaval ning kьsid endalt mхttes \"Mis juhtus?\".");
            introstop[playerid] = 0;
        }
        else SetCameraBehindPlayer(playerid); //Not sure if this is entirely needed here (Doesn't need to be repeated)
        //return 1; //If you don't want to use any more code past this point, add this return 1; here.
    }
    //rest of code
    return 1;
}

public OnFadeComplete(playerid,beforehold)
{
    if (beforehold)
    {
        if (introstop[playerid] == 2)
        {
            TogglePlayerSpectating(playerid, 0);
        }
        else SetCameraBehindPlayer(playerid);
    }
    return 1;
}
Reply
#5

Yeah, it fixed it. 0ms timer does the job, too. Repped.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)