Small string issue
#1

Alright the issue is simple, I know whats the problem also but I dont know how to resolve it. Warnings are included into the comments inside the first function

PHP код:
GetPlayerRank(playerid) { //getting player rank, returning string
    
new rankName[64],fid;
    
fid AccInfo[playerid][PlayerFaction];
    switch(
AccInfo[playerid][PlayerRank]) {
        case 
0rankName "None";
        case 
1rankName FactionInfo[fid][Rank1]; //warning 229: index tag mismatch (symbol "FactionInfo")
        
case 2rankName FactionInfo[fid][Rank2]; //warning 229: index tag mismatch (symbol "FactionInfo")
    
}
    return 
rankName;

ranks are defines perfectly
PHP код:
enum FInfo {
    
Rank1[64],
    
Rank2[64]
}
new
    
FactionInfo[MAX_FACTIONS][FInfo]; 
When im loading the factions
PHP код:
cache_get_field_content(i"Rank1"string);
            
strreplace(string'_'' ');
            
format(FactionInfo[i][Rank1], sizeof(string), string);
            
            
cache_get_field_content(i"Rank2"string);
            
strreplace(string'_'' ');
            
format(FactionInfo[i][Rank2], sizeof(string), string); 
I know the problem is inside rankName = FactionInfo[fid][Rank1] but Im not sure how should I get it other way?
Reply
#2

Change FInfo to fInfo xD
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Change FInfo to fInfo xD
Thats not the problem. As you see defines as FactionInfo[MAX_FACTIONS][FInfo] works perfectly on all other spots.
The problem is inside
PHP код:
case 1rankName FactionInfo[fid][Rank1]; //warning 229: index tag mismatch (symbol "FactionInfo") 
case 2rankName FactionInfo[fid][Rank2]; //warning 229: index tag mismatch (symbol "FactionInfo") 
Reply
#4

Change and you will see...
Reply
#5

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Change and you will see...
LOL what the heck, thanks...
But why did it happen? What does it have to do with strings?


EDIT: no errors but no usage in game. Its simply not displaying the rank at all.
pawn Код:
GetPlayerRank(playerid) {
    new rankName[24],fid;
    fid = AccInfo[playerid][PlayerFaction];
    switch(AccInfo[playerid][PlayerRank]) {
        case 0: rankName = "None";
        case 1: rankName = FactionInfo[fid][Rank1];
        case 2: rankName = FactionInfo[fid][Rank2];
        case 3: rankName = FactionInfo[fid][Rank3];
        case 4: rankName = FactionInfo[fid][Rank4];
        case 5: rankName = FactionInfo[fid][Rank5];
        case 6: rankName = FactionInfo[fid][Rank6];
        case 7: rankName = FactionInfo[fid][Rank7];
        case 8: rankName = FactionInfo[fid][Rank8];
        case 9: rankName = FactionInfo[fid][Rank9];
        case 10: rankName = FactionInfo[fid][Rank10];
    }
    return rankName;
}
Reply
#6

Ill make another thread. There is a problem with something else actually...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)