SA-MP Forums Archive
Dialog Not Showing Due to Stock - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog Not Showing Due to Stock (/showthread.php?tid=484072)



Dialog Not Showing Due to Stock - Deduction - 29.12.2013

Hey Guys,
I am making a Dialog MDC System and it works fine without having it get a string from a stock.
Can someone please let me know what is happening.

The line using the stock is:
pawn Код:
format(string, sizeof(string), "Name: %s, Age: 21, Current Charges: %s", inputtext, GetCharges(i));
And here is the stock:
pawn Код:
stock GetCharges(playerid)
{
    new string[256];
    for(new i = 0; i < 7; i++)
    {
        if(!isempty(g_PlayerInfo[playerid][pCharges][i]))
        {
            format(string, sizeof(string), "Charge %d: %s\n", i, g_PlayerInfo[playerid][pCharges][i]);
        }
        else if(isempty(g_PlayerInfo[playerid][pCharges][i]))
        {
            format(string, sizeof(string), "No Charge\n", i, g_PlayerInfo[playerid][pCharges][i]);
        }
    }
    return string;
}
And pCharges is like pCharges[6] under the PlayerInfo.
And I try to add pCharges[6][128] but it returns error 001: expected token: "}", but found "["


Re: Dialog Not Showing Due to Stock - Mattakil - 29.12.2013

you need a string to store your charges in. IE:

pawn Код:
stock GetCharges(playerid, charges[])
{
    for(new i = 0; i < 7; i++)
    {
        if(!isempty(g_PlayerInfo[playerid][pCharges][i]))
        {
            format(charges, sizeof(charges), "Charge %d: %s\n", i, g_PlayerInfo[playerid][pCharges][i]);
        }
        else if(isempty(g_PlayerInfo[playerid][pCharges][i]))
        {
            format(charges, sizeof(charges), "No Charge\n", i, g_PlayerInfo[playerid][pCharges][i]);
        }
    }
    return 1;
}
Then you need:

pawn Код:
new Charges[100];//pick a size that works, 100 is probably too small
format(string, sizeof(string), "Name: %s, Age: 21, Current Charges: %s", inputtext, GetCharges(i, charges));



Re: Dialog Not Showing Due to Stock - Emmet_ - 29.12.2013

You can't have a 2D array inside a 2D enum.

pawn Код:
static g_Charges[MAX_PLAYERS][7][128];



Re: Dialog Not Showing Due to Stock - Deduction - 29.12.2013

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
You can't have a 2D array inside a 2D enum.

pawn Код:
static g_Charges[MAX_PLAYERS][7][128];
Thankyou Emmet_
+REP