ScoreTimer only works for ID 0 (or the first player connects)
#1

Well my score timer works nice for me. But when my friend join my server after waiting almost 10 minutes still he got 0 score. But I've got 3 score added on my stats.

Info: It will basically add 1 score every 3 minutes...

pawn Код:
SetTimerEx("ScoreTimer", 1000, 0, "d", playerid);
pawn Код:
forward ScoreTimer(playerid);
public ScoreTimer(playerid)
{
    if(!IsPlayerConnected(playerid)) return 1;
    AccInfo[playerid][pSecondScore] += 1;
    if(AccInfo[playerid][pSecondScore] >= SCORE_TIME)
    {
        SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
        AccInfo[playerid][pSecondScore] = 0;
    }
    SetTimerEx("ScoreTimer", 1000, 0, "d", playerid);
    return 1;
}
Reply
#2

pawn Код:
SetTimerEx("ScoreTimer", 1000, true, "d", playerid);
pawn Код:
forward ScoreTimer(playerid);
public ScoreTimer(playerid)
{
    if(!IsPlayerConnected(playerid)) return 0;
    AccInfo[playerid][pSecondScore] += 1;
    if(AccInfo[playerid][pSecondScore] >= SCORE_TIME)
    {
        SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
        AccInfo[playerid][pSecondScore] = 0;
    }
    return 1;
}
Reply
#3

just loop through connected players.

pawn Код:
porward ScoreTimer(playerid);
public ScoreTimer(playerid)
{
    for(new l = GetMaxPlayers(); playerid < l; ++playerid) {
        if(IsPlayerConnected(playerid)) {
            AccInfo[playerid][pSecondScore] += 1;
            if(AccInfo[playerid][pSecondScore] >= SCORE_TIME) {
                SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
                AccInfo[playerid][pSecondScore] = 0;
            }
        }
    }
    return 1;
}
Reply
#4

Okay thanks! +rep both, but i still didn't try i yet.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)