Set Player Score - 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: Set Player Score (
/showthread.php?tid=485929)
Set Player Score -
[SU]Spartan - 06.01.2014
Hello,
I want to add a system in my server that every 5 minutes every player takes 10 score from the sever with the following colors
[SERVER]Everyone's score has been increased with 5 Score
Re: Set Player Score -
Tayab - 06.01.2014
Comments should help you out on what I've done below.
pawn Код:
public OnPlayerConnect(playerid)
{
SetTimer("IncreaseScore",1000*60*5,true); // Set a timer for 5 minutes. It'll be called every 5 minutes and will not stop unless you want to kill it.
}
forward IncreaseScore();
public IncreaseScore()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
SetPlayerScore(i,GetPlayerScore(i)+10); // get all the players' score and increment it by 10.
format(string,sizeof(string),"[SERVER]{FF0000}Everyone's score has been increased with {FF8800}%d{FF0000} score.",GetPlayerScore(i)); // making the string to show up in sending client message
SendClientMessageToAll(0x40FF00FF,string);
}
return 1;
}
Re: Set Player Score -
RedFusion - 06.01.2014
pawn Код:
OnGameModeInit()
{
SetTimer("GiveScorePoints", 60000*5, true);
}
forward GiveScorePoints();
public GiveScorePoints()
{
for(new playerid = 0, players = GetMaxPlayers(); playerid < players; playerid++)
if(IsPlayerConnected(playerid))
SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
SendClientMessageToAll(-1, "[SERVER]Everyone's score has been increased with 5 Score.");
}
Re: Set Player Score -
[SU]Spartan - 06.01.2014
You are both aweasome,because ive given too many repurations today I ll give you tommorow both.