[Include] Dialogs include - Adding new styles to SAMP GUI

Update v4.6:
- Pointer management, single array holding pointer to pointers! (less pre-allocated memory)
- Fixed listitem text mixing bug.
- Fix for ShowPlayerDialog "info" expressions.
Reply

Hi, it is good to see that someone uses my plugin. However I saw in your source code that you have pre-defined limits for how many dialogs can exist. My suggestion would be to entirely remove the dialog count limit by re-allocating memory if needed. Also you can add support for sampctl:
https://sampforum.blast.hk/showthread.php?tid=651159
https://github.com/Southclaws/sampctl
https://github.com/sampctl/
Reply

Quote:
Originally Posted by BigETI
Посмотреть сообщение
Hi, it is good to see that someone uses my plugin. However I saw in your source code that you have pre-defined limits for how many dialogs can exist. My suggestion would be to entirely remove the dialog count limit by re-allocating memory if needed. Also you can add support for sampctl:
https://sampforum.blast.hk/showthread.php?tid=651159
https://github.com/Southclaws/sampctl
https://github.com/sampctl/
I actually need that limit to allocate memory whenever a player joins because there is rotation function which changes the rotation of a listitem before showing the dialog (showing is when i would allocate memory with your way).

And sampctl, i have no idea how to add support. If someone can link me a tutorial or do it for me that would be great!
Reply

Quote:
Originally Posted by Gammix
Посмотреть сообщение
I didn't change any syntax or compatibility. The only thing in the latest update is using memory.inc plugin. Is that why its not working?
I don't know. I'll do some testing and tell you what's up.
Reply

I have problem with player dialog.
PHP код:
if (dialogstr[0] == EOS) { 
    for (new 
isizeof(PlayerSkins); i++) 
    {
        if(
PlayerSkins[i][playerid] == 0) break;
                        
format(captionsizeof caption"%i\tID: %i\n"PlayerSkins[i][playerid], PlayerSkins[i][playerid]); 
                        
strcat(dialogstrcaption);
    } 
}                
ShowPlayerDialog(playeridDIALOG_ASHOP1DIALOG_STYLE_PREVIEW_MODEL"Special skins"dialogstr"Select""Cancel"); 
When player change skin rotation with scrolls for other player skins got change.
How to fix it?
Reply

