Need assistance with Strcat -
Verth - 22.06.2014
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!
Re : Need assistance with Strcat -
S4t3K - 22.06.2014
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.
Re: Re : Need assistance with Strcat -
Verth - 22.06.2014
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?
Re : Need assistance with Strcat -
S4t3K - 22.06.2014
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(myString, 256, "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.
Re: Need assistance with Strcat -
ReD_HunTeR - 22.06.2014
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;
}
Re: Need assistance with Strcat -
Verth - 22.06.2014
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!
Re : Need assistance with Strcat -
S4t3K - 22.06.2014
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 ******.