SA-MP Forums Archive
[Tutorial] [TUT]How to Create A INPUT 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] [TUT]How to Create A INPUT Dialog (/showthread.php?tid=158858)

Pages: 1 2


[TUT]How to Create A INPUT Dialog - IanDaCJ - 11.07.2010

Hey I'm IanDaCJ And In This I'll Be Showing You How To Make A Input dialog

Kk First Of all Find A Callback Where You Will Use this [For Example: OnCommandText]
And Type This(for Example):
pawn Код:
ShowPlayerDialog(playerid,67,DIALOG_STYLE_INPUT,"Teleports","Place\t\tID\nLs Airport\t1\nLv Airport\t2","Choose","Close");
ShowPlayerDialog Shows The Dialog

playerid To the Certian Player

67 Its Just ID For The Response (You Can Replace This With Any Number) It Doesnt Matter Which ID It Is It Only Matters Like If Ur Using a List / Input Or A MSGBOX Dialog You Have To Match The ID.

DIALOG_STYLE_INPUT The Style Of the Dialog Can Be Seen Here

"Teleports" Its Just The Title Of The Dialog Like The Word "Caption" In this PICTURE

Now the Text To Be Shown In the Box (mostly used for info) U Can Type Anything like.. "Lv Airport" Or Like "Ls Airport" Well anything that u want.. Now U Can See I Did [Name] And [ID] ITs Just For General Info.. The [Name] Is What Its About And The [ID] Is what Number You Have To Enter To go/ Get That Certian Place / Item.
[PS: \t Is For Long Lines , \n Is For A New Line]

"Choose" The Accept Button (Left)

"Close" The Decline Button (Right)

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ONDIALOGRESPONSE
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Kk Now Time For The Response:
Type This:
pawn Код:
if(dialogid == 67 && response == 1)
{
    if(inputtext[0] == '1') {
        SetPlayerPos(playerid, 2090.8916,-2545.3416,13.5469);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported LS Airport");
    }
    else if(inputtext[0] == '2') {
        SetPlayerPos(playerid, 1481.1478,1229.8453,10.8203);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported To LV Airport");
        }
        return 1;
    }
return 0;
}
if(dialogid == 67 && response == 1) It Responses The Dialog ID (as i described Earlier)

