[Tutorial] [TUT]How to Create A INPUT Dialog
#1

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!
!^.^!
Reply
#2

Simple, but nice TUT
Reply
#3

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

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

how i create more dialogs in one pawno
Reply
#6

Good TuT
Reply
#7

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

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
Reply
#9

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
Reply
#10

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
Reply
#11

Forgot to say : very nice tutorial ;PP, congratz
Reply
#12

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

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
Reply
#14

Simple but nice
Reply
#15

Actually it is better to use strval(inputtext)..
Reply
#16

niiiice!!
Reply
#17

Good tutorial. Helped me.
Reply
#18

Simple yet you are able to learn from it!
Reply
#19

esse COD DO INPUT nao esta funcionando
Reply
#20

Your tutorial is awesome bro, REP+ from me!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)