18.03.2009, 08:45
Make globals
Then use them as you like (above was just a example)
i.e. use arrestCount every time a player gets arrested
set a timer to go on and on all the time to check how many players you have arrested/ticketed, then if it's equal to the amount in the rank#Players variables...
Just an example, I don't recommend using the identical same method, but it should work (untested, not even compiled)
pawn Код:
new
policeRanksVar[MAX_PLAYERS], //storing the players rank
arrestCount[MAX_PLAYERS], //used for counting how many players the player has arrested
ticketCount[MAX_PLAYERS], //used for counting how many players the player has given a ticket
rank1Players = 5;
rank2Players = 10;
rank3Players = 20;
rank4Players = 40;
rank5Players = 80;
new policeRanksNames[][] = //the rank names stored in a string variable
{
"Rank1",
"Rank2",
"Rank3",
"Rank4",
"Rank5" //etc
};
i.e. use arrestCount every time a player gets arrested
set a timer to go on and on all the time to check how many players you have arrested/ticketed, then if it's equal to the amount in the rank#Players variables...
pawn Код:
//timer function
myTimer(playerid)
{
if(policeRanksVar[playerid] == 0 && arrestCount[playerid]+ticketCount[playerid]>=rank1Players)
policeRanksVar[playerid] = 1;
if(policeRanksVar[playerid] == 1 && arrestCount[playerid]+ticketCount[playerid]>=rank2Players)
policeRanksVar[playerid] = 2;
if(policeRanksVar[playerid] == 2 && arrestCount[playerid]+ticketCount[playerid]>=rank3Players)
policeRanksVar[playerid] = 3;
if(policeRanksVar[playerid] == 3 && arrestCount[playerid]+ticketCount[playerid]>=rank4Players)
policeRanksVar[playerid] = 4;
if(policeRanksVar[playerid] == 4 && arrestCount[playerid]+ticketCount[playerid]>=rank5Players)
policeRanksVar[playerid] = 5;
return true;
}