Promotion command
#1

Hi!

I was making a promotion command for my RP script when I was wondering how I can make it so that it looks at their current rank in their faction and then promotes them to the one above it. This is my code for it:

Код:
command(promote, playerid, params[])
{
	new target, string[128];
	if(PlayerInfo[playerid][pRank] == 7)
	{
		if(sscanf(params,"ui", target)) return SendClientMessage(playerid, GREY, "SYNTAX:{FFFFFF} /promote [ID]");
		{
			PlayerInfo[target][pRank] = 1;
			format(string, sizeof(string), "NOTE: You have promoted %s", RPName(target));
 			SendClientMessage(playerid, ADMINBLUE, string);
			format(string, sizeof(string), "NOTE: You have been promoted to rank %d ", RPName(playerid), PlayerInfo[playerid][pRank]);
 			SendClientMessage(target, ADMINBLUE, string);
		}
	}
	else
	{
		RemoveTextMessage(playerid);
        TextDrawShowForPlayer(playerid, Text:CantCommand);
		SetTimerEx("CantCommand", 3500, false, "d", playerid);
	}
	return 1;
}
THanks if you can help!
Reply
#2

Try doing this

PHP код:
PlayerInfo[target][pRank] += 1
Use an if statement if the pRank enum reached your desired maximum rank level
Reply
#3

Quote:
Originally Posted by JaKe Elite
Посмотреть сообщение
Try doing this

PHP код:
PlayerInfo[target][pRank] += 1
Use an if statement if the pRank enum reached your desired maximum rank level
Thanks mate, worked perfectly. +rep'd
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)