SA-MP Forums Archive
Textdraw to dialog - 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: Textdraw to dialog (/showthread.php?tid=663976)



Textdraw to dialog - Dimkata - 16.02.2019

Hello guys.

On my server I have RP tutorial on the beginning. Explaining all the rules via text draw. But I want to change it to dialog.
For Ex:

Код:
ShowPlayerDialog(playerid, 36251, DIALOG_STYLE_MSGBOX, "---------- - TUTORIAL", "Dobredojdovte na -------------", "Prodolzi", "");
But I dont know how to do it.

This is my script for the tutorial rightnow

Код:
forward Tutorial1(playerid);
public Tutorial1(playerid)
{
	ClearChatbox(playerid, 100);
	TextDrawHideForPlayer(playerid, PGTD1);
	TextDrawHideForPlayer(playerid, PGTD2);
	TextDrawHideForPlayer(playerid, PGTD3);
	TextDrawHideForPlayer(playerid, PGTD4);
	TextDrawShowForPlayer(playerid, MGTD1);
	TextDrawShowForPlayer(playerid, MGTD2);
	SetPlayerVirtualWorld(playerid, 0);
	SetPlayerInterior(playerid,0);
	InterpolateCameraPos(playerid, 1443.582641, -1599.151489, 234.356369, 1786.682373, -1401.814575, 234.356369, 20000);
	InterpolateCameraLookAt(playerid, 1444.551147, -1594.521850, 232.735076, 1782.797729, -1399.181030, 232.632019, 20000);
	SetTimerEx("Tutorial2", 20000, 0, "i", playerid);
}



Re: Textdraw to dialog - ItsRobinson - 16.02.2019

