Brain fart with faction ranks -
ihatetn931 - 27.03.2015
I'm having a brain fart with a dynamic rank system, scripting is a little rusty.
How would i go about making it so there is a dynamic amount of rank ids with rank names
Instead of having to do
pawn Код:
enum finfo
{
fRank1id,
fRank2id,
//and so on
fRankName1,
fRankName2,
//and so on
}
I want there to be a dynamic set of rank ids and rank names, I'm using R7 mysql plugin (the one on github), along with sscanf
Re: Brain fart with faction ranks -
Dokins - 27.03.2015
Perhaps something similar to this?
pawn Код:
if(FRank[giveplayerid] == 1) format(string, sizeof(string), "You have promoted %s to the rank of %s(2)", GetNameEx(giveplayerid), FactionRank2[factionid]);
if(FRank[giveplayerid] == 2) format(string, sizeof(string), "You have promoted %s to the rank of %s(3)", GetNameEx(giveplayerid), FactionRank3[factionid]);
if(FRank[giveplayerid] == 3) format(string, sizeof(string), "You have promoted %s to the rank of %s(4)", GetNameEx(giveplayerid), FactionRank4[factionid]);
if(FRank[giveplayerid] == 4) format(string, sizeof(string), "You have promoted %s to the rank of %s(5)", GetNameEx(giveplayerid), FactionRank5[factionid]);
if(FRank[giveplayerid] == 5) format(string, sizeof(string), "You have promoted %s to the rank of %s(6)", GetNameEx(giveplayerid), FactionRank6[factionid]);
if(FRank[giveplayerid] == 6) format(string, sizeof(string), "You have promoted %s to the rank of %s(7)", GetNameEx(giveplayerid), FactionRank7[factionid]);
Re: Brain fart with faction ranks -
ihatetn931 - 27.03.2015
I would still have to create a thing for each rank name wouldn't i?
trying to make it so, they do
pawn Код:
/createfaction [rank amount] //so say i want 2 ranks i would put /createfaction 2
Then i can do
pawn Код:
/editrank [rank] [rank name]
//rank would be the id so if there is 2 ranks it would be an id of 1 for the first rank
//rank name ofcourse would set the rank name of rank id 1
Basically i'm trying to get them in to one var in a enum
So i got
and that's it for any amount of ranks
Re: Brain fart with faction ranks -
Aly - 27.03.2015
You can do it like this:
Код:
enum finfo
{
fRank,
//....
}
FactionInfo[MAX_FACTIONS][fInfo];
#define MAX_RANK 3 //Replace it with a value that you want
new RankName[MAX_RANK][32] =
{
"Rank 0",
"Rank 1",
"Rank 2"
//etc ...
};
//Example
SCM(playerid,-1,RankName[FactionInfo[fid][fRank]]);
Re: Brain fart with faction ranks -
ihatetn931 - 27.03.2015
So i have to create a "Rank" for each rank made?
I'm assuming there is no way to get a dynamic amount set for ranks and rank names
I want each faction to be able to create the amount of ranks they need, so if they just need 1 rank they just make 1 rank, if they want 20 ranks then they can make 20 ranks.
Re: Brain fart with faction ranks -
Scrillex - 28.03.2015
just make it like.. ranks+20 and when you are creating rank system for them let them choose how many ranks they want.. If they write 1 then display 1.... Just save amount of ranks in another file... thats it.
Re: Brain fart with faction ranks -
ihatetn931 - 28.03.2015
That's what i was plan on doing, thank you all for the help. I was just hoping there was a way to make it dynamic.
2 new tables, woo hoo
God i hate making mysql tables lol