15.09.2012, 16:07
Код:
enum pInfo { pLeader, pRank, pMember };
So if there a pLeader then they will be classed as a rank 6(or whatevers your highest rank in the faction).
The pRank is meaning what rank they are, so for eg: /giverank [playerid] [rank] - It will give them a new rank, like
PlayerInfo[playerid][pRank] = rank;
The pMember is basically just saying they are in a faction and which one.
Making someone a higher/lower rank;
Код:
CMD:giverank(playerid, params[]) { new pID, value; new rank = PlayerInfo[playerid][pLeader]; if(rank < 6) return SCM(playerid, COLOR_WHITE, "You are not authorised to use that command."); else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /giverank [playerid/partofname] [rank 0-6]"); else if (value < 0 || value > 6) return SendClientMessage(playerid, COLOR_WHITE, "Unknown rank! [0 - 6]"); else if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_WHITE,"Invalid player ID."); else { new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128]; GetPlayerName(playerid, pName, MAX_PLAYER_NAME); GetPlayerName(pID, tName, MAX_PLAYER_NAME); format(string, sizeof(string), "You have promoted %s to rank %i!", tName, value); SCM(playerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "You have been promoted to rank %i!", value, pName); SCM(pID, COLOR_LIGHTBLUE, string); PlayerInfo[pID][pRank] = value; } return 1; }
You can also changed pID to giveplayerid and add new giveplayerid at the top of the CMD.
Hope this says everything, im not exactly a good scripter so im learning it myself, so if you need anymore help PM me!