Dialog
#1

I don't understand why this dialog shows only the last line, what's wrong?

pawn Code:
stock ShowJobCommands(playerid)
{
    new temp[500];
    switch (Player[playerid][Job])
    {
        case 0:
        {
            SendClientMessage(playerid,COLOR_RED,"* You don't have a job. Get one from City Hall.");
        }
        case 1:
        {
            format(temp, sizeof(temp), ""SAMP_BLUE"Drug Dealer Job Commands\n");
            format(temp, sizeof(temp), ""ORANGE_RED"/plant "WHITE"- Plant marijuana, heroine or cocaine seeds and let your plant grow.\n");
            format(temp, sizeof(temp), ""WHITE"Once your plant is fully grown (you can see it by reading info label on the plant), you can "ORANGE_RED"/harvest "WHITE"it.\n");
            format(temp, sizeof(temp), ""WHITE"Once you have harvested your plant, go to a local drug selling point (located with the ""D"" icon on the map) and type "ORANGE_RED"/selldrugs.\n");
        }
        case 2:
        {
            format(temp, sizeof(temp), ""SAMP_BLUE"Weapons Dealer Job Commands\n");
        }
        case 3:
        {
            format(temp, sizeof(temp), ""SAMP_BLUE"Trucker Job Commands\n");
        }
        case 4:
        {
            format(temp, sizeof(temp), ""SAMP_BLUE"Taxi Driver Job Commands\n");
        }
        case 5:
        {
            format(temp, sizeof(temp), ""SAMP_BLUE"Bus Driver Job Commands\n");
        }
        case 6:
        {
            format(temp, sizeof(temp), ""SAMP_BLUE"Mechanic Job Commands\n");
        }
        case 7:
        {
            format(temp, sizeof(temp), ""SAMP_BLUE"Pizza Boy Job Commands\n");
        }
    }
    ShowPlayerDialog(playerid, DIALOG_JOB_CMDS, DIALOG_STYLE_MSGBOX,""ORANGE_RED"Job Commands",temp,"Close","");
    return 1;
}
It shows just

Quote:

format(temp, sizeof(temp), ""WHITE"Once you have harvested your plant, go to a local drug selling point (located with the ""D"" icon on the map) and type "ORANGE_RED"/selldrugs.\n");

where it should show from "Drug Dealer Job Commands" to the text i quoted.
Reply
#2

Code:
format(temp, sizeof(temp), ""SAMP_BLUE"Drug Dealer Job Commands\n");
format(temp, sizeof(temp), "%s"ORANGE_RED"/plant "WHITE"- Plant marijuana, heroine or cocaine seeds and let your plant grow.\n", temp);
format(temp, sizeof(temp), "%s"WHITE"Once your plant is fully grown (you can see it by reading info label on the plant), you can "ORANGE_RED"/harvest "WHITE"it.\n", temp);
format(temp, sizeof(temp), "%s"WHITE"Once you have harvested your plant, go to a local drug selling point (located with the ""D"" icon on the map) and type "ORANGE_RED"/selldrugs.\n",temp);
or use the alternative strcat much better
Code:
strcat(temp, ""SAMP_BLUE"Drug Dealer Job Commands\n");
strcat(temp, ""ORANGE_RED"/plant "WHITE"- Plant marijuana, heroine or cocaine seeds and let your plant grow.\n");
strcat(temp, ""WHITE"Once your plant is fully grown (you can see it by reading info label on the plant), you can "ORANGE_RED"/harvest "WHITE"it.\n");
strcat(temp, ""WHITE"Once you have harvested your plant, go to a local drug selling point (located with the ""D"" icon on the map) and type "ORANGE_RED"/selldrugs.\n");
and do the rest
Reply
#3

Because everytime you do it your overwriting the above one. I recommand using strcat
Reply
#4

Ok thanks. I also fixed another dialog which had this problem too.

Howerver after using strcat i have a problem:

pawn Code:
strcat(temp, ""SAMP_BLUE"Drug Dealer Job Stats\n\n");
            strcat(temp, "Marijuana Seeds: "ORANGE_RED"%d\n\n",Player[playerid][MarijuanaSeeds]);
            strcat(temp, ""WHITE"Cocaine Seeds: "ORANGE_RED"%d\n\n",Player[playerid][CocaineSeeds]);
            strcat(temp, ""WHITE"Heroin Seeds: "ORANGE_RED"%d\n\n",Player[playerid][HeroinSeeds]);
            strcat(temp, ""WHITE"Marijuana Grams: "ORANGE_RED"%d\n\n",Player[playerid][MarijuanaGrams]);
            strcat(temp, ""WHITE"Cocaine Grams: "ORANGE_RED"%d\n\n",Player[playerid][CocaineGrams]);
            strcat(temp, ""WHITE"Heroin Grams: "ORANGE_RED"%d\n\n",Player[playerid][HeroinGrams]);
            strcat(temp, ""WHITE"Total Earned From Selling Marijuana: "ORANGE_RED"%d\n\n",Player[playerid][MarijuanaEarnings]);
            strcat(temp, ""WHITE"Total Earned From Selling Cocaine: "ORANGE_RED"%d\n\n",Player[playerid][CocaineEarnings]);
            strcat(temp, ""WHITE"Total Earned From Selling Heroin: "ORANGE_RED"%d\n\n",Player[playerid][HeroinEarnings]);
Seems doesn't pass %d values, because in game i see "Marijuana Seeds: %d" and same for other stats.
Reply
#5

So how i have to do?
Reply
#6

again use arrays for jobs, at the moment your are wasting so many rows.
Reply
#7

Tried this way:

pawn Code:
format(temp, sizeof(temp), ""SAMP_BLUE"Drug Dealer Job Stats\n\n");
            strcat(info, temp);
            format(temp, sizeof(temp), "Marijuana Seeds: "ORANGE_RED"%d\n\n",Player[playerid][MarijuanaSeeds]);
            strcat(info, temp);
            format(temp, sizeof(temp), ""WHITE"Cocaine Seeds: "ORANGE_RED"%d\n\n",Player[playerid][CocaineSeeds]);
            strcat(info, temp);
            format(temp, sizeof(temp), ""WHITE"Heroin Seeds: "ORANGE_RED"%d\n\n",Player[playerid][HeroinSeeds]);
            strcat(info, temp);
            format(temp, sizeof(temp), ""WHITE"Marijuana Grams: "ORANGE_RED"%d\n\n",Player[playerid][MarijuanaGrams]);
            strcat(info, temp);
            format(temp, sizeof(temp), ""WHITE"Cocaine Grams: "ORANGE_RED"%d\n\n",Player[playerid][CocaineGrams]);
            strcat(info, temp);
            format(temp, sizeof(temp), ""WHITE"Heroin Grams: "ORANGE_RED"%d\n\n",Player[playerid][HeroinGrams]);
            strcat(info, temp);
            format(temp, sizeof(temp), ""WHITE"Total Earned From Selling Marijuana: "ORANGE_RED"%d\n\n",Player[playerid][MarijuanaEarnings]);
            strcat(info, temp);
            format(temp, sizeof(temp), ""WHITE"Total Earned From Selling Cocaine: "ORANGE_RED"%d\n\n",Player[playerid][CocaineEarnings]);
            strcat(info, temp);
            format(temp, sizeof(temp), ""WHITE"Total Earned From Selling Heroin: "ORANGE_RED"%d\n\n",Player[playerid][HeroinEarnings]);
            strcat(info, temp);
But showing just "Total Earned From Selling Heroin" line.
Reply
#8

Bump.
Reply
#9

Nobody?
Reply
#10

Use format...
PHP Code:
format(stringsizeof(string), "This is the 1st line.\n");
format(stringsizeof(string), "%sThis is the 2nd line."string); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)