OnPlayerTakeDamage Help
#1

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    new query[500], pname[24];
    GetPlayerName(playerid, pname, 24);
    GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
    if(issuerid != INVALID_PLAYER_ID || issuerid == INVALID_PLAYER_ID)
    {
        if(PlayerInfo[playerid][pHealth] <= 20) // Why won't this work?
        {
            SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
            ApplyAnimation(playerid,"BEACH", "bather", 4.0, 0, 0, 0, 0, 0);
            TogglePlayerControllable(playerid, 0);
        }
        PlayerInfo[playerid][pHealth] -= amount+8; // Cause this works
        SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
        format(query, sizeof(query), "UPDATE playerdata SET Health=%.0f WHERE Username='%s'",
        PlayerInfo[playerid][pHealth],
        pname);
        mysql_query(query);
    }
    return 1;
}
Yeah, basically, I've shown in the code exactly what's wrong.
When I jump off a building and get my health to 20 or less, it's supposed to use the lay animation and not allow my player to be able to move but it's not working.
Reply


Messages In This Thread
OnPlayerTakeDamage Help - by AphexCCFC - 13.02.2013, 22:48
Re: OnPlayerTakeDamage Help - by austin070 - 13.02.2013, 22:54
Re: OnPlayerTakeDamage Help - by AphexCCFC - 13.02.2013, 23:07
Re: OnPlayerTakeDamage Help - by MP2 - 13.02.2013, 23:29
Re: OnPlayerTakeDamage Help - by AphexCCFC - 13.02.2013, 23:36

Forum Jump:


Users browsing this thread: 1 Guest(s)