Ranking system?
#1

Well i have a

Код:
 #define TEAM_COP 1

and a
if(strcmp("/cop coper", cmdtext, true, 10) == 0)
{
gTeam blah blah blah TEAM_COP

Setplayerpos Blah

Weapons Blah Blah

ect
But i dont know how to add ranks ?

And/or Storage
Reply
#2

At Top:

pawn Код:
new CurrentTopPlayer;
in OnPlayerCommandText() callback

pawn Код:
if ( strcmp(cmdtext, "/TopPlayer", true) == 0 ) {
      new pScore;
      for ( new i = 0; i < MAX_PLAYERS; i++ ) {
        if ( IsPlayerConnected(i) ) {
          pScore = GetPlayerScore(i);
          if ( pScore > CurrentTopPlayer ) {
            CurrentTopPlayer = i;
          }
        }
      }
      new Str[50],
        pName[25];
        GetPlayerName(CurrentTopPlayer, pName, sizeof pName);
        format(Str, sizeof String, "The Top Player Is: %s", pName);
        SendClientMessage(playerid, 0x00ff00ff, Str);
      return 1;
    }
Sorry but it is untested but should work ?
Reply
#3

he wanted ranks, not a top list..

Harly: make a variable that stores an integer value (a number), read it to determine which rank someone has, example:

pawn Код:
if (jobRank[playerid] == 1)
  // rank 1, constable
else if (jobRank[playerid] == 2)
  // rank 2, inspector
etc..
Reply
#4

A Simple Edit:

At Top:

pawn Код:
new PlayerRank[MAX_PLAYERS];
pawn Код:
if ( strcmp(cmdtext, "/MyRank", true) == 0 ) {
  new Rank[25];
  for ( new i = 0; i < 2; i++ ) { // 2 being the number of ranks
    if ( PlayerRank[playerid] == 1 ) {
      Rank = "Commander !";
    } else if ( PlayerRank[playerid] == 2 ) {
      Rank = "General !";
    } else {
      Rank = "Nothing !";
    }
  }
  new Str[50];
  format(Str, sizeof String, "Your Rank Is: %s", Rank);
  SendClientMessage(playerid, 0x00ff00ff, Str);
  return 1;
}
Yet again untested
Reply
#5

Quote:

if(strcmp("/cop coper", cmdtext, true, 10) == 0)

The "10" is the maxcells or whatever its called, this isn't needed unless you have parameters as you could type "/cop coppersdklavfgsdkkbgldfjh" and it still work.
Reply
#6

aka remove the 10
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)