5 points per minute - 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: 5 points per minute (
/showthread.php?tid=214133)
5 points per minute -
Jack_Rocker - 20.01.2011
I can I make it that a person earns 5 points for every minute they are on the server??
thanks!
Re: 5 points per minute -
Alex_Valde - 20.01.2011
Sure you can.
You'll need
this and
this.
Re: 5 points per minute -
WillyP - 20.01.2011
OnPlayerConnect
SetTimer("GivePoints",60000,true);
pawn Код:
public GivePoints()
{
for(new i; i=0; i <MAX_PLAYERS; i++)
{
SetPlayerScore(i,+5);
}
return 1;
}
Re: 5 points per minute -
Mikkel_Pedersen - 20.01.2011
Under OnGameModeInit (if it is a gamemode) make a timer that gets called every minute. Like
pawn Код:
new PlayerPoint[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("Add5Points", 5000, true);
return 1;
}
forward Add5Points();
public Add5Points()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
PlayerPoint[i] += 5;
}
}
return 1;
}
Sorry if there's some incorrect code there, I just fast made it.
If you want to set their score. Minimal changes though.
pawn Код:
public OnGameModeInit()
{
SetTimer("Add5Points", 5000, true);
return 1;
}
forward Add5Points();
public Add5Points()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetPlayerScore(i, GetPlayerScore(i)+5);
}
}
return 1;
}
Re: 5 points per minute -
alpha500delta - 20.01.2011
Why new functions like PlayerPoint lol, you can use SetPlayerScore
Re: 5 points per minute -
Mikkel_Pedersen - 20.01.2011
Quote:
Originally Posted by alpha500delta
Why new functions like PlayerPoint lol, you can use SetPlayerScore
|
That's correct, but as he said "points" I didn't think of "score" so I just made the PlayerPoint.
Re: 5 points per minute -
Haydz - 20.01.2011
Quote:
Originally Posted by [FU]Victious
OnPlayerConnect
SetTimer("GivePoints",60000,true);
pawn Код:
public GivePoints() { for(new i; i=0; i <MAX_PLAYERS; i++) { SetPlayerScore(i,+5); } return 1; }
|
For every player online wouldn't that give them 5 score? so 2 players = 10 score.
pawn Код:
//under OnPlayerconnect
timerDaily[playerid] = SetTimerEx ("dailyScore", 60000, true, "d", playerid);
//under OnPlayerDisconnect
KillTimer(timerDaily[playerid]);
//bottom of the script
forward dailyScore (playerid);
public dailyScore (playerid)
{
SetPlayerScore (playerid, GetPlayerScore(playerid) + 5);
return 1;
}
worked like a charm for me.