SA-MP Forums Archive
Text getting cut off - 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: Text getting cut off (/showthread.php?tid=240194)



Text getting cut off - Deal-or-die - 15.03.2011

Evening/Morning Fello Scripters
Hmmm... all of my text seems to be getting cut off in my /stats

Pic:

Image... <- Link

Script looks something like...
pawn Код:
stock ShowStatistics(playerid, id)
{
    if(Player[playerid][AdminLevel] >= Player[id][AdminLevel])
    {
        new string[128], GenderString[20], Rank[50], GroupString[128], phonestring[128], JobString[128];
        SendClientMessage(playerid, RED, "-------------------------------------------------------------------------------------------------------------------------------------");

        if(Player[id][Gender] == 1)
        {
            format(GenderString, sizeof(GenderString), "{FFFF00}Male");
        }
        else
        {
            format(GenderString, sizeof(GenderString), "{FFFF00}Female");
        }
       
        if(Player[id][PhoneN] == -1)
        {
            format(phonestring, sizeof(phonestring), "Phone Number: {FF0000}None");
        }
        else
        {
            format(phonestring, sizeof(phonestring), "Phone Number: {5DFC0A}%d", Player[id][PhoneN]);
        }

        if(Player[id][Job] >= 1)
        {
            format(JobString, sizeof(JobString), "{5DFC0A}%s", Jobs[Player[id][Job]]);
        }
        else
        {
            format(JobString, sizeof(JobString), "{FF0000}Unemployed");
        }

        if(Player[id][Group] >= 1)
        {
            format(GroupString, sizeof(GroupString), "{5DFC0A}%s", Groups[Player[id][Group]][GroupName]);
        }
        else
        {
            format(GroupString, sizeof(GroupString), "{FF0000}None");
        }
       
        if(Player[id][PlayingHours] < 1)
        {
            format(Rank, sizeof(Rank), "{5DFC0A}%s", OOCRanks[Rank1]);
        }
        else if(Player[id][PlayingHours] >= 1 && Player[id][PlayingHours] < 25)
        {
            format(Rank, sizeof(Rank), "{5DFC0A}%s", OOCRanks[Rank2]);
        }
        else if(Player[id][PlayingHours] >= 25 && Player[id][PlayingHours] < 100)
        {
            format(Rank, sizeof(Rank), "{5DFC0A}%s", OOCRanks[Rank3]);
        }
        else if(Player[id][PlayingHours] >= 100 && Player[id][PlayingHours] < 300)
        {
            format(Rank, sizeof(Rank), "{5DFC0A}%s", OOCRanks[Rank4]);
        }
        else if(Player[id][PlayingHours] >= 300)
        {
            format(Rank, sizeof(Rank), "{5DFC0A}%s", OOCRanks[Rank5]);
        }

   
        format(string, sizeof(string), "Name: {003EFF}%s {FFFFFF}| Age: {FFFF00}%d {FFFFFF}| Gender: %s {FFFFFF}| Job: %s {FFFFFF}| Group: %s {FFFFFF}| Rank: %d", GetName(id), Player[id][Age], GenderString, JobString, GroupString, Player[id][GroupRank]);
        SendClientMessage(playerid, WHITE, string);
       
        format(string, sizeof(string), "Playing Hours: {FFFF00}%d {FFFFFF}| Bank Money: {5DFC0A}$%s {FFFFFF}| Cocaine: {FF0000}%s {FFFFFF}G | Pot: {5DFC0A}%s {FFFFFF}G | Materials: {FFFF00}%s {FFFFFF}| {FFFF00}%s {FFFFFF}| Fish: {5DFC0A}%s", Player[id][PlayingHours], IntToFormattedStr(Player[id][BankMoney]), IntToFormattedStr(Player[id][Cocaine]), IntToFormattedStr(Player[id][Pot]), IntToFormattedStr(Player[id][Materials]), phonestring, IntToFormattedStr(Player[id][CollectedFish]));
        SendClientMessage(playerid, WHITE, string);
       
        format(string, sizeof(string), "Money: {00FF00}$%s {FFFFFF}| Phone Credit: {00FF00}$%s {FFFFFF}| Walkie Frequency:{0022E6}%d {FFFFFF}| Married To: {E600E6}%s", IntToFormattedStr(Player[id][Money]), IntToFormattedStr(Player[id][PhoneCredit]), Player[id][WalkieFrequency], Player[id][MarriedTo]);
        SendClientMessage(playerid, WHITE, string);
       
        format(string, sizeof(string), "Rope: {A25A03}%d {FFFFFF}| Rags: {FFFF00}%d {FFFFFF}| Recorded Crimes: {FF0000}%d {FFFFFF}| Status: {FF0000}%s", Player[id][Rope], Player[id][Rags], Player[id][CriminalOffences], Rank);
        SendClientMessage(playerid, WHITE, string);
Many Thanks in return to anyone that could fix this problem.
Cheers,
Steve


Re: Text getting cut off - AK47317 - 15.03.2011

pawn Код:
GenderString[250]
edit : fail lol


Re: Text getting cut off - Deal-or-die - 15.03.2011

Huh?
you mocking my strings? :P


Re: Text getting cut off - Bumbis - 15.03.2011

How long is the string for Player[id][MarriedTo]? At enum or smth.


Re: Text getting cut off - Deal-or-die - 15.03.2011

pawn Код:
enum PlayerStatistics
{
    MarriedTo[255],



Re: Text getting cut off - muede - 15.03.2011

it looks like the whole line has exceeded its total limit... Though I don't see where it's limited


Re: Text getting cut off - Zh3r0 - 15.03.2011

It's because of the colors, colors 1 color takes up to 8 characters {RRGGBB} < - strlen = 8.
But this should have not even showed up if the string limit was exceeded, so it's because of the size of your string.

Change
pawn Код:
new string[128]
to
pawn Код:
new string[ 256 ]
because now of the colors it takes even more!

(All text) + (All Colors) * 8


Re: Text getting cut off - Deal-or-die - 15.03.2011

Now i get :/

Pic...

It now removes the First two sentences and allowes the third to be full length? -.^

Am, i able to make the string like 3000?


Re: Text getting cut off - Zh3r0 - 15.03.2011

Quote:
Originally Posted by Deal-or-die
Посмотреть сообщение
Now i get :/

Pic...

It now removes the First two sentences and allowes the third to be full length? -.^

Am, i able to make the string like 3000?
Like i told you, when you had 150 length the string was cut, which made it work, but being cut.
Now, having a full length, it proceeded to the limit, which means the length of the string you are formating was too long!

And no, maximum characters a string can have is 1024.

I suggest you to use a dialog, dialogs support a large amount of characters, which means, MORE COLORS!


Re: Text getting cut off - Deal-or-die - 15.03.2011

No its can't be, it's just cutting the first 2 sentences of the stats i surely don't have 1024 Characters/letters/numbers there (If that's how it counts it)