Score Problem
#1

I have problem with the score. I want every minute = 1 score.
I have this on OnGameModeInit
pawn Код:
SetTimer("Online",60000,1);
And this
pawn Код:
forward Online();
public Online()
{
    for(new i = 0;i != MAX_PLAYERS;++i)
    {
        SetPlayerScore(i, GetPlayerScore(i)+1);
    }
    return 1;
}
I have test it on localhost:7777 and works fine, 1 minute = 1 score.
Then I upload it on the server but it doesn't work. The score doesn't update every minute.
What I have wrong with this?
Reply
#2

Debug it:
pawn Код:
public Online()
{
    for(new i = 0;i != MAX_PLAYERS;++i)
    {
        SetPlayerScore(i, GetPlayerScore(i)+1);
        print("Called");
    }
    return 1;
}
Reply
#3

I kept the
pawn Код:
SetTimer("Online",60000,1);
And I replace this
pawn Код:
forward Online();
public Online()
{
    for(new i = 0;i != MAX_PLAYERS;++i)
    {
        SetPlayerScore(i, GetPlayerScore(i)+1);
    }
    return 1;
}
To
pawn Код:
public Online()
{
    for(new i = 0;i != MAX_PLAYERS;++i)
    {
        SetPlayerScore(i, GetPlayerScore(i)+1);
        print("Called");
    }
    return 1;
}
But I got a warning
pawn Код:
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(6650) : warning 235: public function lacks forward declaration (symbol "Online")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Should I add
pawn Код:
forward Online();
Reply
#4

pawn Код:
forward Online();
Reply
#5

Ok thank you!
Reply
#6

Sorry for double post, but again the score bugged. After 20 minutes the first set 1 score
Now I add this =WoR=Varth said and still doesn't set it when i restart the server.
Reply
#7

It's just debugging to check if "Online" called.

Use foreach or check whether player connected or not.
Reply
#8

Quote:
Originally Posted by =WoR=Varth
Посмотреть сообщение
It's just debugging to check if "Online" called.

Use foreach or check whether player connected or not.
How to debug to check if "Online"
What do you suggest me, or can you give me an example of how the code should looks like.
Reply
#9

pawn Код:
SetTimer("Online",60000,1);
I think because you have set 1 as repeatig number so that means it will only repeat one time.(Sorry or bad english. I hope you understand)
Reply
#10

Quote:
Originally Posted by nilanjay
Посмотреть сообщение
pawn Код:
SetTimer("Online",60000,1);
I think because you have set 1 as repeatig number so that means it will only repeat one time.(Sorry or bad english. I hope you understand)
"1" mean it will always repeating.

@Kostas': Search "foreach" in FS section.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)