Small string issue - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Small string issue (
/showthread.php?tid=595505)
Small string issue -
TwinkiDaBoss - 04.12.2015
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 0: rankName = "None";
case 1: rankName = FactionInfo[fid][Rank1]; //warning 229: index tag mismatch (symbol "FactionInfo")
case 2: rankName = 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?
Re: Small string issue -
Jefff - 04.12.2015
Change FInfo to fInfo xD
Re: Small string issue -
TwinkiDaBoss - 04.12.2015
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 1: rankName = FactionInfo[fid][Rank1]; //warning 229: index tag mismatch (symbol "FactionInfo")
case 2: rankName = FactionInfo[fid][Rank2]; //warning 229: index tag mismatch (symbol "FactionInfo")
Re: Small string issue -
Jefff - 04.12.2015
Change and you will see...
Re: Small string issue -
TwinkiDaBoss - 04.12.2015
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;
}
Re: Small string issue -
TwinkiDaBoss - 04.12.2015
Ill make another thread. There is a problem with something else actually...