Quote:
Originally Posted by MRM
Посмотреть сообщение
I have problem with player dialog.
PHP код:
if (dialogstr[0] == EOS) { 
    for (new 
isizeof(PlayerSkins); i++) 
    {
        if(
PlayerSkins[i][playerid] == 0) break;
                        
format(captionsizeof caption"%i\tID: %i\n"PlayerSkins[i][playerid], PlayerSkins[i][playerid]); 
                        
strcat(dialogstrcaption);
    } 
}                
ShowPlayerDialog(playeridDIALOG_ASHOP1DIALOG_STYLE_PREVIEW_MODEL"Special skins"dialogstr"Select""Cancel"); 
When player change skin rotation with scrolls for other player skins got change.
How to fix it?
Use this function in your loop:
PHP код:
SetDialogPreviewRotation(playeridlistitemFloat:rxFloat:ryFloat:rzFloat:zoom); 
Example:
PHP код:
for (new isizeof(PlayerSkins); i++) 
{
    if(
PlayerSkins[i][playerid] == 0) break;
    
format(captionsizeof caption"%i\tID: %i\n"PlayerSkins[i][playerid], PlayerSkins[i][playerid]); 
    
strcat(dialogstrcaption);
                        
    
SetDialogPreviewRotation(playeridi0.00.0, -0.451.0);

Reply

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Use this function in your loop:
PHP код:
SetDialogPreviewRotation(playeridlistitemFloat:rxFloat:ryFloat:rzFloat:zoom); 
Example:
PHP код:
for (new isizeof(PlayerSkins); i++) 
{
    if(
PlayerSkins[i][playerid] == 0) break;
    
format(captionsizeof caption"%i\tID: %i\n"PlayerSkins[i][playerid], PlayerSkins[i][playerid]); 
    
strcat(dialogstrcaption);
                        
    
SetDialogPreviewRotation(playeridi0.00.0, -0.451.0);

Not working ...
Reply

You need Pawn-Memory plugin, download it from the link in thread. Also put "memory" in your plugins line in server.cfg.
Reply

Update v4.7:
Optional update, but recommended!
  • New memory allocation technique, now there are no limitations, you can have as many listitems as you want! The memory for listitems is allocated dynamically while include is fetching data for listitems from ShowPlayerDialog.
  • There is new syntax, the old syntax for ShowPlayerDialog is kept, but there is addon for having custom rotation for listitems while you're making dialog's info! Checkout examples for more info; also there is a paragraph about this in "Functionality" section!
  • Only function this include provides is "ShowPlayerDialog", there is no ShowPreviewModelDialog or SetDialogPreviewRotation for rotation settings, these functions are simply removed!
I'd say this version is more optimized in terms of memory management, everything is dynamically allocated, nothing is pre-allocated and allocation size is not static!
Reply

I never thought this will be one of the most awesome include I've found. I respect that you still developing this after 3 years while most of the authors don't do that.
Reply

Quote:
Originally Posted by Gammix
Посмотреть сообщение
You need Pawn-Memory plugin, download it from the link in thread. Also put "memory" in your plugins line in server.cfg.
I have Pawn-Memory plugin.
In the new version the problem has been fixed?
Reply

Quote:
Originally Posted by MRM
Посмотреть сообщение
I have Pawn-Memory plugin.
In the new version the problem has been fixed?
That has never been a problem related to the include. You are most likely not installing Pawn-Memory plugin correctly.

@Verc: thanks
Reply

There is a way to copy memory using MEM_copy, instead of writing each value using a for loop. There is also no MEM_delete to free memory before this bit.

For an example you can take a look, how it's done at pawn-vector
Heck you can actually use this library to use "dynamicly re-sizable arrays".
Reply

Quote:
Originally Posted by Alteh
Посмотреть сообщение
HELP ME:

Код:
new SKIN_MODELS[] = 
{
6, 8, 10, 20, 40, 50, 120, 211, 232, 235
};


CMD:test(playerid)
{
    ShowPlayerDialog(playerid, DIALOG_SELECT, DIALOG_STYLE_LIST, " ", "Option 0\nOption 1\nOption 2 [skins] \nOption 3","Go","Cancel");
return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch (dialogid)
{
case DIALOG_SELECT:
{
if(response)
{
if(listitem == 2)
{
ShowPlayerDialog(playerid, DIALOG_SKIN, DIALOG_STYLE_PREVIEW_MODEL, " ", SKIN_MODELS, "Take", "Cancel");
}
}
}
case DIALOG_SKIN:
{
if(response){
SetPlayerSkin(playerid, SKIN_MODELS[listitem]);
DDS[playerid][cSkin] = SKIN_MODELS[listitem];
}
}
}
return 1;
}
Here you go:

PHP код:

new SKIN_MODELS[] = 
{
    
6810204050120211232235
};
CMD:test(playerid)
{
    
ShowPlayerDialog(playeridDIALOG_SELECTDIALOG_STYLE_LIST" ""Option 0\nOption 1\nOption 2 [skins] \nOption 3","Go","Cancel");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch (
dialogid)
    {
        case 
DIALOG_SELECT:
        {
            if(
response)
            {
                if(
listitem == 2)
                {
                    new 
string[sizeof(SKIN_MODELS)*5];
                    for(new 
0sizeof(SKIN_MODELS); i++)
                    {
                        
format(stringsizeof string"%s%i\n"stringSKIN_MODELS[i], SKIN_MODELS[i]); 
                    }
                    
ShowPlayerDialog(playeridDIALOG_SKINDIALOG_STYLE_PREVIEW_MODEL" "string"Take""Cancel");
                }
            }
        }
        case 
DIALOG_SKIN:
        {
            if(
response)
            {
                
SetPlayerSkin(playeridSKIN_MODELS[listitem]);
                
DDS[playerid][cSkin] = SKIN_MODELS[listitem];
            }
        }
    }
    return 
1;

You have to loop through the array "SKIN_MODELS", which I did for you.
Reply

You need the memory access plugin include file to compile the code and the memory access plugin to run that code.
Reply

Nice job, it's great
Reply

help pls
Reply

Hey all can you please give me ch#### codes for the game thanks
Reply

How do I make the skin selection so that you can only pick between a few skins? ( id 20001 to 20008 )
Reply

Quote:
Originally Posted by Stefhan
Посмотреть сообщение
How do I make the skin selection so that you can only pick between a few skins? ( id 20001 to 20008 )
pawn Код:
#define SKIN_DIALOG 420

ShowPlayerDialog(playerid, SKIN_DIALOG, DIALOG_STYLE_PREVIEW_MODEL, "Skin selection", "20001\n20002\n20008", "Select", "Close");
There is also examples in main post about the syntax, read them.
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)