PHP код:
forward Tutorial1(playerid);
public 
Tutorial1(playerid)
{
    
ClearChatbox(playerid100);
    
SetPlayerVirtualWorld(playerid0);
    
SetPlayerInterior(playerid,0);
    
InterpolateCameraPos(playerid1443.582641, -1599.151489234.3563691786.682373, -1401.814575234.35636920000);
    
InterpolateCameraLookAt(playerid1444.551147, -1594.521850232.7350761782.797729, -1399.181030232.63201920000);
    
ShowPlayerDialog(playerid36251DIALOG_STYLE_MSGBOX"---------- - TUTORIAL""Dobredojdovte na -------------""Prodolzi""");

Then under OnDialogResponse

PHP код:
if(dialogid == 36251
{
/*then you would copy and paste everything from Tutorial2 function into here (obviously remove the textdraw stuff) and then another dialog if necessary, it should look like the function above, under here :D*/

Hope this helps.


Re: Textdraw to dialog - Dimkata - 16.02.2019

Quote:
Originally Posted by ItsRobinson
Посмотреть сообщение
[php]
PHP код:
if(dialogid == 36251
{
/*then you would copy and paste everything from Tutorial2 function into here (obviously remove the textdraw stuff) and then another dialog if necessary, it should look like the function above, under here :D*/

What should i put inhere? Im new to this thats why im asking.. are there any tutorials ? thank you

All I want is to make a dialog msgbox and when I press NEXT i get another one explaining other rules. U know what i mean


Re: Textdraw to dialog - Dimkata - 16.02.2019

This is the whole script

Should I change the textdraws with the dialog or what?

Код:
//--------------------------------------TUTORIJAL--------------------------------------------------------------
			if(TutTime[i] >= 1)
			{
			    TutTime[i] += 1;
       			if(TutTime[i] == 3)
			    {
				    ClearChatbox(i, 100);
				    InterpolateCameraPos(i, 708.382324, 312.173919, 75.567367, 429.388458, 702.377685, 75.567367, 39000);
				    InterpolateCameraLookAt(i, 703.829711, 311.769317, 73.539985, 430.007537, 697.849304, 73.539985, 39000);//BZONA MOST
					
                    TextDrawHideForPlayer(i, EXPTD21[i]);
                    TextDrawHideForPlayer(i, EXPTD20);
                    TextDrawHideForPlayer(i, DWExpLinija0);
			        TextDrawHideForPlayer(i, DWExpLinija1);
					TextDrawHideForPlayer(i, poruke);
					TextDrawHideForPlayer(i, DWExpBrojka0);
				    TextDrawShowForPlayer(i, DMTD1);
				    TextDrawShowForPlayer(i, DMTD2);
				    TextDrawShowForPlayer(i, DMTD3);
				    TextDrawShowForPlayer(i, DMTD4);

				}
				else if(TutTime[i] == 16)
			    {
				    ClearChatbox(i, 100);
				    InterpolateCameraPos(i, -1560.903076, 450.358062, 135.485458, -959.937927, 1179.366821, 135.485458, 39000);
				    InterpolateCameraLookAt(i, -1564.076293, 454.088104, 134.476806, -964.506469, 1177.435546, 134.854339, 39000);//SF MOST
				    TextDrawHideForPlayer(i, DMTD1);
				    TextDrawHideForPlayer(i, DMTD2);
				    TextDrawHideForPlayer(i, DMTD3);
				    TextDrawHideForPlayer(i, DMTD4);
				    //======
				    TextDrawHideForPlayer(i, DWExpBrojka0);
				    TextDrawShowForPlayer(i, PGTD1);
				    TextDrawShowForPlayer(i, PGTD2);
				    TextDrawShowForPlayer(i, PGTD3);
				    TextDrawShowForPlayer(i, PGTD4);

			    }
			    else if(TutTime[i] == 25)
			    {
				    ClearChatbox(i, 100);
				    InterpolateCameraPos(i, -2532.761718, 1187.813232, 169.755920, -2667.331542, 2331.351074, 169.755920, 39000);
				    InterpolateCameraLookAt(i, -2537.157714, 1189.922119, 168.647491, -2667.290527, 2326.385009, 169.175460, 39000);//SF MOST CRVEN
				    TextDrawHideForPlayer(i, PGTD1);
				    TextDrawHideForPlayer(i, PGTD2);
				    TextDrawHideForPlayer(i, PGTD3);
				    TextDrawHideForPlayer(i, PGTD4);
				    //======
				    TextDrawHideForPlayer(i, DWExpBrojka0);
				    TextDrawShowForPlayer(i, MGTD1);
				    TextDrawShowForPlayer(i, MGTD2);

	    		}
			    else if(TutTime[i] == 35)
			    {
				    ClearChatbox(i, 100);
				    InterpolateCameraPos(i, -2545.415771, 2545.600585, 51.495285, -2331.558593, 2244.818603, 25.535427, 39000);
				    InterpolateCameraLookAt(i, -2541.811767, 2542.236328, 50.662208, -2334.986572, 2248.454345, 25.362024, 39000);//SF SELO
				    TextDrawHideForPlayer(i, MGTD1);
				    TextDrawHideForPlayer(i, MGTD2);
			    //======
			    	TextDrawHideForPlayer(i, DWExpBrojka0);
				    TextDrawShowForPlayer(i, SKTD1);
				    TextDrawShowForPlayer(i, SKTD2);
				    TextDrawShowForPlayer(i, SKTD3);

			    }
			    else if(TutTime[i] == 45)
			    {
				    ClearChatbox(i, 100);
				    InterpolateCameraPos(i, -2949.191650, 1274.835571, 117.730987, -2881.024169, 630.610839, 117.730987, 39000);
				    InterpolateCameraLookAt(i, -2945.519531, 1272.079956, 115.750366, -2877.061279, 633.128112, 116.011116, 39000);//SF DO CRVEN MOST
					TextDrawHideForPlayer(i, SKTD1);
				    TextDrawHideForPlayer(i, SKTD2);
				    TextDrawHideForPlayer(i, SKTD3);
			    //======
			        TextDrawHideForPlayer(i, DWExpBrojka0);
				    TextDrawShowForPlayer(i, DBTD1);
				    TextDrawShowForPlayer(i, DBTD2);
				    TextDrawShowForPlayer(i, DBTD3);
				    TextDrawShowForPlayer(i, DBTD4);

			    }
			    else if(TutTime[i] == 53)
			    {
					ClearChatbox(i, 100);
			    	TextDrawHideForPlayer(i, DMTD1);
			  	    TextDrawHideForPlayer(i, DMTD2);
			  	    TextDrawHideForPlayer(i, DMTD3);
			   	    TextDrawHideForPlayer(i, DMTD4);

			   	    TextDrawHideForPlayer(i, PGTD1);
			        TextDrawHideForPlayer(i, PGTD2);
			        TextDrawHideForPlayer(i, PGTD3);
			        TextDrawHideForPlayer(i, PGTD4);

			        TextDrawHideForPlayer(i, MGTD1);
			        TextDrawHideForPlayer(i, MGTD2);

			        TextDrawHideForPlayer(i, SKTD1);
			        TextDrawHideForPlayer(i, SKTD2);
			        TextDrawHideForPlayer(i, SKTD3);

			        TextDrawHideForPlayer(i, DBTD1);
			        TextDrawHideForPlayer(i, DBTD2);
			        TextDrawHideForPlayer(i, DBTD3);
			        TextDrawHideForPlayer(i, DBTD4);
			        TextDrawHideForPlayer(i, DWExpBrojka0);

			    	//======
			    	new onostring[1000];
				    format(onostring, sizeof(onostring), "\n{FFFFFF}Se nadevame deka uspesno go prosledivte tutorialot",onostring);
			     	format(onostring, sizeof(onostring), "%s\n{FFFFFF}i go nasocivte veseto vnimanie kon Role-Play pravilata koi vi",onostring);
			    	format(onostring, sizeof(onostring), "%s\n{FFFFFF}bea prikazani vo nego..",onostring);
			    	format(onostring, sizeof(onostring), "%s\n\n{0049FF}>{FFFFFF}Vi posakuvame prijatna igra, mnogu druzenje",onostring);
			    	format(onostring, sizeof(onostring), "%s\n{FFFFFF}zabava i mnogu uspeh.",onostring);
			    	format(onostring, sizeof(onostring), "%s\n\n\n{0049FF}>{FFFFFF}Vo sledniot cekor treba da izberete mesto na ziveenje..",onostring);
			    	ShowPlayerDialog(i,PREDPITANJA,DIALOG_STYLE_MSGBOX,"{FF4040}Registracija",onostring,"Prodolzi","");
			    	//======
			        TutTime[i] = 0;
					PlayerInfo[i][pTut] = 1;
			    }
			}



Re: Textdraw to dialog - d3Pedro - 16.02.2019

You can use a timer for that and then use it every time you'd like to continue tutorial steps instead of using new callbacks for each tutorial step.
You can use strcat to change your tutorial from texdraws to dialog, but you gotta re-write it.

pawn Код:
forward TimeForTutorial(playerid, tutorialstep);
public TimeForTutorial(playerid, tutorialstep)
{
//--------------------------------------TUTORIJAL--------------------------------------------------------------
    if(TutTime[playerid] >= 1)
    {
        switch(tutorialstep)
        {
            case 3:
            {
                ClearChatbox(playerid, 100);
                InterpolateCameraPos(playerid, 708.382324, 312.173919, 75.567367, 429.388458, 702.377685, 75.567367, 39000);
                InterpolateCameraLookAt(playerid, 703.829711, 311.769317, 73.539985, 430.007537, 697.849304, 73.539985, 39000);//BZONA MOST

                TextDrawHideForPlayer(playerid, EXPTD21[playerid]);
                TextDrawHideForPlayer(playerid, EXPTD20);
                TextDrawHideForPlayer(playerid, DWExpLinija0);
                TextDrawHideForPlayer(playerid, DWExpLinija1);
                TextDrawHideForPlayer(playerid, poruke);
                TextDrawHideForPlayer(playerid, DWExpBrojka0);
                TextDrawShowForPlayer(playerid, DMTD1);
                TextDrawShowForPlayer(playerid, DMTD2);
                TextDrawShowForPlayer(playerid, DMTD3);
                TextDrawShowForPlayer(playerid, DMTD4);
                SetTimerEx("TimeForTutorial", SECONDS/MINUTES, false, "ii", playerid, 16);
            }
            case 16:
            {
                ClearChatbox(playerid, 100);
                InterpolateCameraPos(playerid, -1560.903076, 450.358062, 135.485458, -959.937927, 1179.366821, 135.485458, 39000);
                InterpolateCameraLookAt(playerid, -1564.076293, 454.088104, 134.476806, -964.506469, 1177.435546, 134.854339, 39000);//SF MOST
                TextDrawHideForPlayer(playerid, DMTD1);
                TextDrawHideForPlayer(playerid, DMTD2);
                TextDrawHideForPlayer(playerid, DMTD3);
                TextDrawHideForPlayer(playerid, DMTD4);
                //======
                TextDrawHideForPlayer(playerid, DWExpBrojka0);
                TextDrawShowForPlayer(playerid, PGTD1);
                TextDrawShowForPlayer(playerid, PGTD2);
                TextDrawShowForPlayer(playerid, PGTD3);
                TextDrawShowForPlayer(playerid, PGTD4);
                SetTimerEx("TimeForTutorial", SECONDS/MINUTES, false, "ii", playerid, 25);
            }
            case 25:
            {
                ClearChatbox(playerid, 100);
                InterpolateCameraPos(playerid, -2532.761718, 1187.813232, 169.755920, -2667.331542, 2331.351074, 169.755920, 39000);
                InterpolateCameraLookAt(playerid, -2537.157714, 1189.922119, 168.647491, -2667.290527, 2326.385009, 169.175460, 39000);//SF MOST CRVEN
                TextDrawHideForPlayer(playerid, PGTD1);
                TextDrawHideForPlayer(playerid, PGTD2);
                TextDrawHideForPlayer(playerid, PGTD3);
                TextDrawHideForPlayer(playerid, PGTD4);
                //======
                TextDrawHideForPlayer(playerid, DWExpBrojka0);
                TextDrawShowForPlayer(playerid, MGTD1);
                TextDrawShowForPlayer(playerid, MGTD2);
                SetTimerEx("TimeForTutorial", SECONDS/MINUTES, false, "ii", playerid, 35);
            }
            case 35:
            {
                ClearChatbox(playerid, 100);
                InterpolateCameraPos(playerid, -2545.415771, 2545.600585, 51.495285, -2331.558593, 2244.818603, 25.535427, 39000);
                InterpolateCameraLookAt(playerid, -2541.811767, 2542.236328, 50.662208, -2334.986572, 2248.454345, 25.362024, 39000);//SF SELO
                TextDrawHideForPlayer(playerid, MGTD1);
                TextDrawHideForPlayer(playerid, MGTD2);
            //======
                TextDrawHideForPlayer(playerid, DWExpBrojka0);
                TextDrawShowForPlayer(playerid, SKTD1);
                TextDrawShowForPlayer(playerid, SKTD2);
                TextDrawShowForPlayer(playerid, SKTD3);
                SetTimerEx("TimeForTutorial", SECONDS/MINUTES, false, "ii", playerid, 45);
            }
            case 45:
            {
                ClearChatbox(playerid, 100);
                InterpolateCameraPos(playerid, -2949.191650, 1274.835571, 117.730987, -2881.024169, 630.610839, 117.730987, 39000);
                InterpolateCameraLookAt(playerid, -2945.519531, 1272.079956, 115.750366, -2877.061279, 633.128112, 116.011116, 39000);//SF DO CRVEN MOST
                TextDrawHideForPlayer(playerid, SKTD1);
                TextDrawHideForPlayer(playerid, SKTD2);
                TextDrawHideForPlayer(playerid, SKTD3);
            //======
                TextDrawHideForPlayer(playerid, DWExpBrojka0);
                TextDrawShowForPlayer(playerid, DBTD1);
                TextDrawShowForPlayer(playerid, DBTD2);
                TextDrawShowForPlayer(playerid, DBTD3);
                TextDrawShowForPlayer(playerid, DBTD4);
                SetTimerEx("TimeForTutorial", SECONDS/MINUTES, false, "ii", playerid, 53);
            }
            case 53:
            {
                ClearChatbox(playerid, 100);
                TextDrawHideForPlayer(playerid, DMTD1);
                TextDrawHideForPlayer(playerid, DMTD2);
                TextDrawHideForPlayer(playerid, DMTD3);
                TextDrawHideForPlayer(playerid, DMTD4);

                TextDrawHideForPlayer(playerid, PGTD1);
                TextDrawHideForPlayer(playerid, PGTD2);
                TextDrawHideForPlayer(playerid, PGTD3);
                TextDrawHideForPlayer(playerid, PGTD4);

                TextDrawHideForPlayer(playerid, MGTD1);
                TextDrawHideForPlayer(playerid, MGTD2);

                TextDrawHideForPlayer(playerid, SKTD1);
                TextDrawHideForPlayer(playerid, SKTD2);
                TextDrawHideForPlayer(playerid, SKTD3);

                TextDrawHideForPlayer(playerid, DBTD1);
                TextDrawHideForPlayer(playerid, DBTD2);
                TextDrawHideForPlayer(playerid, DBTD3);
                TextDrawHideForPlayer(playerid, DBTD4);
                TextDrawHideForPlayer(playerid, DWExpBrojka0);

                //======
                new onostring[1000];
                format(onostring, sizeof(onostring), "\n{FFFFFF}Se nadevame deka uspesno go prosledivte tutorialot",onostring);
                format(onostring, sizeof(onostring), "%s\n{FFFFFF}i go nasocivte veseto vnimanie kon Role-Play pravilata koi vi",onostring);
                format(onostring, sizeof(onostring), "%s\n{FFFFFF}bea prikazani vo nego..",onostring);
                format(onostring, sizeof(onostring), "%s\n\n{0049FF}>{FFFFFF}Vi posakuvame prijatna igra, mnogu druzenje",onostring);
                format(onostring, sizeof(onostring), "%s\n{FFFFFF}zabava i mnogu uspeh.",onostring);
                format(onostring, sizeof(onostring), "%s\n\n\n{0049FF}>{FFFFFF}Vo sledniot cekor treba da izberete mesto na ziveenje..",onostring);
                ShowPlayerDialog(playerid,PREDPITANJA,DIALOG_STYLE_MSGBOX,"{FF4040}Registracija",onostring,"Prodolzi","");
                //======
                TutTime[playerid] = 0;
                PlayerInfo[playerid][pTut] = 1;
            }
        }
    }
}
And to start it use:
pawn Код:
TutTime[playerid] = 1;
PlayerInfo[playerid][pTut] = 0;
SetTimerEx("TimeForTutorial", SECONDS/MINUTES, false, "ii", playerid, 3);