SA-MP Forums Archive
SetPlayerScore Help - 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: SetPlayerScore Help (/showthread.php?tid=187655)



SetPlayerScore Help - m5industries - 03.11.2010

Thank you for taking the time to view this topic. In my script that I have downloaded, it appears that the players level is their score. I would like to change this from the score to how many minutes they have been online. If anyone knows how to do this, please let me know. Anything with // is not in the script, and is a comment I have made to you.

Код:
public DollahScoreUpdate()  //< forward DollahScoreUpdate();
{
	new LevScore;
	for(new i=0; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
   			LevScore = PlayerInfo[i][pLevel];
			SetPlayerScore(i, LevScore);
		}
	}
	return 1;
}



Re: SetPlayerScore Help - Lenny the Cup - 04.11.2010

OnPlayerConnect set it to 0, then add a timer that sets everyone's score to +1 every minute


Re: SetPlayerScore Help - Steven82 - 04.11.2010

**Removed by poster!**


Re: SetPlayerScore Help - m5industries - 04.11.2010

Quote:
Originally Posted by Lenny the Cup
Посмотреть сообщение
OnPlayerConnect set it to 0, then add a timer that sets everyone's score to +1 every minute
I'm not quite sure what you mean by add a timer, and OnPlayerConnect isn't even on the script cut I sent you. Can you please send me an example either via PM, or replying to this post?


Re: SetPlayerScore Help - randomkid88 - 04.11.2010

You should look at the wiki or search for timer tutorials or something because that is pretty basic stuff you should know how to do.


Re: SetPlayerScore Help - (SF)Noobanatior - 04.11.2010

PHP код:
new TimeScore[MAX_PLAYERS]; // globar var at top of script
public TimeScoreUpdate()  //< forward DollahScoreUpdate();
{
    for(new 
i=0i<MAX_PLAYERSi++){
        if(!
IsPlayerConnected(i))continue;
        
TimeScore[i]++;
          
SetPlayerScore(iTimeScore[i]);
    }
    return 
1;
}
//then under on player connect
TimeScore[playerid] = 0;
//then put a new timer under OnGamemodeInit
SetTimer("TimeScoreUpdate",60000,true); 
something like that and just delete the old DollarScoreUpdate timer or comment it out with //