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

Quote:
Originally Posted by FinStar
Посмотреть сообщение
Hi, i have problem with rotation object in DIALOG_STYLE_PREVMODEL

http://prntscr.com/ew067n

Код:
stock SearchName(id, item, slot)
{
	new sNazev[50];

	if(item == 157){ sNazev = "Kolo - Offroad"; }
	if(item == 158){ sNazev = "Kolo - Shadow"; }
	if(item == 159){ sNazev = "Kolo - Mega"; }
	if(item == 160){ sNazev = "Kolo - Rimshine"; }
	if(item == 161){ sNazev = "Kolo - Wires"; }
	if(item == 162){ sNazev = "Kolo - Classic"; }
	if(item == 163){ sNazev = "Kolo - Twist"; }
	if(item == 164){ sNazev = "Kolo - Cutter"; }
	if(item == 165){ sNazev = "Kolo - Switch"; }
	if(item == 166){ sNazev = "Kolo - Grove"; }
	if(item == 167){ sNazev = "Kolo - Import"; }
	if(item == 168){ sNazev = "Kolo - Dollar"; }
	if(item == 169){ sNazev = "Kolo - Trance"; }
	if(item == 170){ sNazev = "Kolo - Atomic"; }
	if(item == 171){ sNazev = "Kolo - Ahab"; }
	if(item == 172){ sNazev = "Kolo - Virtual"; }
	if(item == 173){ sNazev = "Kolo - Access"; }
        if(slot == 1){ strmid(Vozidlo[id][tuning_1_nazev], sNazev, 0, 50, 50); }
	return 1;
}
new const gAttachments[][e_ATTACHMENTS] =
{
	{1025, "Kolo~n~Offroad"},
	{1073, "Kolo~n~Shadow"},
	{1074, "Kolo~n~Mega"},
	{1075, "Kolo~n~Rimshine"},
	{1076, "Kolo~n~Wires"},
	{1077, "Kolo~n~Classic"},
	{1078, "Kolo~n~Twist"},
	{1079, "Kolo~n~Cutter"},
	{1080, "Kolo~n~Switch"},
	{1081, "Kolo~n~Grove"},
	{1082, "Kolo~n~Import"},
	{1083, "Kolo~n~Dollar"},
	{1084, "Kolo~n~Trance"},
	{1085, "Kolo~n~Atomic"},
	{1096, "Kolo~n~Ahab"},
	{1097, "Kolo~n~Virtual"},
	{1098, "Kolo~n~Access"}
};

                                switch(listitem)
				{
				    case 0:
				    {
				        TuningEditSlot[playerid] = 1;
						new k = GetPVarInt(playerid, "VehicleITuning");
				        if(Vozidlo[k][tuning_1_objectid] == 0)
						{
					        const
					    		size = sizeof(gAttachments)
							;
							new
							    models[size],
							    labels[size][25]
							;
							for (new x; x < size; x++)
							{
							    models[x] = gAttachments[x][attachModel];
							    strcat(labels[x], gAttachments[x][attachName]);
							}
							ShowPlayerPreviewModelDialog(playerid, DIALOG_TUNING_SEARCH, DIALOG_STYLE_PREVMODEL, "Vyber modelu:", models, labels, "Zvolit", "Zavrit");
							Dialog_SetModelRot(playerid, 157, .z = 35.0, .zoom = 1.3); // Wheel Offroad
							Dialog_SetModelRot(playerid, 158, .z = 35.0, .zoom = 1.3); 
							Dialog_SetModelRot(playerid, 159,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 160,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 161,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 162,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 163,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 164,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 165,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 166,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 167,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 168,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 169,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 170,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 171,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 172,  .z = 35.0, .zoom = 1.3);
							Dialog_SetModelRot(playerid, 173,  .z = 35.0, .zoom = 1.3);
						}
						else
						{
							ShowPlayerDialog(playerid, DIALOG_TUNING_EDIT, DIALOG_STYLE_LIST, "Tuning", "Upravit doplněk\nSmazat doplněk\nZměnit barvu doplňku", "Vybrat", "Zavřнt");
						}
				    }
				}
Wheel Offroad is correctly, but other tires have bad rotation position, why ? :/
Your array is hardly of size 10 or 20 max but you are modifying index 158 and above?
"Dialog_SetModelRot" has index check in it so check if the function returns 0, if so then its because of the index check if no, then i have to look further.
Reply

@Gammix, This is only a sample, otherwise I have in the const 240 accessories. I have over 200 arrays.
Reply

Quote:
Originally Posted by FinStar
Посмотреть сообщение
@Gammix, This is only a sample, otherwise I have in the const 240 accessories. I have over 200 arrays.
Ok, i guessed it. But as i sad before, check if the function returns 0 or 1.
Reply

Quote:
Originally Posted by Gammix
Посмотреть сообщение
I guess, if you include it before y_inline it should work.
Just an update on this, it works perfectly with y_inline and y_dialogs:

