SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Thread Tools Display Modes
Old 22/02/2019, 11:47 PM   #1
Little Clucker
cataplasia's Avatar
Join Date: Sep 2016
Posts: 5
Reputation: 0
Default 3D array into a dialog message


I'm trying to insert a three-dimensional array into a dialog box. The code I have just outputs the standard error message whenever I try to type the command in-game. Not getting any compiler errors.

pawn Code:
CMD:teams(playerid, params[])
    new arenas[12][2][128] =
        {"Dust 2", "Teaming permitted"},
        {"Jefferson Motel", "Teaming permitted"},
        {"Liberty City", "Teaming forbidden"},
        {"LVPD", "Teaming forbidden"},
        {"Madd Dogg's Mansion", "Teaming permitted"},
        {"Meat Factory", "Teaming forbidden"},
        {"Pleasure Domes", "Teaming forbidden"},
        {"RC Battle Ground", "Teaming permitted"},
        {"Tennis Court", "Teaming forbidden"},
        {"The Farm", "Teaming forbidden"},
        {"The Sewers", "Teaming permitted"},
        {"Western Town", "Teaming permitted"}

    new string[512];

    for (new i=0; i < sizeof(arenas); i++)
        for (new j=0; j < sizeof(arenas); j++)
            strcat(string, sprintf("%s\t%s\n", arenas[i][j], arenas[i][j], sizeof(string)));

    Dialog_Show(playerid, ArenasList, DIALOG_STYLE_MSGBOX, "Arena Teaming Rules", string, "OK", "OK");
    return 1;

I'm new, and I understand that you're probably cringing reading my code right now. I really appreciate your help regardless. Cheers!

Just to clarify, I want the array to be inserted into the dialog box so it outputs the contents of the array into the box.
cataplasia is offline   Reply With Quote
Old 23/02/2019, 12:41 AM   #2
Little Clucker
CherryMond's Avatar
Join Date: Feb 2018
Posts: 28
Reputation: 0
Default Re: 3D array into a dialog message

In this case you don't need a second loop, it's enough:
PHP Code:
for (new 0sizeof(arenas); i++){
format(stringsizeof string"%s%s\t%s\n"stringarenas[i][0], arenas[i][1]);

CherryMond is offline   Reply With Quote
Old 23/02/2019, 01:07 AM   #3
Nero_3D's Avatar
Join Date: Jun 2007
Location: Germany
Posts: 2,852
Reputation: 675
Default Re: 3D array into a dialog message

do you use that array somewhere else?, in your example you could put the text (with the correct formation) directly into Dialog_Show
Nero_3D is online now   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Message into dialog boy Scripting Help 2 11/05/2016 07:40 PM
Message dialog box help. Player23 Scripting Help 13 25/12/2013 01:55 PM
make this to dialog message box kbalor Scripting Help 2 28/09/2013 11:06 PM
make this to dialog message box kbalor Scripting Help 7 28/09/2013 02:16 PM
Dialog response not Sending Message [Input Dialog] Deal-or-die Scripting Help 8 08/05/2012 01:10 PM

All times are GMT. The time now is 06:33 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.