SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 22/08/2018, 05:32 PM   #511
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,807
Reputation: 831
Default Re: Dialogs include - Adding new styles to SAMP GUI

Quote:
Originally Posted by SapMan View Post
Brother, how do I do if I want to add objects for the users? Is that the objects I want to add have a varied identification, for example: objectsid: 1832, 1836, 1850, etc.
You must have per player array where you save object ids for each player.

So you can checkout the example: 2, for how to make a dialog from an enum-array.

Here is a simple example:
PHP Code:
enum E_ITEM_DATA {
    
ITEM_NAME[24],
    
ITEM_MODELID
};

new const 
ITEMS[][E_ITEM_DATA] = {
    {
"None"0},
    {
"Sniper"338},
    {
"AK-47"331},
    {
"First Aid Kit"11736}
    
// and so on...
};

new 
userInventory[MAX_PLAYERS][10]; // each player can have 10 items

// Now lets say you gave some items to users, each user's inventory array
// "userInventory" will hold different items now

// say this is a command to show inventory to users
CMD:inv(playerid) {
    new 
item_string[32]; // so each item is given a string size of "32"
    
new dialog_string[10 sizeof(item_string)]; // I multiplied with 10 because user can have max 10 items, which makes the total string size of "320"
    
    
for (new 010i++) {
        if (
userInventory[playerid][i] != 0) { // 0 = no item, we won't show null item
            
format(item_stringsizeof(item_string), "%i\t%s\n"ITEMS[i][ITEM_MODELID], ITEMS[i][ITEM_NAME]);
            
strcat(dialog_stringitem_string);
        }
    }
    
    if (
dialog_string[0] == EOS// if player have no items in inventory
        
return ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Inventory""You have no items in your bag!""Close""");
        
    return 
ShowPlayerDialog(playerid0DIALOG_STYLE_PREVIEW_MODEL"Inventory"dialog_string"Use""Close");

__________________

My GitHub:

Gammix is offline   Reply With Quote
Old 25/08/2018, 03:39 AM   #512
Zamora
Big Clucker
 
Zamora's Avatar
 
Join Date: Sep 2013
Posts: 180
Reputation: 25
Default Re: Dialogs include - Adding new styles to SAMP GUI

I've a problem with this, I'm using your sample code for the weapons.
When i type /weapons it show me the dialog but i can't choose any other weapon except the first one only, and when im clicking on the scroll button it hides the dialog.

Last edited by Zamora; 25/08/2018 at 03:11 PM.
Zamora is offline   Reply With Quote
Old 26/08/2018, 04:17 PM   #513
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,807
Reputation: 831
Default Re: Dialogs include - Adding new styles to SAMP GUI

Quote:
Originally Posted by Zamora View Post
I've a problem with this, I'm using your sample code for the weapons.
When i type /weapons it show me the dialog but i can't choose any other weapon except the first one only, and when im clicking on the scroll button it hides the dialog.
That means, some other library your are using, is using textdraw IDs for OnPlayerClickTextDraw incorrectly.
Try running the sample in a blank gamemode.
__________________

My GitHub:

Gammix is offline   Reply With Quote
Old 26/08/2018, 05:22 PM   #514
CantBeJohn
Big Clucker
 
CantBeJohn's Avatar
 
Join Date: Oct 2016
Posts: 87
Reputation: 15
Default Re: Dialogs include - Adding new styles to SAMP GUI

Removed.

Last edited by CantBeJohn; 28/09/2018 at 05:15 AM.
CantBeJohn is offline   Reply With Quote
Old 26/08/2018, 05:34 PM   #515
Zamora
Big Clucker
 
Zamora's Avatar
 
Join Date: Sep 2013
Posts: 180
Reputation: 25
Default Re: Dialogs include - Adding new styles to SAMP GUI

NVM, fixed it.
__________________

Discord: Click Here


you.tube.com/watch?v=fmBd0ZoH2AU - MDC System

Last edited by Zamora; 26/08/2018 at 09:14 PM.
Zamora is offline   Reply With Quote
Old 27/08/2018, 01:48 AM   #516
CantBeJohn
Big Clucker
 
CantBeJohn's Avatar
 
Join Date: Oct 2016
Posts: 87
Reputation: 15
Default Re: Dialogs include - Adding new styles to SAMP GUI

Quote:
Originally Posted by Alteh View Post
HELP ME:

Code:
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 Code:

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.
CantBeJohn is offline   Reply With Quote
Old 07/09/2018, 08:53 PM   #517
DTV
Gangsta
 
DTV's Avatar
 
Join Date: Dec 2010
Posts: 534
Reputation: 121
Default Re: Dialogs include - Adding new styles to SAMP GUI

Does this support y_dialogs? If not, will it ever support it?
__________________
Bringing the nuclear post apocalyptic setting to SA-MP, click the banners to view the forum or Discord server.



DTV is offline   Reply With Quote
Old 07/09/2018, 09:20 PM   #518
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,807
Reputation: 831
Default Re: Dialogs include - Adding new styles to SAMP GUI

Quote:
Originally Posted by DTV View Post
Does this support y_dialogs? If not, will it ever support it?
This question has been asked zillion times! And yes, it does, you just need to include this before y_dialogs or easy_dialog etc.
__________________

My GitHub:

Gammix is offline   Reply With Quote
Old 08/09/2018, 01:46 AM   #519
DTV
Gangsta
 
DTV's Avatar
 
Join Date: Dec 2010
Posts: 534
Reputation: 121
Default Re: Dialogs include - Adding new styles to SAMP GUI

Quote:
Originally Posted by Gammix View Post
This question has been asked zillion times! And yes, it does, you just need to include this before y_dialogs or easy_dialog etc.
Wish I had thought about that lol, thanks for the help my dude.
__________________
Bringing the nuclear post apocalyptic setting to SA-MP, click the banners to view the forum or Discord server.



DTV is offline   Reply With Quote
Old 28/09/2018, 05:20 AM   #520
CantBeJohn
Big Clucker
 
CantBeJohn's Avatar
 
Join Date: Oct 2016
Posts: 87
Reputation: 15
Question Re: Dialogs include - Adding new styles to SAMP GUI

Was this ever addressed? I never bothered getting involved with BigETI's PAWN memory access plugin, but it's his plugin after all; so what he mentioned before is a tad concerning.
CantBeJohn 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
[FilterScript] Items spawner dialogs (zcmd & dialogs include) Q_Lite Filterscripts 17 16/10/2016 11:09 AM
[FilterScript] [FS]Fighting Styles,5 most usable styles Like in SP By Don_(GH) HAYTXA Filterscripts 10 28/03/2013 06:39 AM
Making an OnFilterScriptInit in an include without adding anything in the .pwn exepct the #include r3k1lLz_ Help Archive 6 06/01/2011 06:49 AM
[FilterScript] [FS]Trans World Airlines v0.2 [TWA] - Bug Fixed - Adding Dialogs Soon. Toni Filterscripts 16 13/06/2010 02:57 PM
[FilterScript] [FS] Fighting Styles (0.3a) - |Save styles in Dini| MoBiL[e] Filterscripts 23 24/04/2010 11:12 AM


All times are GMT. The time now is 03:26 AM.


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