if(inputtext[0] == '1') { IF Someone types In 1 IT Does This / These Certian Command(s)
SendClientMessage(playerid... IT will Show A client Message (A Msg IN The ChatBox To You)
SetPlayerPos(playerid... IT will Set The Player To this Certian Position

else if(inputtext[0] == '2') { IF Someone Types In 2 IT Does This / These Certian Command(s)
SendClientMessage(playerid... IT will Show A client Message (A Msg IN The ChatBox To You)
SetPlayerPos(playerid... IT will Set The Player To this Certian Position

HOPE THIS HELPS!!!
GOT A QUESTION?
ASK AND ILL ANSWER!
!^.^!



Re: [TUT]How to Create A INPUT Dialog - hab2ever - 11.07.2010

Simple, but nice TUT


Re: [TUT]How to Create A INPUT Dialog - CAR - 11.07.2010

How to check if the input has got a space? so like if you put in:
"you've got some spaces!"


Re: [TUT]How to Create A INPUT Dialog - Hiddos - 11.07.2010

pawn Код:
if(strfind(bla," ",true) != -1)



Re: [TUT]How to Create A INPUT Dialog - tanush - 12.07.2010

how i create more dialogs in one pawno


Re: [TUT]How to Create A INPUT Dialog - Aleluja - 12.07.2010

Good TuT


Re: [TUT]How to Create A INPUT Dialog - ToPhrESH - 12.07.2010

Awesome tutorial. I will use and give u credits :P


Re: [TUT]How to Create A INPUT Dialog - Aleluja - 13.07.2010

Quote:
Originally Posted by tanush
Посмотреть сообщение
how i create more dialogs in one pawno
YOu can use other dialogs like :
Код:
ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"AFK","You are now AFK","Thanks","Thanks");
And you have
Код:
if (strcmp("/gps", cmdtext, true, 10) == 0)
	{
	
		ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "GPS System", "PD\nHospital \nBank \nCity Hall", "Chose", "Cancel"); //this dialog will show you when you wrote this command
		return 1;
	}
then on
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
Код:
if(dialogid == 1) //this is dialog id
{
if(response)
{
new message[200];
if(listitem == 0)
{
format(message, 200, "Location set on: PD!", 0); //this is text when player select destination
SetPlayerCheckpoint(playerid, 1537.0702,-1669.6351,13.3828,7.0); 
}
else if(listitem == 1)
{
    format(message, 200, Location set on: Hospital!", 1); //this is text when player select destination
    SetPlayerCheckpoint(playerid, 1186.9574,-1322.0541,13.5586,7.0);
    }
    else if(listitem == 2)
    {
        format(message, 200, "Location set on: Bank!", 1); //this is text when player select destination
        SetPlayerCheckpoint(playerid, 1460.1549,-1023.6053,23.8331,7.0);
		}
		else if(listitem == 2)
        {
        format(message, 200, "Location set on: City Hall!", 1); //this is text when player select destination
        SetPlayerCheckpoint(playerid, 1481.2764,-1742.8722,13.5469,7.0);
		}
}
}
When You put
Код:
DIALOG_STYLE_MSGBOX
you dont need to put
Код:
OnDIalogResponse
Because that is mesage
Код:
DIALOG_STYLE_LIST
You NEED to put
Код:
OnDialogResponse
because that is list and you chose what yyou want
Код:
DIALOG_STYLE_INPUT
You NEED to put
Код:
OnDialogResponse
because you wrote in this like little box

I hope that you understand this my TuT
BTW Sorry For My Bad English xD


Re: [TUT]How to Create A INPUT Dialog - tanush - 13.07.2010

Quote:
Originally Posted by Aleluja
Посмотреть сообщение
YOu can use other dialogs like :
Код:
ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"AFK","You are now AFK","Thanks","Thanks");
And you have
Код:
if (strcmp("/gps", cmdtext, true, 10) == 0)
	{
	
		ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "GPS System", "PD\nHospital \nBank \nCity Hall", "Chose", "Cancel"); //this dialog will show you when you wrote this command
		return 1;
	}
then on
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
Код:
if(dialogid == 1) //this is dialog id
{
if(response)
{
new message[200];
if(listitem == 0)
{
format(message, 200, "Location set on: PD!", 0); //this is text when player select destination
SetPlayerCheckpoint(playerid, 1537.0702,-1669.6351,13.3828,7.0); 
}
else if(listitem == 1)
{
    format(message, 200, Location set on: Hospital!", 1); //this is text when player select destination
    SetPlayerCheckpoint(playerid, 1186.9574,-1322.0541,13.5586,7.0);
    }
    else if(listitem == 2)
    {
        format(message, 200, "Location set on: Bank!", 1); //this is text when player select destination
        SetPlayerCheckpoint(playerid, 1460.1549,-1023.6053,23.8331,7.0);
		}
		else if(listitem == 2)
        {
        format(message, 200, "Location set on: City Hall!", 1); //this is text when player select destination
        SetPlayerCheckpoint(playerid, 1481.2764,-1742.8722,13.5469,7.0);
		}
}
}
When You put
Код:
DIALOG_STYLE_MSGBOX
you dont need to put
Код:
OnDIalogResponse
Because that is mesage
Код:
DIALOG_STYLE_LIST
You NEED to put
Код:
OnDialogResponse
because that is list and you chose what yyou want
Код:
DIALOG_STYLE_INPUT
You NEED to put
Код:
OnDialogResponse
because you wrote in this like little box

I hope that you understand this my TuT
BTW Sorry For My Bad English xD
sorry i dont understand, i want to put 2 dialogs


Re: [TUT]How to Create A INPUT Dialog - felipex - 13.07.2010

Do as the following example :

if(dialogid == 1)
{
if(response)
{
if(listitem == 0)
{
GivePlayerWeapon(playerid, 16, 9999);
}
}
}
if(dialogid == 2)
{
if(response)
{
if(listitem == 0)
{
GivePlayerWeapon(playerid, 16, 9999);
}
}
}
if(dialogid == 3)
{
if(response)
{
if(listitem == 0)
{
GivePlayerWeapon(playerid, 16, 9999);
}
}
}

and so goes....
Edit : if anybody knows how to put "pawno code" as above, tell me please ;P


Re: [TUT]How to Create A INPUT Dialog - felipex - 13.07.2010

Forgot to say : very nice tutorial ;PP, congratz


Re: [TUT]How to Create A INPUT Dialog - IanDaCJ - 13.07.2010

Quote:
Originally Posted by felipex
Посмотреть сообщение
Forgot to say : very nice tutorial ;PP, congratz
Thanks
Off Topic: [pawn ] And [/pawn ] (no Space )


Re: [TUT]How to Create A INPUT Dialog - tanush - 15.07.2010

Quote:
Originally Posted by felipex
Посмотреть сообщение
Do as the following example :

if(dialogid == 1)
{
if(response)
{
if(listitem == 0)
{
GivePlayerWeapon(playerid, 16, 9999);
}
}
}
if(dialogid == 2)
{
if(response)
{
if(listitem == 0)
{
GivePlayerWeapon(playerid, 16, 9999);
}
}
}
if(dialogid == 3)
{
if(response)
{
if(listitem == 0)
{
GivePlayerWeapon(playerid, 16, 9999);
}
}
}

and so goes....


Edit : if anybody knows how to put "pawno code" as above, tell me please ;P
thanks man <3


Re: [TUT]How to Create A INPUT Dialog - Brian_Furious - 20.07.2010

Simple but nice


Re: [TUT]How to Create A INPUT Dialog - Jochemd - 23.07.2010

Actually it is better to use strval(inputtext)..


Re: [TUT]How to Create A INPUT Dialog - [DK]JaloNik - 23.07.2010

niiiice!!


Re: [TUT]How to Create A INPUT Dialog - Creation - 02.09.2010

Good tutorial. Helped me.


Re: [TUT]How to Create A INPUT Dialog - Luis- - 02.09.2010

Simple yet you are able to learn from it!


Re: [TUT]How to Create A INPUT Dialog - Victos_xd - 05.08.2011

esse COD DO INPUT nao esta funcionando


Re: [TUT]How to Create A INPUT Dialog - Tom Kingston - 09.03.2013

Your tutorial is awesome bro, REP+ from me!