How do I do this?
#4

Make globals
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
};
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...

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;
}
Just an example, I don't recommend using the identical same method, but it should work (untested, not even compiled)
Reply


Messages In This Thread
How do I do this? - by notec100 - 17.03.2009, 23:14
Re: How do I do this? - by notec100 - 18.03.2009, 00:04
Re: How do I do this? - by notec100 - 18.03.2009, 04:55
Re: How do I do this? - by LarzI - 18.03.2009, 08:45
Re: How do I do this? - by notec100 - 18.03.2009, 09:57
Re: How do I do this? - by LarzI - 18.03.2009, 10:00

Forum Jump:


Users browsing this thread: 2 Guest(s)