Loop all players, then check on what factions they are, then make a variable for a faction (lspd,sasd,etc) if they are lspd increase the value of variable lspd, and so on, then send the message.
|
give us the PlayerInfo[max_players][thefactionname]
of each faction |
CMD:makeleader(playerid, params[]) { if(CheckGMX(playerid)) return 1; if(PlayerInfo[playerid][pAdmin] >= 4) { if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty."); new string[128], giveplayerid, faction; if(sscanf(params, "ud", giveplayerid, faction)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeleader [playerid/partofname] [factionid]"); SendClientMessage(playerid, COLOR_GRAD3, "|1 LSPD |2 FBI |3 LSFMD |4 Hitman |5 Government |9 SA News"); return 1; } if(giveplayerid != INVALID_PLAYER_ID) { new ftext[30]; if(faction == 1) ftext = "LSPD"; else if(faction == 2) ftext = "FBI"; else if(faction == 3) ftext = "LSFMD"; else if(faction == 4) ftext = "Hitman Agency"; else if(faction == 5) ftext = "Government"; else if(faction == 9) ftext = "SA News"; else return SendClientMessage(playerid, COLOR_GREY, "Invalid faction ID."); PlayerInfo[giveplayerid][pLeader] = faction; PlayerInfo[giveplayerid][pRank] = 6; PlayerInfo[giveplayerid][pFaction] = faction; format(string, sizeof(string), "You have been made the leader of the %s by Admin %s.",ftext, GetPlayerNameEx(playerid)); SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "%s have made %s the leader of the %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(playerid), ftext); Log("logs/faction.log", string); format(string, sizeof(string), "You have made %s the leader of the %s.", GetPlayerNameEx(giveplayerid),ftext); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); PlayerInfo[giveplayerid][pGang] = 255; } } else { SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!"); } return 1; }
stock GetPlayerFactionInfo(targetid, rank[64], division[64], employer[64]) { switch(PlayerInfo[targetid][pFaction]) { // employer/rank/division data is pulled from here case 1: { ////LSPD STOCK//// employer = "LSPD"; switch(PlayerInfo[targetid][pRank]) { case 1: rank = "Officer"; case 2: rank = "Senior Officer"; case 3: rank = "Sergeant"; case 4: rank = "Captain"; case 5: rank = "Deputy Chief"; case 6: rank = "Chief"; default: rank = "Cadet"; } switch(PlayerInfo[targetid][pDivision]) { case 1: division = "None"; case 2: division = "T.E"; case 3: division = "S.W.A.T"; case 4: division = "I.A"; case 5: division = "T&R"; default: division = "None"; } } case 2: { employer = "FBI"; switch(PlayerInfo[targetid][pRank]) { case 1: rank = "Agent"; case 2: rank = "Senior Agent"; case 3: rank = "Special Agent"; case 4: rank = "Supervisory Agent"; case 5: rank = "Assistant Director"; case 6: rank = "Director"; default: rank = "Intern"; } switch(PlayerInfo[targetid][pDivision]) { case 1: division = "None"; case 2: division = "GU"; case 3: division = "FAN"; case 4: division = "CID"; case 5: division = "IA"; case 6: division = "NSB"; default: division = "None"; } } case 3: { employer = "LSFMD"; switch(PlayerInfo[targetid][pRank]) { case 0: rank = "Probationary]"; case 1: rank = "EMT Intermediate"; case 2: rank = "EMT Paramedic"; case 3: rank = "Lieutenant"; case 4: rank = "Captain"; case 5: rank = "Deputy Chief"; case 6: rank = "Chief"; default: rank = "Volunteer"; } switch(PlayerInfo[targetid][pDivision]) { case 1: division = "Normal"; case 2: division = "T&R"; case 3: division = "LF"; case 4: division = "FD"; default: division = "None"; } } case 4: { employer = "Hitman Agency"; switch(PlayerInfo[targetid][pRank]) { case 1: rank = "Freelancer"; case 2: rank = "Marksman"; case 3: rank = "Agent"; case 4: rank = "Special Agent"; case 5: rank = "Vice Director"; case 6: rank = "Director"; default: rank = "Freelancer"; } division = "None"; } case 5: { employer = "Government"; switch(PlayerInfo[targetid][pRank]) { case 1: { if(PlayerInfo[targetid][pDivision] == 5) rank = "Intern"; else rank = "Employee"; } case 2: { if(PlayerInfo[targetid][pDivision] == 5) rank = "Bodyguard"; else rank = "Public Advocate"; } case 3: { if(PlayerInfo[targetid][pDivision] == 5) rank = "Agent"; else rank = "Secretary"; } case 4: { if(PlayerInfo[targetid][pDivision] == 5) rank = "Special Agent"; else rank = "Councilor"; } case 5: { if(PlayerInfo[targetid][pDivision] == 5) rank = "Head of Security"; else rank = "Vice Mayor"; } case 6: rank = "Mayor"; default: rank = "Staff"; } division = "None"; switch(PlayerInfo[targetid][pDivision]) { case 1: division = "None"; case 2: division = "Executive"; case 3: division = "Judicial"; case 4: division = "Legislative"; case 5: division = "SS"; default: division = "None"; } } case 9: { employer = "SANNews"; switch(PlayerInfo[targetid][pRank]) { case 1: rank = "Intern"; case 2: rank = "Local Journalist"; case 3: rank = "Local Reporter"; case 4: rank = "Network Anchor"; case 5: rank = "Asst. Network Producer"; case 6: rank = "Network Producer"; default: rank = "Intern"; } division = "None"; switch(PlayerInfo[targetid][pDivision]) { case 1: division = "Security"; default: division = ""; } } default: { employer = "None"; division = "None"; rank = "None"; } } return 1; }
This section isn't to ask people to script things for you. It's to ask HELP with scripting something YOURSELF.
I'm open to help, if you show your own code of trying to create it. So go try it first. |