19.10.2016, 17:17
Hey guys, I have a faction system which recognizes the factions id wise,
here is the makeleader cmd:
when I use /stats
it shows the faction id like it should, how can I make it show the faction name instead?
like I have to create an enum for it or use my current playerdata enum?
thanks in advance!
edit: how do I properly code a /factions cmd to see the current factions with current leaders and members?
thanks
here is the makeleader cmd:
Код:
CMD:makeleader(playerid, params[]) { if(PlayerInfo[playerid][AdminLevel] >= 1337) { new targetid, facid; if(sscanf(params,"ui",targetid, facid)) return SendClientMessage(playerid, COLOR_ADM,"** Usage: /makeleader [Target ID][Faction ID]");//if the command is misused it will tell them the correct way to use it if(targetid != INVALID_PLAYER_ID) { PlayerInfo[targetid][Faction] = facid; PlayerInfo[targetid][Facrank] = 10; PlayerInfo[targetid][Facleader] = facid; if(facid == 1) { SendClientMessage(targetid,COLOR_LIGHTBLUE,"You have been made the leader of the {F18100}Palomino Creek Police Department!"); } if(facid == 2) { SendClientMessage(targetid,COLOR_LIGHTBLUE,"You have been made the leader of the {00B4F0}Federal Bureau of Investigations!"); } if(facid == 3) { SendClientMessage(targetid,COLOR_LIGHTBLUE,"You have been made the leader of the {FF9494}Palomino Creek Fire/Medical Department!"); } if(facid == 4) { SendClientMessage(targetid,COLOR_LIGHTBLUE,"You have been made the leader of the {A0A0A0}Palomino Creek Goverment!"); } if(facid == 5) { SendClientMessage(targetid,COLOR_LIGHTBLUE,"You have been made the leader of the {00EB33}Palomino Creek News Agency!"); } if(facid == 6) { SendClientMessage(targetid,COLOR_LIGHTBLUE,"You have been made the leader of the {FFFFFF}Hitman Agency!"); } } } else { SendClientMessage(playerid, COLOR_ADM, "* [AdmCMD]: Only administrators level 1337 and higher are able to use this command."); } return 1; }
Код:
CMD:stats(playerid, params[]) { new money = PlayerInfo[playerid][Money]; new deaths = PlayerInfo[playerid][Deaths]; new kills = PlayerInfo[playerid][Kills]; new score = PlayerInfo[playerid][Score]; new admin = PlayerInfo[playerid][AdminLevel]; new fac = PlayerInfo[playerid][Faction]; new facrank = PlayerInfo[playerid][Facrank]; new facleader = PlayerInfo[playerid][Facleader]; new coca = PlayerInfo[playerid][Cocaine]; new name[MAX_PLAYER_NAME], string2[64+MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(string2, sizeof(string2), "* Showing statistics for [%s's] account *", name); SendClientMessage(playerid, COLOR_ADM, string2); new string[128]; format(string, sizeof(string), "[General] - [Money: %d] | [Deaths: %d] | [Kills: %d] | [Score: %d] | [Admin Level: %d]", money, deaths, kills, score, admin); SendClientMessage(playerid, COLOR_ORANGE, string); new string1[128]; format(string1, sizeof(string1), "[Faction/Family] - [Faction: %d] | [Faction Rank: %d] | [Faction Leader: %d]", fac, facrank, facleader); SendClientMessage(playerid, COLOR_GOLD, string1); new string3[64]; format(string3, sizeof(string3), "[Narcotics] - [Cocaine: %d]", coca); SendClientMessage(playerid, COLOR_ORANGE, string3); return 1; }
like I have to create an enum for it or use my current playerdata enum?
thanks in advance!

edit: how do I properly code a /factions cmd to see the current factions with current leaders and members?
thanks