String lenght is too high
#21

Quote:
Originally Posted by Adamoneoone
Посмотреть сообщение
OMG, How many times will I have to say it? Read previous posts.
OMG, How many times will we have to say it? You can't bypass the limit.
Reply
#22

bumperino

Quote:
Originally Posted by xMoBi
Посмотреть сообщение
OMG, How many times will we have to say it? You can't bypass the limit.
The thing is, I know it's possible, as i've seen it working fully on another server. If it wasn't possible, I wouldn't even have posted this in the first place.
Reply
#23

Quote:
Originally Posted by Zeth
Посмотреть сообщение
No need of using 9000 as as strlen is only 1080 after removing {FFFFFF} which was useless as its white by default.
No the embeds are not "removed" or rendered at compile time they are still characters.It's only rendered at runtime.

@OP: You can't bypass the limit.You should split your contents into "multiple pages"
Reply
#24

Use less color codes. If you're only using {FFFFFF} you can completely omit them and set the label color to white. No sense in using colors when they never change.

Also why do you do the list by hand? Just use an array (which can be found in for example fsdebug) and format it using a loop. 3 minutes of work instead of an hour.
Reply
#25

You can use this code to do multiple pages:

Definition:
Код:
#define        MAX_LINE_PER_PAGE        30
Variable:
Код:
static        playerPage[MAX_PLAYERS] = {0, ...};
Array:
Код:
new vehList[][] = {
        {"{FFFFFF}BMX"},
};
Function:
Код:
ShowPlayerVehicleDialog(playerid) {
        static msg[30 * MAX_LINES_PER_PAGE], page = playerPage[playerid], i = page; // opimisation
        for (; i < sizeof vehList; i++) {
                if (i != 0 && (i - MAX_LINES_PER_PAGE) > MAX_LINES_PER_PAGE) break; // if player page is 0 then continue

                strcat(msg, sizeof msg, "\n");
                strcat(msg, sizeof msg, vehList[i]);
        }

        if (playerPage[playerid] >= sizeof vehList) {
                SendClientMessage(playerid, -1, "Dialog closed.");
                playerPage[playerid] = 0;
                return false;
        }

        ShowPlayerDialog(playerid, DIALOG_VEHICLES, DIALOG_STYLE_LIST, "Vehicle List", msg, "Select", "Next");

        return false; // this means the code successfully worked
}
Command:
Код:
CMD:vehiclelist(playerid) {
        ShowPlayerVehicleDialog(playerid);
        return 1;
}
When player press "Select", use ShowPlayerVehicleDialog
Reply
#26

Quote:
Originally Posted by xMoBi
Посмотреть сообщение
You can use this code to do multiple pages:

Definition:
Код:
#define        MAX_LINE_PER_PAGE        30
Variable:
Код:
static        playerPage[MAX_PLAYERS] = {0, ...};
Array:
Код:
new vehList[][] = {
        {"{FFFFFF}BMX"},
};
Function:
Код:
ShowPlayerVehicleDialog(playerid) {
        static msg[30 * MAX_LINES_PER_PAGE], page = playerPage[playerid], i = page; // opimisation
        for (; i < sizeof vehList; i++) {
                if (i != 0 && (i - MAX_LINES_PER_PAGE) > MAX_LINES_PER_PAGE) break; // if player page is 0 then continue

                strcat(msg, sizeof msg, "\n");
                strcat(msg, sizeof msg, vehList[i]);
        }

        if (playerPage[playerid] >= sizeof vehList) {
                SendClientMessage(playerid, -1, "Dialog closed.");
                playerPage[playerid] = 0;
                return false;
        }

        ShowPlayerDialog(playerid, DIALOG_VEHICLES, DIALOG_STYLE_LIST, "Vehicle List", msg, "Select", "Next");

        return false; // this means the code successfully worked
}
Command:
Код:
CMD:vehiclelist(playerid) {
        ShowPlayerVehicleDialog(playerid);
        return 1;
}
When player press "Select", use ShowPlayerVehicleDialog
Alright, thanks a lot I think that will do instead. When I'm going to use OnDialogResponse, the process is the same?
Each case corresponds to an item of the array?
Reply
#27

Quote:
Originally Posted by Adamoneoone
Посмотреть сообщение
Alright, thanks a lot I think that will do instead. When I'm going to use OnDialogResponse, the process is the same?
Each case corresponds to an item of the array?
Yes, the listitem will be the array index. Additionally you could do this, to avoid writing a single case for each item. Change this:

PHP код:
new vehList[][] = {
        {
"{FFFFFF}BMX"},
}; 
To this:

PHP код:
new vehList[][] = {
        
//model, price, name
        
{481500"{FFFFFF}BMX"},
        {
593125000"{FFFFFF}Dodo"},
        {
58725000"{FFFFFF}Euros"}
}; 
And then

PHP код:
public OnDialogResponse(...)
{
    ...
    case 
DIALOG_VEHICLES:
    {
        new 
modelid vehList[listitem][0];
        new 
price vehList[listitem][1];
        new 
modelName[32];
        
format(modelNamesizeof(modelName), vehList[listitem][2]);
        ... 
// deal with the rest
    
}
    ...

(Untested)
Reply
#28

Quote:
Originally Posted by Sasino97
Посмотреть сообщение
Yes, the listitem will be the array index. Additionally you could do this, to avoid writing a single case for each item. Change this:

PHP код:
new vehList[][] = {
        {
"{FFFFFF}BMX"},
}; 
To this:

PHP код:
new vehList[][] = {
        
//model, price, name
        
{481500"{FFFFFF}BMX"},
        {
593125000"{FFFFFF}Dodo"},
        {
58725000"{FFFFFF}Euros"}
}; 
And then

PHP код:
public OnDialogResponse(...)
{
    ...
    case 
DIALOG_VEHICLES:
    {
        new 
modelid vehList[listitem][0];
        new 
price vehList[listitem][1];
        new 
modelName[32];
        
format(modelNamesizeof(modelName), vehList[listitem][2]);
        ... 
// deal with the rest
    
}
    ...

(Untested)
Hey mate, I tried doing this:
PHP код:
case 8:
    {    
            new 
price vehList[listitem][1];
        new 
carname vehList[listitem][2];
        new 
modelName[32], title[90];
        
format(title,sizeof(title),"{FFFFFF}Game Shop{FF0080} Available Money: %f"GetPlayerMoney(playerid);
        
format(modelNamesizeof(modelName), "%s {FF0080}$%s"carnameprice);
        
ShowPlayerDialog(playeridDIALOG_SHOPVEHICLESDIALOG_STYLE_LISTtitlemodelName"Select""Close");
    } 
With your:
PHP код:
new vehList[][] = {
        
//model, price, name
        
{481500"{FFFFFF}BMX"},
        {
593125000"{FFFFFF}Dodo"},
        {
58725000"{FFFFFF}Euros"}
}; 
However, when I go ingame, nothing shows at all
Reply
#29

lil bump
Reply
#30

Bumpin’
Reply
#31

stuupid, your string cant be bigger then limit.
Reply
#32

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
stuupid, your string cant be bigger then limit.
If you are refferring to the 4096 character limit, then you’re simply either blind or dumb. We’ve been talking about it since page 2. I was just asking for help on the page system. Yet if you can’t read or answer properly, please don’t.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)