format + float + Linux = Ё%*@#(!*Ё!@
#1

pawn Код:
new Float:Objective = GetVictimsTotalHealth(playerid), Float:Hits = GetAmountTakenFromVictims(playerid), Float:Result;
Result = floatmul(floatdiv(Hits, Objective), 100.0);
format(str[1], sizeof str[], "~n~Victims -- (Hits percent: %.1f):", Result);
On the host, when I try to show these things in a textdraw it appears wrong, a lot of strong symbols like: @(Ё#!&#ЁЁ!, on Windows(my PC) it works perfectly.
Reply
#2

Are you sure that Objective can never become 0?

And can you show me where you create the variable Result please?
Reply
#3

Try this:
pawn Код:
format(str[1], 128, "~n~Victims -- (Hits percent: %.1f):", Result);
Reply
#4

Quote:
Originally Posted by ғαιιοцт
Посмотреть сообщение
Are you sure that Objective can never become 0?

And can you show me where you create the variable Result please?
First line of the my post, I tried it in a round that I killed 3 players without die, so...

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Try this:
pawn Код:
format(str[1], 128, "~n~Victims -- (Hits percent: %.1f):", Result);
The problem can't be there, I used "sizeof str[]" instead of "sizeof str" because the array is bi-dimensional.

Here is the declaration:

pawn Код:
new str[2][(sizeof substr) * (PER_ROUND_ATTACKERS)];
Reply
#5

Oh sorry, i can't see the end of that first line on my ipod, the text shows bigger here and doesn't fit on the page.
Reply
#6

Looks fine for me on my linux machine. Show me your str variable deceleration.
Reply
#7

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
Looks fine for me on my linux machine. Show me your str variable deceleration.
http://pastebin.com/UpkkV3aT
Reply
#8

print the values of Hits and Objective and get back to me here
Reply
#9

The problem can be on these things:

1) GetVictimsTotalHealth.
2) GetAmountTakenFromVictims.
3) str.
Reply
#10

Thanks for all.

Quote:
Originally Posted by Kar
Посмотреть сообщение
print the values of Hits and Objective and get back to me here
pawn Код:
DEBUG-ROUNDSTATS: HITS: 46.2 OBJECTIVE: 0.0
DEBUG-ROUNDSTATS: HITS: 56.1 OBJECTIVE: 0.0
DEBUG-ROUNDSTATS: HITS: 227.7 OBJECTIVE: 0.0
DEBUG-ROUNDSTATS: HITS: 29.7 OBJECTIVE: 0.0
DEBUG-ROUNDSTATS: HITS: 108.9 OBJECTIVE: 0.0
DEBUG-ROUNDSTATS: HITS: 183.1 OBJECTIVE: 0.0
DEBUG-ROUNDSTATS: HITS: 46.2 OBJECTIVE: 0.0
DEBUG-ROUNDSTATS: HITS: 92.4 OBJECTIVE: 0.0
DEBUG-ROUNDSTATS: HITS: 46.2 OBJECTIVE: 0.0
DEBUG-ROUNDSTATS: HITS: 89.1 OBJECTIVE: 0.0
I didn't have made any test of this yet, just now I can see that objective is always 0.0, I'll check what happens.

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
The problem can be on these things:

1) GetVictimsTotalHealth.
2) GetAmountTakenFromVictims.
3) str.
pawn Код:
Float:GetAmountTakenFromVictims(playerid)
{
    new Float:GivenDamage;
    for(new i = 0; i < PER_ROUND_ATTACKERS; i++)
    {
        for(new p = 0; p < MAX_PLAYERS; p++)
        {
            if(DamageGiven[p][i][attacker] == playerid)
            {
                GivenDamage += DamageGiven[p][i][damage_amount];
            }
        }
    }
    return GivenDamage;
}

Float:GetVictimsTotalHealth(playerid)
{
    new Float:hCount;
    for(new i = 0; i < PER_ROUND_ATTACKERS; i++)
    {
        if(IsPlayerConnected(DamageTaken[playerid][i][victim]) && DamageTaken[playerid][i][in_use])
        {
            hCount += pTotalHealth[DamageTaken[playerid][i][victim]];
        }
    }
    return hCount;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)