Need assistance with Strcat
#1

I made a regular format for the dialog but apparently I used to much characters already, and I'm just in the very beginning of this gamemode. There has to be added three times as much in the future.

Код:
(660) : error 075: input line too long (after substitutions)
I tried getting along with Strcat but I keep getting multiple errors, if someone can put it in the right order and such would be great. Here is the original command.

Код:
CMD:stats(playerid, params[])
{
	new string[1024];
	format(string, sizeof(string), ""COL_LIGHTBLUE"GENERAL INFORMATION:\n"COL_WHITE"Character Level: %d\nExperience: %d\nCash: %d\nBank: %d\nKills: %d\nDeaths: %d\nMaster Keys: %d\n\n"COL_LIGHTBLUE"GAME STATICS:\n"COL_WHITE"Caught Fishes: %d\nCut Trees: %d\n", GetPlayerScore(playerid), PlayerInfo[playerid][pExp], GetPlayerMoney(playerid), PlayerInfo[playerid][pBank], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pMkey], PlayerInfo[playerid][pFishtotal], PlayerInfo[playerid][pLogstotal]);
	ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX,"Personal Statistics", string,"Close","");
	return 1;
}
Thanks in advance!
Reply
#2

There's so much ways to do even if you keep using format.

The first one is to make frequent line returns and to use the antislash \ at the end of each of them.
The second one is to download Zeex's compiler patch which increase the maximum characters limit to more than 4000.
Reply
#3

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
There's so much ways to do even if you keep using format.

The first one is to make frequent line returns and to use the antislash \ at the end of each of them.
The second one is to download Zeex's compiler patch which increase the maximum characters limit to more than 4000.
Thanks for the quick and useful response!

Код:
GetPlayerScore(playerid), PlayerInfo[playerid][pExp], GetPlayerMoney(playerid), PlayerInfo[playerid][pBank], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pMkey], PlayerInfo[playerid][pFishtotal], PlayerInfo[playerid][pLogstotal]
As above, am I able to put a \ there aswell? Well basicly I tried it and gives me about 6 errors, same as strcat.

I downloaded Zeex's compiler patch, just place it all on the desktop and run it? Or would I place it in the server folder?
Reply
#4

You have to replace your compiler files (so basically in your pawno folder) by the one you've downloaded.

And this is an example of how to use antislashes :

PHP код:

new myString[256];
format(myString256"Hi, this is a long message. I'll put some useless chars such as a flood of k to show you how to proceed. \
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk \
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk \
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk \
It's over. I hope you now know how to proceed."
); 
By the way, you can't use "strcat" with specifiers like "%s" or "%d" or "%f". Use format instead. strcat is used to concatenate two ready-to-use (so formatted) strings in one.
Reply
#5

here you go
pawn Код:
CMD:stats(playerid, params[])
{
    new string[1024], holder[128];
    format(string, sizeof(string), ""COL_LIGHTBLUE"GENERAL INFORMATION:\n"COL_WHITE"Character Level: %d\nExperience: %d\nCash: %d\nBank: %d\n",GetPlayerScore(playerid), PlayerInfo[playerid][pExp], GetPlayerMoney(playerid), PlayerInfo[playerid][pBank]);
    strcat(holder, string, sizeof(holder));
    format(string, sizeof(string), ""COL_WHITE"Kills: %d\nDeaths: %d\nMaster Keys: %d\n\n"COL_LIGHTBLUE"GAME STATICS:\n"COL_WHITE"Caught Fishes: %d\nCut Trees: %d\n",PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pMkey], PlayerInfo[playerid][pFishtotal], PlayerInfo[playerid][pLogstotal]);
    strcat(holder, string, sizeof(holder));
    ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX,"Personal Statistics", holder,"Close","");
    return 1;
}
Reply
#6

Quote:
Originally Posted by BlackBomb
Посмотреть сообщение
here you go
pawn Код:
CMD:stats(playerid, params[])
{
    new string[1024], holder[128];
    format(string, sizeof(string), ""COL_LIGHTBLUE"GENERAL INFORMATION:\n"COL_WHITE"Character Level: %d\nExperience: %d\nCash: %d\nBank: %d\n",GetPlayerScore(playerid), PlayerInfo[playerid][pExp], GetPlayerMoney(playerid), PlayerInfo[playerid][pBank]);
    strcat(holder, string, sizeof(holder));
    format(string, sizeof(string), ""COL_WHITE"Kills: %d\nDeaths: %d\nMaster Keys: %d\n\n"COL_LIGHTBLUE"GAME STATICS:\n"COL_WHITE"Caught Fishes: %d\nCut Trees: %d\n",PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pMkey], PlayerInfo[playerid][pFishtotal], PlayerInfo[playerid][pLogstotal]);
    strcat(holder, string, sizeof(holder));
    ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX,"Personal Statistics", holder,"Close","");
    return 1;
}
This worked thanks!

I tried to use antislashes but appearently I did something wrong but somewhere on the new line where it said "playerid" it went reading it as "playe" "rid" and gave me errors over that.. Also I added Zeex's Compiler patch and when I started to compile it said "a_npc" or "a_samp" has to be included, while I had both of them included, so I reset it back to my backup.

It works now, thanks to both!
Reply
#7

If you use the sscanf2 include, you must compile with the -Z mode (or to edit a little bit the sscanf include).
If you know how to compile using the -d3 mode, simply add " -Z" just after -d3 (without the quotes), then save and rebuild. The solution is from ******.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)