Set Player Score
#1

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
Reply
#2

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;
}
Reply
#3

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.");
}
Reply
#4

You are both aweasome,because ive given too many repurations today I ll give you tommorow both.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)