pawn Код:
#include <dialogs>
#include <YSI\y_inline>
#include <YSI\y_dialog>

CMD:test ( playerid, params [] ) {
   inline TestResponse(pid, dialogid, response, listitem, string:inputtext[]) {

      #pragma unused pid, dialogid, response, listitem, inputtext
      SendClientMessage(playerid, 0xFF0000AA, "You clicked a button!  Good for you!");

   }
   Dialog_ShowCallback(playerid, using inline TestResponse, DIALOG_STYLE_PREVMODEL_LIST,  "Weapon selection dialog", "372\tTec-9\n352\tUZI\n346\t9mm\n347\tSilenced 9mm\n348\tDesert eagle", "Select", "Cancel");
 
   return true ;
}
Reply

this include can support easydialog include?
Reply

Hey, when i try to compile my Gamemode while using your include , pawno gets freezed ,and i can't use it, what can i do? Ty

EDIT: By just having "#Include <dialogs>" it crashes pawno in my gm, but when im using a different gamemode, it works, and it compiles, why? what can i do?
Reply

Quote:
Originally Posted by Juand
Посмотреть сообщение
Hey, when i try to compile my Gamemode while using your include , pawno gets freezed ,and i can't use it, what can i do? Ty

EDIT: By just having "#Include <dialogs>" it crashes pawno in my gm, but when im using a different gamemode, it works, and it compiles, why? what can i do?
Because some of your code or other libraries you are using, their code conflicts with this one.
You can try changing placement of libraries, like placing <dialogs> before <foreach> for example.
Reply

As some already said this doesn't work well with easydialogs, nevertheless I think it's a really cool include you have made. I'll just share my code and a few images so maybe when you have time to look at it, but again you don't have to it's just in my case this didn't work out, it doesn't mean that others will have the same experience.

Код:
CMD:editdealership(playerid, params[])
{
	Dialog_Show(playerid, EditDealershipCars, DIALOG_STYLE_PREVMODEL, "{7777FF}Edit Dealership Vehicles", "18631\tAdd more...", "Edit", "Cancel");
	return 1;
}

Dialog:EditDealershipCars(playerid, response, listitem, inputtext[])
{
	if (response)
	{
		SendInfoMessage(playerid, "Pressed: %i", listitem);
		SendInfoMessage(playerid, "Pressed: %s", inputtext);
	}
	return 1;
}
The first issue was that when using it for the first time, this popped up:
http://i.imgur.com/G9SJ4a8.png


I doubleclicked on index 1 (the second item) and the index printed correctly, however not the text (normally it would have printed out the objectid in this case since it is the first thing before "\t", like in normal dialogs.
http://i.imgur.com/5lQ4HSH.png


Then I used the command again and CJ was gone but instead two of the same thing popped up.
http://i.imgur.com/MJPMgIu.png


I tried to doubleclick on the first item this time and same result, it gave the correct index but sent a non-fitting character into the chat:
http://i.imgur.com/wgAaH5i.png


Again this is probably because the way easydialogs works, and yes obviously easydialogs was included after your include. Anyhow good include, just didn't work out in my case, good release.


Edit:
Images were too big so had to remove the img-tags, holy crap so big lmao.
Reply

Is there any way to increase the size of model Box ?
Reply

Quote:
Originally Posted by Shaheen
View Post
Is there any way to increase the size of model Box ?
Yes but you have to modify the function "Dialog_CreatePlayerDialog", basically modify the coords of textdraws.
An algorithm for this can be build but i dont have the time for it.
Reply

Any reason why this happens? I am using the exact same code prefix as shown in your example. My other dialog using a similar prefix is bugged too.

The shown object model isn't the one I'm using - it's fucked up for some reason.

http://i.imgur.com/wmG8yJi.png

This is what it should look like: http://i.imgur.com/0HFhxZT.png

Code:
	inline ToyStoreList(pid, dialogid, response, listitem, string:inputtext[]) {
	// handlers here
	}

	new sQuery [ 2048 ] ;

	for ( new i; i < sizeof ( Attachments ); i ++ ) {

		format ( sQuery, sizeof ( sQuery ), "%s%i\t%s\n", sQuery, Attachments [ i ] [ attach_model ], Attachments [ i ] [ attach_name ]) ;
	}

   	Dialog_ShowCallback(playerid, using inline ToyStoreList, DIALOG_STYLE_PREVIEW_MODEL,  "Attachments Store", sQuery, "Select", "Cancel");
Reply

Quote:
Originally Posted by Dignity
View Post
Any reason why this happens? I am using the exact same code prefix as shown in your example. My other dialog using a similar prefix is bugged too.

The shown object model isn't the one I'm using - it's fucked up for some reason.

http://i.imgur.com/wmG8yJi.png

This is what it should look like: http://i.imgur.com/0HFhxZT.png

Code:
	inline ToyStoreList(pid, dialogid, response, listitem, string:inputtext[]) {
	// handlers here
	}

	new sQuery [ 2048 ] ;

	for ( new i; i < sizeof ( Attachments ); i ++ ) {

		format ( sQuery, sizeof ( sQuery ), "%s%i\t%s\n", sQuery, Attachments [ i ] [ attach_model ], Attachments [ i ] [ attach_name ]) ;
	}

   	Dialog_ShowCallback(playerid, using inline ToyStoreList, DIALOG_STYLE_PREVIEW_MODEL,  "Attachments Store", sQuery, "Select", "Cancel");
Try to print the results and see if they're OK, you could be loading wrong.
Reply

Quote:
Originally Posted by iLearner
View Post
Try to print the results and see if they're OK, you could be loading wrong.
It works fine without the string specifier. It only fucks up when I use it.

The %i or %d specifier (after the modelid) is fine too, but that's not what I need.
Reply

Quote:
Originally Posted by Dignity
View Post
It works fine without the string specifier. It only fucks up when I use it.

The %i or %d specifier (after the modelid) is fine too, but that's not what I need.
This could be the reason probably. I'll fix it when i am free.

Quote:
Originally Posted by lDarkeen
View Post
I've a problem here.

When I use DIALOG_STYLE_PREVMODEL_LIST, textdraw's model id doesn't show correctly.
For instance, if i use Cigarettes's id (19897), the dialog truncates the last letter and shows an object with id: 1989

Same Objects in both dialog:




DIALOG_STYLE_PREVMODEL_LIST
Code:
COMMAND:testanim(playerid, params[])
{
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PREVMODEL_LIST, "Selection", "2039\tItem1\n19565\tItem2\n19897\tItem3\n19998\tItem4", "OK", " ");
	return 1;
}

