Hi AlbanianGuy,
There are 3 methods (maybe more) to reach the thing you want to do:
1. You can use a timer like this:
pawn Code:
// Place somewhere in your script
forward soldierScoreCheck();
public soldierScoreCheck()
{
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
new score = GetPlayerScore(playerid);
if(score == x) // see note at the bottom of the code
{
if(gTeam[playerid] == TEAM_SOLDIER) //your team here
{
gTeam[playerid] = TEAM_GENERAL; //your team here
}
}
}
}
// Put this in OnGameModeInit
SetTimer("soldierScoreCheck", 1000, 1);
Note: Replace x to the score the score when you want people to upgrade to general.
2. You can do it in OnPlayerUpdate:
pawn Code:
public OnPlayerUpdate(playerid)
{
new score = GetPlayerScore(playerid);
if(score == x) // see note at the bottom of the code
{
if(gTeam[playerid] == TEAM_SOLDIER) //your team here
{
gTeam[playerid] = TEAM_GENERAL; //your team here
}
}
}
Note: Replace x to the score the score when you want people to upgrade to general.
3. You can use a custom check you run every time you change a players score:
pawn Code:
stock soldierScoreCheck(playerid)
{
new score = GetPlayerScore(playerid);
if(score == x) // see note at the bottom of the code
{
if(gTeam[playerid] == TEAM_SOLDIER) //your team here
{
gTeam[playerid] = TEAM_GENERAL; //your team here
}
}
}
// and then when you change a players score:
// Example:
SetPlayerScore(playerid, x);
soldierScoreCheck(playerid);
Note: Replace x to the score the score when you want people to upgrade to general.
Witch one is the best?
1. Option 3
2. Option 1
3. Option 2
You can try all of them and look for the one that fits you the best
There could be some minor typo's here...
I hope i helped you with your problem.
Sorry, if i confused you with the order of the options.
Goodluck