Problem [REP ++]
#1

I am waaaay too tierd to even try to figure out myself. What is it wrong in here:
pawn Код:
//Under OnPlayerConnect
    SetTimerEx("StatsTimer",1000,1,"i",playerid);
//Somewhere.
forward StatsTimer(playerid);
public StatsTimer(playerid)
{
    new string[128],Float:pH;
    format(string,sizeof(string),"Kills: %i || Deaths: %i || Ratio: %f || Exp: %i || Gun: %s || Kills to top: %i",PlayerInfo[playerid][pKills],PlayerInfo[playerid][pDeaths],(PlayerInfo[playerid][pKills])/(PlayerInfo[playerid][pDeaths])
    /*                                          DO NOT TOUCH                                                    */,PlayerInfo[playerid][pExp],LevelToName(playerid),(hValue)-(PlayerInfo[playerid][pwSkills]));
    printf(string);
    TextDrawSetString(textdraw4,string);
    GetPlayerHealth(playerid,pH);
    SetPlayerHealth(playerid,pH+1);
    return 1;
}
Timer is working. I've tested it with putting printf("TIMER TEST"); and indeed it worked. But when tried to do printf(string); it showed nothing. Also in the server TextDraw's string is not updating. Thanks to all helpers [REPUTATION ++]
Reply
#2

Are you sure the string is long enough?
Reply
#3

Yes. Made it bigger, still not working.
Reply
#4

pawn Код:
printf("Kills: %i || Deaths: %i || Ratio: %f || Exp: %i || Gun: %s || Kills to top: %i",PlayerInfo[playerid][pKills],PlayerInfo[playerid][pDeaths],(PlayerInfo[playerid][pKills])/(PlayerInfo[playerid][pDeaths]),PlayerInfo[playerid][pExp],LevelToName(playerid),(hValue)-(PlayerInfo[playerid][pwSkills]));
?
Reply
#5

Yeah, what I've done is pretty much the same with what you have done. I have made some more tests, It looks like Everything AFTER the format is not processed. The mistake must be there ^^. Yet, I do not see it.
Reply
#6

Instead of format. Delete the format.
Reply
#7

Nevermind. Fixed it. Looks like there were 2 problems. 1st:

Looks like that (PlayerInfo[playerid][pKills])/(PlayerInfo[playerid][pDeaths]) was teh problem.
If pDeaths = 0 it can't be processed .. .Why ? n/0 = *can't be calculated* try on calculator, You cannot divide by 0.

2nd:

(hValue)-(PlayerInfo[playerid][pwSkills]) ... hValue is kinda buggy. So it couldn't be processed for some reasons, still trying to figure out which. THANKS TO EVERYONE ... +REP! (though you helped more or less ...) ^^
Reply
#8

pawn Код:
Kills to top: %i
What are you trying to show here ? I don't understand. Kills and weapon skills don't mix... And could you show how you get the hValue ?
Reply
#9

Sure ^^
pawn Код:
forward TDTimer(playerid);
public TDTimer(playerid)
{
    new pName[24],pLeader,string[56];
    for(new x=0; x<MAX_PLAYERS; x++)
        if(IsPlayerConnected(x))
            if(PlayerInfo[x][pwSkills] >= hValue)
            {
                hValue = PlayerInfo[x][pwSkills];
                pLeader = x;
            }
    GetPlayerName(pLeader,pName,sizeof(pName));
    format(string,sizeof(string),"Leader: %s Kills: %i",pName,hValue);
    TextDrawSetString(textdraw5,string);
    return 1;
}
Reply
#10

pawn Код:
PlayerInfo[playerid][pwSkills] == hValue or hValue == PlayerInfo[playerid][pwSkills]
So your'e subtracting the variable from itself ?

pawn Код:
(hValue)-(PlayerInfo[playerid][pwSkills])
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)