Array Help.
#1

PHP код:
enum EEquipInfo {
    
EEquipName[32],
    
EEquipFaction,
    
EEquipMinRank,
    
EEquipGun1,
    
EEquipGun2,
    
EEquipGun3,
    
EEquipGun4,
    
EEquipGun5,
    
EEquipGun6,
    
EEquipGun7,
    
EEquipGun8,
    
EEquipGun9,
    
EEquipGun10,
    
EEquipGun11,
    
EEquipGun12,
    
ESWATENABLE,
};
new 
EquipSlots[][EEquipInfo] = {
    
// LSPD
    
{"Recruit",                  1,  1,       323410,  0,    0,  0000000},
    {
"Probationary Trooper",  1,  2,       32325410,    0,  0000000},
    {
"Trooper",                  1,  3,      32425410,    0,  0000000},
    {
"Trooper First Class",   1,  4,      324252941,   0,  0000000},
    {
"Corporal",               1,  5,      324252941,   0,  0000000},
    {
"Detective I",            1,  6,      324252941,   0,  0000000},
    {
"Sergeant",                1,  7,      324252931,  41,  0000000},
    {
"Detective II",            1,  8,      2443,  0,  0,  0,  00,  000000},
    {
"Sergeant First Class",  1,  9,      3,  2425293141,  0000000},
    {
"Detective III",            1,  10,     242943,  0,  0,  0,  0000000},
    {
"Lieutenant",            1,  11,     3,  2425293141,  0000000},
    {
"Captain",                1,  12,     3,  2425293141,  0000000},
    {
"Major",                    1,  13,     3,  2425293141,  0000000},
    {
"Assistant Director",    1,  14,     3,  2425293141,  0000000},
    {
"Deputy Director",        1,  15,     3,  2425293141,  0000000},
    {
"Director",                   1,  16,     3,  2427293141,  0000000},
    {
"SWAT EQUIPMENT",          1,  3,       242729313441,  0000001},
    
// FBI
    
{"Agent",                2,  1,     32443,  0,  0,  0,  0,  000000},
    {
"Tactical (MP5)",      2,  2,    32429,  0,  0,  0,  0,  000000},
    {
"Tactical (M4)",       2,  2,    32431,  0,  0,  0,  0,  000000},
    {
"Tactical (Shotgun)",  2,    2,  32427,  0,  0,  0,  0,  000000},
    {
"Tactical (Sniper)",   2,    2,  32434,  0,  0,  0,  0,  000000},
    {
"Full Tactical",       2,    5,  3242527293134,  000000},
    
// GOVERNMENT
    
{"Bodyguard",             3,  1,    24290,  0000000000},
    {
"Mayor",                 3,  2,    240,  0,  0000000000}
};
///////////////////
showEquipMenu(playerid) {
    new 
temptxt[256];
    
dialogstr[0] = 0;
    new 
faction GetPVarInt(playerid"Faction");
    new 
rank GetPVarInt(playerid"Rank");
    for(new 
i=0;i<sizeof(EquipSlots);i++) {
        if(
faction == EquipSlots[i][EEquipFaction]) {
            if(
EquipSlots[i][ESWATENABLE] == 1) {
                if(
rank >= EquipSlots[i][EEquipMinRank]) {
                    
format(temptxtsizeof(temptxt), "%s\n",EquipSlots[i][EEquipName]);
                    
strcat(dialogstr,temptxt,sizeof(dialogstr));
                }
            } else {
                if(
EquipSlots[i][ESWATENABLE] == 0) {
                    if(
rank == EquipSlots[i][EEquipMinRank]) {
                        
format(temptxtsizeof(temptxt), "%s\n",EquipSlots[i][EEquipName]);
                        
strcat(dialogstr,temptxt,sizeof(dialogstr));
                    }
                }
            }            
        }
    }
    
ShowPlayerDialog(playeridEFactionDialog_EquipChooseDIALOG_STYLE_LIST"{00BFFF}Equip Menu",dialogstr"Ok""Cancel");
}
////
case EFactionDialog_EquipChoose: {
            if(
response) {
                
onEquipResponse(playeridlistitem);
            }
        }
