SA-MP Forums Archive
[Ajuda] Indentificando amount - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Indentificando amount (/showthread.php?tid=444709)



Indentificando amount - iStronG - 17.06.2013

Eu queria saber o devo fazer nessa parte no sistema de dano:

format(str, sizeof(str), "~r~ %d", amount);

Eu tava colocando %d e ta dando uns numero cabuloso como eu identifico o dano da arma? jб tentei de varios jeitos..



Re: Indentificando amount - Gii - 17.06.2013

Se nгo me engano amount no caso й do tipo float entгo usa-se %f.


Re: Indentificando amount - iStronG - 17.06.2013

%f deu nгo.


Re: Indentificando amount - Gii - 17.06.2013

Quote:
Originally Posted by iStronG
Посмотреть сообщение
%f deu nгo.
Qual nъmero esta sendo mostrado? Se possнvel mostre o trecho do cуdigo.


Re: Indentificando amount - iStronG - 17.06.2013

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    MostrarTextVida(playerid);
    if(issuerid != INVALID_PLAYER_ID)
    {
        //No Evento de Sniper
        if(InEvento[issuerid] == 1)
        {
            if(InEvento[playerid] == 1)
            {
                if(weaponid == 34)
                {
                    SetPlayerHealth(playerid, 0);
                    SetPlayerArmour(playerid, 0);
                }
                if(weaponid == 6)
                {
                    new Float: Tcolete;
                    GetPlayerArmour(playerid, Tcolete);
                    if(Tcolete > 0)
                    {
                        SetPlayerArmour(playerid, 0);
                    }
                    else
                    {
                        SetPlayerHealth(playerid, 0);
                        SetPlayerArmour(playerid, 0);
                    }
                }
            }
        }
        //No Evento Guerra de Eagle
        if(InEvento[issuerid] == 2)
        {
            if(InEvento[playerid] == 2)
            {
                if(weaponid == 24)
                {
                    SetPlayerHealth(playerid, 0);
                    SetPlayerArmour(playerid, 0);
                }
            }
        }
        //
    }
    if(IsPlayerConnected(playerid))
    {
        new str[256];
        //===================[ playerid ]==================================
        new Float:health;
        GetPlayerHealth(playerid, health);
        if(issuerid == INVALID_PLAYER_ID)
        {
            KillTimer(TempoMostrarLife[playerid]);
            TextDrawShowForPlayer(playerid, MostrarVida[playerid]);
            format(str, sizeof(str), "~r~ %f", amount);
            GameTextForAll(str, 8000, 4);
            TempoMostrarLife[playerid] = SetTimerEx("HideTextoLife", 3000, 0, "i", playerid);
            MostrandoVida[playerid] = 1;
        }
        else
        {
            KillTimer(TempoMostrarLife[playerid]);
            TextDrawShowForPlayer(playerid, MostrarVida[playerid]);
            format(str, sizeof(str), "~p~ %f", amount);
            GameTextForAll(str, 8000, 4);
            TempoMostrarLife[playerid] = SetTimerEx("HideTextoLife", 3000, 0, "i", playerid);
            MostrandoVida[playerid] = 1;
        }
        //==================[ issuerid ] ======================================
        KillTimer(TempoMostrarLife[issuerid]);
        TextDrawShowForPlayer(issuerid, MostrarVida[issuerid]);
        format(str, sizeof(str), "~r~ %f", amount);
        GameTextForAll(str, 8000, 4);
        TempoMostrarLife[issuerid] = SetTimerEx("HideTextoLife", 3000, 0, "i", issuerid);
        MostrandoVida[issuerid] = 1;
    }
    return 1;
}
lavai a parte toda


Re: Indentificando amount - Gii - 17.06.2013

Tente usar %.0f para ser mostrado um nъmero de certa forma mais agradбvel.


Re: Indentificando amount - iStronG - 17.06.2013

Valeu muito obrigado.