SA-MP Forums Archive
score system ? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: score system ? (/showthread.php?tid=188184)



score system ? - antsolen - 06.11.2010

How i can buil score system evry 15 minutes playng online is 1 score ?


Re: score system ? - Mike_Peterson - 06.11.2010

Set a timer every 15 minutes that will check if the player is connected and then set his score to +1
pretty simple

This forum requires that you wait 4.600 seconds between posts. Please try again in 4.543 seconds.
^^ No thank you..


Re: score system ? - antsolen - 06.11.2010

I cant found that what i want and i want its automaticly add 1 score on evry 15 minutes !


Re: score system ? - Alex_Valde - 06.11.2010

First you'll need to make a timer like this
pawn Code:
SetTimer("OnlineTimer",100000,true);
//OnlineTimer is the name of a timer
//100000 is the time = 10 min
//false is if the timer will repeat
//EDIT: put this under your OnPlayerSpawn or OnPlayerConnect callback.
Than public it:
pawn Code:
public OnlineTimer
{
    new score = GetPlayerScore(playerid);
SetPlayerScore(playerid,score+1);
return 1;
//EDIT: Put this at the bottom of your script.
}
Untested. I hope it will work


Re: score system ? - Mike_Peterson - 06.11.2010

use this
pawn Code:
SetTimer("ScoreTimer",900000,true); // 900000 = 15 minutes
and this timer
pawn Code:
public ScoreTimer()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    SetPlayerScore(i,GetPlayerScore(i) + 1);
    }
}
}
this might do the trick


Re: score system ? - Alex_Valde - 06.11.2010

Yeah it's better to use loops
(and I faild about the time, lol )


Re: score system ? - antsolen - 06.11.2010

Quote:
Originally Posted by Mike_Peterson
View Post
use this
pawn Code:
SetTimer("ScoreTimer",900000,true); // 900000 = 15 minutes
and this timer
pawn Code:
public ScoreTimer()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    SetPlayerScore(i,GetPlayerScore(i) + 1);
    }
}
}
this might do the trick
One error


C:\Documents and Settings\Andero\Desktop\Server\gamemodes\Stunters. pwn(404) : error 021: symbol already defined: "SetTimer"
C:\Documents and Settings\Andero\Desktop\Server\gamemodes\Stunters. pwn(405) : warning 235: public function lacks forward declaration (symbol "ScoreTimer")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

How i can fix it i cant find anthore SetTimer ...


Re: score system ? - Alex_Valde - 06.11.2010

You always HAVE to forward timers.
Somewhere at the top of your script:

pawn Code:
forward SetTimer(playerid);
With this you should lose that warning 235. at the line 405.

Can you please post your script so we can see where is that error?


Re: score system ? - antsolen - 06.11.2010

DELETED
//////////


Re: score system ? - Alex_Valde - 06.11.2010

Lmao, not the full script
Just that part where is error.