SA-MP Forums Archive
Skipping a format? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Skipping a format? (/showthread.php?tid=243210)



Skipping a format? - Skylar Paul - 22.03.2011

pawn Код:
if(PVar[playerid][StatDisplay] == 1) {
        format(string, sizeof(string), "{0FA0D1}Name: {FFFFFF}%s (ID: %d) | {0FA0D1}VIP Rank: {FFFFFF}%s (%d) | {0FA0D1}Skin ID: {FFFFFF}%d | {0FA0D1}Job:{FFFFFF} %s | {0FA0D1}Money: {FFFFFF}$%d", pName(playerid), playerid, VIPName, PVar[playerid][VIPLevel], PVar[playerid][pSkin], JobName, PVar[playerid][pMoney]);
        SendClientMessage(playerid, white, string);
        format(string, sizeof(string), "{0FA0D1}Faction: {FFFFFF}%s | {0FA0D1}Rank: {FFFFFF}%s (Rank: %d) | {0FA0D1}Materials: {FFFFFF}%d | {0FA0D1}Drugs: {FFFFFF}%d", FactionName, FactionRankName, PVar[playerid][pFRank], PVar[playerid][pMaterials], PVar[playerid][pDrugs]);
        SendClientMessage(playerid, white, string);
        SendClientMessage(playerid, white, "[Hint] Use /statdisplay to change the way statistics are displayed!");
    }
    else if(PVar[playerid][StatDisplay] == 0) {
        format(string, sizeof(string), "{0FA0D1}Name: {FFFFFF}%s (ID: %d)\n{0FA0D1}VIP Rank: {FFFFFF}%s (%d)\n{0FA0D1}Skin ID: {FFFFFF}%d\n{0FA0D1}Job:{FFFFFF} %s\n{0FA0D1}Money: {FFFFFF}$%d\n{0FA0D1}Faction: {FFFFFF}%s | ", pName(playerid), playerid, VIPName, PVar[playerid][VIPLevel], PVar[playerid][pSkin], JobName, PVar[playerid][pMoney], FactionName);
        strcat(holder, string, sizeof(holder));
        format(string, sizeof(string), " {0FA0D1}Rank: {FFFFFF}%s (Rank: %d)\n{0FA0D1}Materials: {FFFFFF}%d\n{0FA0D1}Drugs: {FFFFFF}%d\n", FactionRankName, PVar[playerid][pFRank], PVar[playerid][pMaterials], PVar[playerid][pDrugs]);
        strcat(holder, string, sizeof(holder));
        format(string, sizeof(string), "[Hint] Use /statdisplay to change the way statistics are displayed!");
        strcat(holder, string, sizeof(holder));
        ShowPlayerDialog(playerid, STATS, DIALOG_STYLE_MSGBOX, "{0FA0D1}Godfather Reborn: Statistics", holder, "Hide", "");
    }
StatDisplay 0 works perfectly fine, but StatDisplay 1 only shows from Faction down.. it skipped this:
pawn Код:
format(string, sizeof(string), "{0FA0D1}Name: {FFFFFF}%s (ID: %d) | {0FA0D1}VIP Rank: {FFFFFF}%s (%d) | {0FA0D1}Skin ID: {FFFFFF}%d | {0FA0D1}Job:{FFFFFF} %s | {0FA0D1}Money: {FFFFFF}$%d", pName(playerid), playerid, VIPName, PVar[playerid][VIPLevel], PVar[playerid][pSkin], JobName, PVar[playerid][pMoney]);
        SendClientMessage(playerid, white, string);
What's wrong?


Re: Skipping a format? - Skylar Paul - 22.03.2011

I suppose it would be okay to bump this thread now, considering it's on the third page, and it's been a day.


Re: Skipping a format? - Zh3r0 - 22.03.2011

It's because the string it's too long, short it a bit and you will see that it will appear!
This is cause by the colors, not that they have a bad format or anything, just that they occupy 8 character each color!


Re: Skipping a format? - Skylar Paul - 22.03.2011

Quote:
Originally Posted by Zh3r0
Посмотреть сообщение
It's because the string it's too long, short it a bit and you will see that it will appear!
This is cause by the colors, not that they have a bad format or anything, just that they occupy 8 character each color!
So a string being too long can cause it to malfunction? I actually didn't know that, thank you!


Re: Skipping a format? - Zh3r0 - 22.03.2011

Quote:
Originally Posted by Skylar Paul
Посмотреть сообщение
So a string being too long can cause it to malfunction? I actually didn't know that, thank you!
Actually strings that are longer than 129 (max characters a chat message supports) won't even appear on the chat!

Using colors in dialogs work just great, as dialogs support a larger amount of colors/characters.


Re: Skipping a format? - Skylar Paul - 22.03.2011

Quote:
Originally Posted by Zh3r0
Посмотреть сообщение
Actually strings that are longer than 129 (max characters a chat message supports) won't even appear on the chat!

Using colors in dialogs work just great, as dialogs support a larger amount of colors/characters.
Interesting, thank you very much!