SA-MP Forums Archive
Promotion command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Promotion command (/showthread.php?tid=592327)



Promotion command - OMonger - 23.10.2015

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!


Re: Promotion command - JaKe Elite - 23.10.2015

Try doing this

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


Re: Promotion command - OMonger - 23.10.2015

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