19.02.2017, 09:37
Как-то так:
PHP Code:
// fraction ranks table
id | fraction_id | name
// ...
// ...
#define INVALID_FRACTION_ID -1
#define INVALID_MEMBER_ID -1
#define INVALID_RANK_ID -1
#define MAX_FRACTIONS 100
#define MAX_FRACTION_PLAYERS 50
// ...
// ...
enum E_RANK_INFO {
ORM:_r_ormid,
e_r_id,
e_r_name[MAX_RANK_NAME],
}
static gRanks[MAX_RANKS][E_RANK_INFO];
// ...
// ...
enum E_FRACTION_MEMBER_INFO {
// ...
e_fm_rankid,
// ...
}
static gFractionMembers[MAX_FRACTIONS][MAX_FRACTION_PLAYERS][E_FRACTION_MEMBER_INFO];
// ...
// ...
stock FractionMember_GetRankName(fractionid, memberid, name[], const size = sizeof(name))
{
new rankid = FractionMember_GetRank(fractionid, memberid);
if (rankid == INVALID_RANK_ID) {
return 0;
}
name[0] = '\0';
strcat(name, gRanks[rankid][e_r_name], size);
return 1;
}
// ...
// ...
stock GetPlayerFractionRankName(playerid, name[], const size = sizeof(name))
{
new
fractionid,
memberid;
fractionid = GetPlayerFractionID(playerid);
memberid = GetPlayerFractionMemberID(playerid);
if (fractionid == INVALID_FRACTION_ID || memberid == INVALID_MEMBER_ID) {
return 0;
}
return FractionMember_GetRankName(fractionid, memberid, name, size);
}
// ...