GiveRank problem -- read for more info.
#1

Giverank can be used by ANY pLeader. (Gangs/Factions).

I need to know how so aka:

Cop: he is rank 5 in the PD
Fbi: he is the FBI Leader

Fbi: can /giverank cop 0.
Cop: Rank 0


But i only want it so that whatever faction the FBI is, aka: FBI can only demote pMember = 3

Aka:

pLeader 1 = can only demote/promote = pMember 1
pLeader 2 = can only demote/promote = pMember 2.



Here is my current code.

pawn Код:
if(strcmp(cmd, "/giverank", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giverank [playerid/PartOfName] [Number(1-6)]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if(level > 8 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "  Dont go below number 0, or above number 8!"); return 1; }
            if (PlayerInfo[playerid][pLeader] >= 1)
            {
              if(IsPlayerConnected(para1))
              {
                if(para1 != INVALID_PLAYER_ID)
                {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[para1][pRank] = level;
                        format(string, sizeof(string), "  You have been promoted to a higher Rank by Leader %s", sendername);
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "  You have given %s Rank %d.", giveplayer,level);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command(Leaders Only)!");
            }
        }
        return 1;
    }
Thanks for any help!
Reply
#2

have error with this code?

if yes write it, so we can help you
Reply
#3

Dosent sound like he have any errors,
He wants something changing though
Reply
#4

There is no "Error".

But i need it changing slightly


it's hard to explain....

if this is a player user file: PlayerInfo[playerid][pLeader] == 3 - He is a LEADER. of faction number 3.
and another person is: PlayerInfo[playerid][pMember] == 2 - He is a MEMBER. of faction number 2.



I want it so whatever the faction the pLeader is (3) only he can demote/giverank the pMember == 3.


Argh, hope i explained it..
Reply
#5

pawn Код:
if(strcmp(cmd, "/giverank", true) == 0)
{
  if(IsPlayerConnected(playerid)) {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
      SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giverank [playerid/PartOfName] [Number(1-6)]");
      return 1;
    }
    new para1;
    new level;
    para1 = ReturnUser(tmp);
    tmp = strtok(cmdtext, idx);
    level = strval(tmp);
    if(level > 8 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "  Dont go below number 0, or above number 8!"); return 1; }
    if (PlayerInfo[playerid][pLeader] >= 1) {
      if(IsPlayerConnected(para1)) {
        if(para1 != INVALID_PLAYER_ID) {
          if(PlayerInfo[para1][pMember] == PlayerInfo[playerid][pMember]) {
            GetPlayerName(para1, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            PlayerInfo[para1][pRank] = level;
            format(string, sizeof(string), "  You have been promoted to a higher Rank by Leader %s", sendername);
            SendClientMessage(para1, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "  You have given %s Rank %d.", giveplayer,level);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
          }
          else {
            SendClientMessage(playerid, RED, "[ERROR] The player is not in your faction")
          }
        }
      }
    }
    else {
      SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command(Leaders Only)!");
    }
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)