PDA

View Full Version : To long format any solution for this?


Razturach
28/01/2015, 07:52 PM
Hello!

I've made format, it was working great untill I over extended it, and if it's to long it's not working, is there any solution to make it work? rep+ for helpers.

code:
format(string, sizeof(string), "{FFFFFF}Welcome back {00FF00}%s{FFFFFF}! \n\nThis account is registered. \nInsert your password to {00FF00}login {FFFFFF}to your account.\n\n{FFFFFF}Current time:{FF8000} %02d:%02d\t\t\t{FFFFFF}Times Logged:{FF8000} %d\n{FFFFFF}Date:{FF8000} %02d/%02d/%d\t\t\t{FFFFFF}Failed Attempts:{FF0000} 0/3\n{FFFFFF}Players in city: {FF8000}%d\t\t\t{FFFFFF}Last Login:{FF8000} %02d/%02d/%d",name,hour,minute,pInfo[playerid][Logins],day,month,year,Iter_Count(Player),pInfo[playerid][LastLoginD],pInfo[playerid][LastLoginM],pInfo[playerid][LastLoginY]);
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPU T,"{FF8000}TEST",string,"Login","Quit");

Thanks for answers in advance!

arlindi
28/01/2015, 07:56 PM
U must use new string[1000];
And it work Try this

Razturach
28/01/2015, 08:23 PM
Yeah I used bigger number the problem is my pawno actually crashes when I try to compile

arlindi
28/01/2015, 08:27 PM
Show the command here or anywheere you are using it

Razturach
28/01/2015, 09:11 PM
Format for dialog.. check it how long is it, this fucks up the compiler

public OnPlayerConnect(playerid)
{
new hour, minute, second, string[500], year, month, day;
getdate(year, month, day);
gettime(hour, minute, second);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
//format(string,sizeof(string),"Last Login: %02d/%02d/%d",pInfo[playerid][LastLoginD],pInfo[playerid][LastLoginM],pInfo[playerid][LastLoginY]);
//SendClientMessage(playerid, -1, string);
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
format(string, sizeof(string), "{FFFFFF}Welcome back {00FF00}%s{FFFFFF}! \n\nThis account is registered. \nInsert your password to {00FF00}login {FFFFFF}to your account.\n\n{FFFFFF}Current time:{FF8000} %02d:%02d\t\t\t{FFFFFF}Times Logged:{FF8000} %d\n{FFFFFF}Date:{FF8000} %02d/%02d/%d\t\t\t{FFFFFF}Failed Attempts:{FF0000} 0/3\n{FFFFFF}Players in city: {FF8000}%d\t\t\t{FFFFFF}Last Login:{FF8000} %02d/%02d/%d",name,hour,minute,pInfo[playerid][Logins],day,month,year,Iter_Count(Player),pInfo[playerid][LastLoginD],pInfo[playerid][LastLoginM],pInfo[playerid][LastLoginY]);
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPU T,"{FF8000} TEST",string,"Login","Quit"); // 23 spaces
}
else
{
format(string, sizeof(string), "{FFFFFF}Welcome to {FF8000}TEST {00FF00}%s{FFFFFF}! \n\nIf you want to join us, go and make your first step into\n{FF8000}TEST{FFFFFF} and {00FF00}register{FFFFFF} your account\nwith typing the password into box below.",name);
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_I NPUT,"{FF8000} TEST ",string,"Register","Quit"); // 22 spaces
return 1;
}
return 1;
}

vassilis
28/01/2015, 10:50 PM
There are many solutions:

1) Make it shorter.
2) Use multiple lines.
3) Use a different compiler.
4) Use multiple formats.

i wonder if strcat could help him in this case.. could it help him?

Ironboy
28/01/2015, 10:52 PM
You could better use strcat.

Razturach
29/01/2015, 04:52 PM
May someone tell me how to use strcat in this case, or actually what do you suggest ?