/GiveRank Command
#1

Can somebody fix up my /giverank command to do the following? I'll provide the code below.



So what it'd do is basically..-

Lieutenant John Doe has promoted you to the rank of Corporal.
^------------^----------------------------------------^
Rank---Name of Promoter----------------------New Rank Achieved

Код:
CMD:giverank(playerid, params[])
{
	if (PlayerInfo[playerid][pLeader] >= 1)
	{
		new string[128], giveplayerid, rank;
		if(sscanf(params, "ud", giveplayerid, rank)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /giverank [playerid] [Rank (1-6)]");

		if(rank > 6 || rank < 0) { SendClientMessageEx(playerid, COLOR_GREY, "   Don't go below number 0, or above number 6!"); return 1; }

		if(IsPlayerConnected(giveplayerid))
		{
			if(PlayerInfo[playerid][pLeader] != PlayerInfo[giveplayerid][pMember])
			{
				SendClientMessageEx(playerid, COLOR_GRAD1, "   That person is not in your faction!");
				return 1;
			}

			if(rank > PlayerInfo[giveplayerid][pRank])
			{
				format(string, sizeof(string), "   You have been promoted to a higher rank by %s.", GetPlayerNameEx(playerid));
			}
			if(rank < PlayerInfo[giveplayerid][pRank])
			{
				format(string, sizeof(string), "   You have been demoted to a lower rank by %s.", GetPlayerNameEx(playerid));
			}
			PlayerInfo[giveplayerid][pRank] = rank;
			SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
			format(string, sizeof(string), "   You have given %s rank %d.", GetPlayerNameEx(giveplayerid),rank);
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command (leaders only)!");
	}
	return 1;
}
Reply
#2

Okay so what's the problem ?
Reply
#3

You'll need to make some stocks or re-wire for each number to go to the rank configured.
Reply
#4

pawn Код:
CMD:giverank(playerid, params[])
{
    if (PlayerInfo[playerid][pLeader] >= 1)
    {
        new string[128], giveplayerid, rank;
                new PRank[100];
        if(sscanf(params, "ud", giveplayerid, rank)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /giverank [playerid] [Rank (1-6)]");

        if(rank > 6 || rank < 0) { SendClientMessageEx(playerid, COLOR_GREY, "   Don't go below number 0, or above number 6!"); return 1; }

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[playerid][pLeader] != PlayerInfo[giveplayerid][pMember])
            {
                SendClientMessageEx(playerid, COLOR_GRAD1, "   That person is not in your faction!");
                return 1;
            }
                        switch(rank)
                        {
                                case 0:PRank = "Normal Player "; // Put The Rank You want
                                case 1:PRank = " ";//Insert The Rank for level 1
                                case 2:PRank = " ";//Insert The Rank for Level 2
                                case 3:PRank = " ";//Insert The Rank for Level 3
                                case 4:PRank = " ";//Insert The Rank for Level 3
                                case 5:PRank = " ";//Insert The Rank for Level 3
                                case 6:PRank = " ";//Insert The Rank for Level 3
                        }
            if(rank > PlayerInfo[giveplayerid][pRank])
            {
                format(string, sizeof(string), "   You have been promoted to a higher rank by %s [RANK: %s].", GetPlayerNameEx(playerid),PRank);
            }
            if(rank < PlayerInfo[giveplayerid][pRank])
            {
                format(string, sizeof(string), "   You have been demoted to a lower rank by %s [RANK: %s]", GetPlayerNameEx(playerid),PRank);
            }

            PlayerInfo[giveplayerid][pRank] = rank;
            SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "   You have given %s rank %d.", GetPlayerNameEx(giveplayerid),rank);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command (leaders only)!");
    }
    return 1;
}
Try this out just change the names in case 1 , 2 ,3 , 4, 5, 6 ...
Reply
#5

In my roleplay script, there are 13 factions. I don't know if yours will work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)