After formatting string it won't print string out
#3

Its not printf, the problem is that your code crashes due to an array out of bounds error
Next time try the crashdetect plugin which would have told you

In both loops you do
pawn Code:
for(new i; i < sizeof(Contact); i++) // i < MAX_PLAYERS
But you actually wanted to do
pawn Code:
for(new i; i < sizeof(Contact[]); i++) // i < MAX_CONTACTS
So fixed it could look like
pawn Code:
//
    for(new i, text[32] = "None"; i < sizeof Contact[]; i++) {
        Contact[playerid][i][ContactName] = text;
        Contact[playerid][i][ContactNumber] = 0;
    }
pawn Code:
//
    new
        str[MAX_CONTACTS * 38] = "Lisa uus kontakt"
    ;
    for(new i; i < sizeof Contact[]; i++) {
        format(str, sizeof str, "%s\n%s (%d)", str, Contact[playerid][i][ContactName], Contact[playerid][i][ContactNumber]);
    }
    TELEFON_valik[playerid] = 10;
    ShowPlayerDialog(playerid, DIALOG_TELEFON, DIALOG_STYLE_LIST, "Telefon (Kontaktid)", str, "Vali", "Katkesta");
Reply


Messages In This Thread
After formatting string it won't print string out - by Typhome - 03.07.2013, 22:49
Re: After formatting string it won't print string out - by iPoisonxL - 03.07.2013, 23:16
AW: After formatting string it won't print string out - by Nero_3D - 04.07.2013, 00:00
Re: After formatting string it won't print string out - by Typhome - 04.07.2013, 09:19

Forum Jump:


Users browsing this thread: 2 Guest(s)