Frozen Camera
#1

Hi, I made an auto-crack system but the camera moves to above the player, Can I change this without removing the TogglePlayerControllable

pawn Код:
forward checkcrack(playerid);
public checkcrack(playerid)
{
    new Float:h;
    GetPlayerHealth(playerid, h);
    if(h < 20)
    {
        if(iscracked[playerid] == 0)
        {
            new Float:u, Float:u2, Float:u3;
            GetPlayerPos(playerid, u, u2, u3);
            iscracked[playerid] = 1;
            TogglePlayerControllable(playerid, 0);
            SetCameraBehindPlayer(playerid);
            ApplyAnimation(playerid,"CRACK","crckdeth2",4.0,1,0,0,0,1);
            ApplyAnimation(playerid,"CRACK","crckdeth2",4.0,1,0,0,120000,1);
            cracktime[playerid] = SetTimerEx("uncrack", 120000, false, "i", playerid);
            CrackLabel[playerid] = Create3DTextLabel("Injured", COLOR_RED, u, u2, u3, 15, 0);
        }
    }
    return 1;
}
Reply
#2

as first why you make the health define a float?:
Код:
 new Float:h;
    GetPlayerHealth(playerid, h);
    if(h < 20)
i think you should change that as first to new h; and not new Float:h;
Reply
#3

There is nothing much you can do, nevertheless you can do this. It's not perfect though.
Replace the current TogglePlayerControllable with TogglePlayerControllableEx.
pawn Код:
new
    CrackVariable[ MAX_PLAYERS ]
;
pawn Код:
stock TogglePlayerControllableEx( playerid, bool:toggle )
{
    if( toggle )
        CrackVariable[ playerid ] = SetTimerEx( "CrackTimer", 100, true, "i", playerid );
    else
        KillTimer( CrackVariable[ playerid ] );

    return 1;
}
pawn Код:
forward CrackTimer( playerid );
public CrackTimer( playerid )
{
    new
        Float:x,
        Float:y,
        Float:z
    ;
   
    GetPlayerPos( playerid, x, y, z );
    SetPlayerPos( playerid, x, y, z );
    SetCameraBehindPlayer( playerid );
    // Set the anim afterwards.
   
    return 1;
}
Reply
#4

Quote:
Originally Posted by niels44
Посмотреть сообщение
as first why you make the health define a float?:
Код:
 new Float:h;
    GetPlayerHealth(playerid, h);
    if(h < 20)
i think you should change that as first to new h; and not new Float:h;
Excuse me but health is a float.
So Its not wrong here,
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)