DIALOG_STYLE_PREVMODEL
Code:
COMMAND:testanim2(playerid, params[])
{
        new models[] = {2039, 19565, 19897, 19998};
	new labels[][] = {"Item1", "Item2", "Item3", "Item4"};

	ShowPlayerPreviewModelDialog(playerid, 0, DIALOG_STYLE_PREVMODEL, "Selection", models, labels, "Select", "Cancel");
	return 1;
}
Thanks in advanced.



EDIT:

FIX:
IN: stock Dialog_ShowToPlayer(playerid, dialogid, style, caption[], info[], button1[], button2[])
Search: for static str_model[5];
Replace with: static str_model[6];
Reply

Update v3.0.2:
- Modelids are now read fully, the string size was small for full 5 character modelids.
Reply

Code:
Dialog_ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[], BG_COLOR = 0, DIALOG_LIST_ITEM_COLOR = 5864548, DIALOG_SELECTED_LIST_ITEM_COLOR = -1608903836)
The idea would be to customize the menu colors.

Another thing that would be useful, a callback that points to the player that item selected in real time. It would be used to point out additional item information (would be optional, for inventory systems).
Reply

I have a mode where I use nex-ac include and your include but when I use a command to display skins, the dialog will not appear

Only the cursor is displayed
Reply

Quote:
Originally Posted by Unrea1
View Post
Code:
Dialog_ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[], BG_COLOR = 0, DIALOG_LIST_ITEM_COLOR = 5864548, DIALOG_SELECTED_LIST_ITEM_COLOR = -1608903836)
The idea would be to customize the menu colors.

Another thing that would be useful, a callback that points to the player that item selected in real time. It would be used to point out additional item information (would be optional, for inventory systems).
Well i won't add this because that was not the real intention of this include. Its about adding new dialog style, dialog which look similar to SAMP dialogs. So if i add color customization, it will not be the same then. Feel free to edit the include as you like.

Quote:
Originally Posted by FinStar
View Post
I have a mode where I use nex-ac include and your include but when I use a command to display skins, the dialog will not appear

Only the cursor is displayed
Show the code you use to display the dialog.
Reply

Code:
new string[sizeof SkinItems* 50]; 
for (new i; i < sizeof SkinItems; i++) 
{ 
	format(string, sizeof string, "%s\t%s\n", string, SkinItems[i][attachName]); 
}
						
ShowPlayerDialog(playerid, DIALOG_SKINS, DIALOG_STYLE_PREVMODEL, "Select Skins", string, "Select", "Close");
Code:
enum MaleSkins
{
    attachModel,
    attachName[25]
};

new const SkinItems[][MaleSkins] =
{
    {9, "Skin"},
    {10, "Skin"},
    {12, "Skin"},
   // atp ......
    }
;
EDIT:

I use compilation file that contains textdraws, OnPlayerClickPlayerTextdraw and OnPlayerClickTextdraw, without my script displaying your dialog.
Reply

I use textdraw-list.pwn for compilation, textdraws is not located directly in main mode but special.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)