SA-MP Forums Archive
Problem with dialog [ REP ++] easy but hard to me - 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: Problem with dialog [ REP ++] easy but hard to me (/showthread.php?tid=547339)



Problem with dialog [ REP ++] easy but hard to me - buburuzu19 - 22.11.2014

FIXED!


Re: Problem with dialog [ REP ++] easy but hard to me - Sledgehammer - 22.11.2014

pawn Code:
CMD:myvehicles(playerid,params[])
{
        new string[800];
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
        format(string, sizeof(string), "%s%s\n", string, VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
        format(string, sizeof(string), "%s%s\n", string, VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
        format(string, sizeof(string), "%s%s\n", string, VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
        ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "Your personal vehicles", string, "Ok", "Close");
        return 1;

}
Try this. Does this method work? If so, Don't forget to rep++ .


Re: Problem with dialog [ REP ++] easy but hard to me - buburuzu19 - 22.11.2014

Quote:
Originally Posted by Death1300
View Post
pawn Code:
CMD:myvehicles(playerid,params[])
{
        new string[800];
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
        format(string, sizeof(string), "%s%s\n", string, VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
        format(string, sizeof(string), "%s%s\n", string, VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
        format(string, sizeof(string), "%s%s\n", string, VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
        ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "Your personal vehicles", string, "Ok", "Close");
        return 1;

}
Try this. Does this method work? If so, Don't forget to rep++ .
Not working, command isn't showing up!


Re: Problem with dialog [ REP ++] easy but hard to me - AndySedeyn - 22.11.2014

You are reformatting the same string over and over again.
Format the string and use strcat to add them up to each other.

Like this:
pawn Code:
CMD:myvehicles(playerid,params[])
{
        new sstring[/*Specify size here*/], string[/*Specify size here*/];
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
        strcat(sstring, string);
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
        strcat(sstring, string);
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
        strcat(sstring, string);
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
        strcat(sstring, string);
        ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "Your personal vehicles", sstring, "Ok", "Close");
        return 1;
}



Re: Problem with dialog [ REP ++] easy but hard to me - buburuzu19 - 22.11.2014

Quote:
Originally Posted by Bible
View Post
You are reformatting the same string over and over again.
Format the string and use strcat to add them up to each other.

Like this:
pawn Code:
CMD:myvehicles(playerid,params[])
{
        new sstring[/*Specify size here*/], string[/*Specify size here*/];
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
        strcat(sstring, string);
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
        strcat(sstring, string);
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
        strcat(sstring, string);
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
        strcat(sstring, string);
        ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "Your personal vehicles", sstring, "Ok", "Close");
        return 1;
}
Not working , command isn't showing up. I tried put 800 string to both but nothing happens.


Re: Problem with dialog [ REP ++] easy but hard to me - buburuzu19 - 22.11.2014

I rep ++ who helps me 2reps , if i let just 2 strcat's it's showing , i tried to put string to 10,000 and use all 4 strcat's but nothing shows up when i type /myvehicles.


Re: Problem with dialog [ REP ++] easy but hard to me - Beckett - 22.11.2014

Why would you use 800 cells? That's way too much and you only need around 30 cells because the max cars you can have are 4 and lets say every car takes around 6-8 cells, approximately 30, let's make it 50 now you can change it later.

pawn Code:
CMD:myvehicles(playerid,params[])
{

        new string[50];
        format(string,sizeof(string),"%s\n%s\n%s\n%s",VehicleNames[playerVariables[playerid][pCarModel1] - 400]
        ,VehicleNames[playerVariables[playerid][pCarModel2] - 400]
        ,VehicleNames[playerVariables[playerid][pCarModel3] - 400]
        ,VehicleNames[playerVariables[playerid][pCarModel4] - 400])
        ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "Your personal vehicles", string, "Ok", "Close");
        return 1;

}
Tell me the results.

Question: When you type /myvehicles does the dialog show and what's in it is empty or what?


Re: Problem with dialog [ REP ++] easy but hard to me - buburuzu19 - 22.11.2014

Quote:
Originally Posted by DaniceMcHarley
View Post
Why would you use 800 cells? That's way too much and you only need around 30 cells because the max cars you can have are 4 and lets say every car takes around 6-8 cells, approximately 30, let's make it 50 now you can change it later.

pawn Code:
CMD:myvehicles(playerid,params[])
{

        new string[50];
        format(string,sizeof(string),"%s\n%s\n%s\n%s",VehicleNames[playerVariables[playerid][pCarModel1] - 400]
        ,VehicleNames[playerVariables[playerid][pCarModel2] - 400]
        ,VehicleNames[playerVariables[playerid][pCarModel3] - 400]
        ,VehicleNames[playerVariables[playerid][pCarModel4] - 400])
        ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "Your personal vehicles", string, "Ok", "Close");
        return 1;

}
Tell me the results.

Question: When you type /myvehicles does the dialog show and what's in it is empty or what?
The dialog isn't showing..


Re: Problem with dialog [ REP ++] easy but hard to me - JoshNudock - 22.11.2014

removido


Re: Problem with dialog [ REP ++] easy but hard to me - buburuzu19 - 22.11.2014

Quote:
Originally Posted by JoshNudock
View Post
removido
Why removed?


Re: Problem with dialog [ REP ++] easy but hard to me - Raweresh - 22.11.2014

It must works, do this and show result.
Код:
printf("%i %i %i",playerVariables[playerid][pCarModel2],playerVariables[playerid][pCarModel3],playerVariables[playerid][pCarModel4]);
And show us variable VehicleNames.


Re: Problem with dialog [ REP ++] easy but hard to me - buburuzu19 - 22.11.2014

Quote:
Originally Posted by PabLo98
Посмотреть сообщение
Try this code below, and just modify the messages.

pawn Код:
CMD:myvehicles(playerid,params[])
{
                new StatsMsg[1000];
                new TitleMsg[128];

                format(StatsMsg, 1000, "Model: %s\n", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
                format(StatsMsg, 1000, "Model: %s\n", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
                format(StatsMsg, 1000, "Model: %s\n", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
                format(TitleMsg, 128, "Your personal vehicles");
                ShowPlayerDialog(playerid, DialogStats, DIALOG_STYLE_LIST, TitleMsg, StatsMsg, "Ok", "Close");
        return 1;

}
It's showing to me only the first vehicle model.


Re: Problem with dialog [ REP ++] easy but hard to me - buburuzu19 - 22.11.2014

Guys i am triying to do something with this command but nothing shows up:
pawn Код:
CMD:myvehicles(playerid,params[])
{
        new sstring[10000], string[10000];
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
        strcat(sstring, string);
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
        strcat(sstring, string);
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
        strcat(sstring, string);
        format(string, sizeof(string), "%s\n", VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
        strcat(sstring, string);
        printf("%i %i %i %i",playerVariables[playerid][pCarModel1],playerVariables[playerid][pCarModel2],playerVariables[playerid][pCarModel3],playerVariables[playerid][pCarModel4]);
        ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "Your personal vehicles", sstring, "Ok", "Close");
        return 1;
}



Re: Problem with dialog [ REP ++] easy but hard to me - buburuzu19 - 22.11.2014

FIXXXXED!


Re: Problem with dialog [ REP ++] easy but hard to me - buburuzu19 - 22.11.2014

Fixed!