//onEquipResponse(playerid, index) {
    
new slot getEquipListedAt(playeridindex);
    new 
msg[128];
    if(
GetPVarType(playerid"CopDuty") == PLAYER_VARTYPE_NONE) {
        return 
1;
    }
    
ResetPlayerWeaponsEx(playerid);
    if(
EquipSlots[slot][EEquipGun1] != 0) {
        
GivePlayerWeaponEx(playeridEquipSlots[slot][EEquipGun1], 100);
    }
    if(
EquipSlots[slot][EEquipGun2] != 0) {
        
GivePlayerWeaponEx(playeridEquipSlots[slot][EEquipGun2], 100);
    }
    if(
EquipSlots[slot][EEquipGun3] != 0) {
        
GivePlayerWeaponEx(playeridEquipSlots[slot][EEquipGun3], 500);
    }
    if(
EquipSlots[slot][EEquipGun4] != 0) {
        
GivePlayerWeaponEx(playeridEquipSlots[slot][EEquipGun4], 500);
    }
    if(
EquipSlots[slot][EEquipGun5] != 0) {
        
GivePlayerWeaponEx(playeridEquipSlots[slot][EEquipGun5], 500);
    }
    if(
EquipSlots[slot][EEquipGun6] != 0) {
        
GivePlayerWeaponEx(playeridEquipSlots[slot][EEquipGun6], 100);
    }
    if(
EquipSlots[slot][EEquipGun7] != 0) {
        
GivePlayerWeaponEx(playeridEquipSlots[slot][EEquipGun7], 100);
    }
    if(
EquipSlots[slot][EEquipGun8] != 0) {
        
GivePlayerWeaponEx(playeridEquipSlots[slot][EEquipGun8], 100);
    }
    if(
EquipSlots[slot][EEquipGun9] != 0) {
        
GivePlayerWeaponEx(playeridEquipSlots[slot][EEquipGun9], 100);
    }
    if(
EquipSlots[slot][EEquipGun10] != 0) {
        
GivePlayerWeaponEx(playeridEquipSlots[slot][EEquipGun10], 100);
    }
    if(
EquipSlots[slot][EEquipGun11] != 0) {
        
GivePlayerWeaponEx(playeridEquipSlots[slot][EEquipGun11], 100);
    }
    if(
EquipSlots[slot][EEquipGun12] != 0) {
        
GivePlayerWeaponEx(playeridEquipSlots[slot][EEquipGun12], 100);
    }
    
SetPlayerHealthEx(playerid100.0);
    
SetPlayerArmourEx(playerid100.0);
    
format(msgsizeof(msg), "* %s has suited %sself up with %s equipment.",GetPlayerNameEx(playeridENameType_RPName), getThirdPersonPersonalPronoun(playerid),EquipSlots[slot][EEquipName]);
    
ProxMessage(30.0playeridmsgCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    return 
0;



The issue is as followed

I've assigned each slot it's own rank.
If that person == rank 1, They see rank 1 stuff...
But anyone over rank 1 doesn't get given the correct equipment..
They all get equipment of rank 1...
Can anyone see the issue..

Cause I really can't see where the hell i've gone an fuxed up.

If I make them ALL visable... It works fine..
but I want it so

Player X With Rank X
Can only see the stuff they're meant to see / equip the stuff they're meant to equip...

At the bottom I have "SWAT"...
That requires "SWAT_ENABLED (A Global Var) to be 1...)
But when that's 1... It shows up in the list "LIKE THE REST OF THE RANKED STUFF"...
BUT

When I equip it...
It gives me RANK 1 equipment..

Can anyone help me?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)