Динамические ранги [MySQL R40].
#4

Как-то так:

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(fractionidmemberidname[], const size sizeof(name))
{
    new 
rankid FractionMember_GetRank(fractionidmemberid);
    if (
rankid == INVALID_RANK_ID) {
        return 
0;
    }
    
name[0] = '\0';
    
strcat(namegRanks[rankid][e_r_name], size);
    return 
1;
}
// ...
// ...
stock GetPlayerFractionRankName(playeridname[], 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(fractionidmemberidnamesize);
}
// ... 
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)