SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 15/08/2018, 10:20 PM   #1
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 716
Reputation: 43
Default Dialog

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.
KinderClans is offline   Reply With Quote
Old 16/08/2018, 01:55 AM   #2
ToiletDuck
Huge Clucker
 
ToiletDuck's Avatar
 
Join Date: Apr 2012
Location: Philippines, Lucena City
Posts: 400
Reputation: 43
Default Re: Dialog

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
ToiletDuck is offline   Reply With Quote
Old 16/08/2018, 02:25 AM   #3
Akeem
Big Clucker
 
Join Date: Aug 2017
Location: Guyana
Posts: 96
Reputation: 0
Default Re: Dialog

Because everytime you do it your overwriting the above one. I recommand using strcat
Akeem is offline   Reply With Quote
Old 16/08/2018, 10:24 AM   #4
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 716
Reputation: 43
Default Re: Dialog

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.
KinderClans is offline   Reply With Quote
Old 16/08/2018, 11:00 AM   #5
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 716
Reputation: 43
Default Re: Dialog

So how i have to do?
KinderClans is offline   Reply With Quote
Old 16/08/2018, 11:20 AM   #6
CodeStyle175
Banned
 
Join Date: Apr 2014
Posts: 455
Reputation: 35
Default Re: Dialog

again use arrays for jobs, at the moment your are wasting so many rows.
CodeStyle175 is offline   Reply With Quote
Old 16/08/2018, 11:35 AM   #7
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 716
Reputation: 43
Default Re: Dialog

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.
KinderClans is offline   Reply With Quote
Old 17/08/2018, 09:35 AM   #8
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 716
Reputation: 43
Default Re: Dialog

Bump.
KinderClans is offline   Reply With Quote
Old 18/08/2018, 10:25 AM   #9
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 716
Reputation: 43
Default Re: Dialog

Nobody?
KinderClans is offline   Reply With Quote
Old 18/08/2018, 12:35 PM   #10
Exhibit
Big Clucker
 
Join Date: Dec 2015
Location: Pakistan
Posts: 180
Reputation: 22
Default Re: Dialog

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

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
[DIALOG]How i Create A dialog Whent Player Login To Enter in Dialog The Password donhu789 Scripting Help 8 29/09/2013 07:15 AM
Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID Blackazur Scripting Help 1 30/04/2013 06:25 PM
[19:58:45] Warning: PlayerDialogResponse PlayerId: 28 dialog ID doesn't match last sent dialog ID, what it means? niels44 Scripting Help 6 13/06/2012 05:53 PM
Big problem (PlayerDialogResponse PlayerId: 57 dialog ID doesn't match last sent dialog ID) RingoRus Server Support 3 12/06/2012 05:54 PM


All times are GMT. The time now is 06:32 AM.


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