SA-MP Forums Archive
Score timer does not work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Score timer does not work (/showthread.php?tid=373446)



Score timer does not work - Johnson_Brooks - 30.08.2012

I've request a score timer in the script request thread #5,it seemed to be working but it doesn't.
Here's the code:
pawn Код:
#include <a_samp>
new ScoreTimer;

public OnPlayerUpdate(playerid)
{
    new time = gettime();
    if(ScoreTimer < time)
    {
        ScoreTimer++;
    }
    if(ScoreTimer == 60)
    {
        new score = GetPlayerScore(playerid);
        SetPlayerScore(playerid, score+1);
        ScoreTimer = 0;
    }
    return 1;
}
Whats really wrong?


Re: Score timer does not work - Johnson_Brooks - 30.08.2012

Nobody ?


Re: Score timer does not work - Jessyy - 30.08.2012

"new time = gettime();" will return something like this "1346348439"
OnPlayerUpdate(playerid) - "This callback is called very frequently per second per player, only use it when you know what it's meant for."

I do not understand exactly what you're doing whit this script ...
"a score timer" ... Explain a bit more ...


Re: Score timer does not work - lamarr007 - 30.08.2012

pawn Код:
#include <a_samp>
new ScoreTimer[MAX_PLAYERS];
new ScoreTimerr[MAX_PLAYERS];

forward UpdateScore(playerid);

public OnPlayerConnect(playerid)
{
    ScoreTimerr[playerid] = SetTimerEx("UpdateScore", 1000, true, "i", playerid);
    ScoreTimer[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    KillTimer(ScoreTimerr[playerid]);
    return 1;
}

public UpdateScore(playerid)
{
    ScoreTimer[playerid] ++;
    if(ScoreTimer[playerid] == 60)
    {
        SetPlayerScore(playerid, GetPlayerScore(playerid) +1);
        ScoreTimer[playerid] = 0;
    }
    return 1;
}



Re: Score timer does not work - Johnson_Brooks - 30.08.2012

Never mind both of you.
Solved.
And a score timer is a score timer,what you did not understood?
And don't make me think that you did not understood what i meant because i provided you a code so stfu.


Re: Score timer does not work - playbox12 - 30.08.2012

Quote:
Originally Posted by Johnson_Brooks
Посмотреть сообщение
Never mind both of you.
Solved.
And a score timer is a score timer,what you did not understood?
And don't make me think that you did not understood what i meant because i provided you a code so stfu.
There is really no need to be insultibe.They are trying to help you and you are telling them to shut the fuck up. A score timer doesn't make sense, it's just a name that you use someone else might call it differently. Now I understand it increases the score every minute but maybe someone else doesn't.


Re: Score timer does not work - Johnson_Brooks - 30.08.2012

I didn't insult him.
I got a little bit pissed of because he double posted to increase his post count.
I provided a code and he asked me what exactly i mean by saying score timer.
That means he didn't even read the whole topic but just the subject.