SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 11/07/2010, 09:56 AM   #1
IanDaCJ
Big Clucker
 
IanDaCJ's Avatar
 
Join Date: Apr 2010
Location: Malta, Got A Problem Punk? Jk
Posts: 124
Reputation: 7
Cool [TUT]How to Create A INPUT Dialog

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 Code:
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 Code:
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!
!^.^!
__________________
----------------------------------------------------
Gamemode:
Germany Vs USA (Desert TDM)

FilterScripts:
NCC The Name Colour Changer
GSkin v1 (All Gangster Skins List Dialog)
GSkin v2 (All Skin Input Dialog)
Drugz The Drug System

Tutorials:
How To Create A INPUT Dialog Newest!
----------------------------------------------------
IanDaCJ is offline   Reply With Quote
Old 11/07/2010, 09:59 AM   #2
hab2ever
Huge Clucker
 
hab2ever's Avatar
 
Join Date: Feb 2010
Posts: 278
Reputation: 5
Default Re: [TUT]How to Create A INPUT Dialog

Simple, but nice TUT
hab2ever is offline   Reply With Quote
Old 11/07/2010, 10:33 AM   #3
CAR
Huge Clucker
 
Join Date: Feb 2009
Posts: 476
Reputation: 4
Default Re: [TUT]How to Create A INPUT Dialog

How to check if the input has got a space? so like if you put in:
"you've got some spaces!"
__________________
<over limits>
CAR is offline   Reply With Quote
Old 11/07/2010, 10:34 AM   #4
Hiddos
High-roller
 
Hiddos's Avatar
 
Join Date: Sep 2008
Posts: 3,304
Reputation: 2184
Default Re: [TUT]How to Create A INPUT Dialog

pawn Code:
if(strfind(bla," ",true) != -1)
__________________
Quote:
Originally Posted by DeWolf View Post
For fuck's sake people, this whole thread is fucked up now.
Hiddos is offline   Reply With Quote
Old 12/07/2010, 08:57 PM   #5
tanush
Huge Clucker
 
Join Date: Feb 2010
Posts: 490
Reputation: 2
Default Re: [TUT]How to Create A INPUT Dialog

how i create more dialogs in one pawno
tanush is offline   Reply With Quote
Old 12/07/2010, 09:18 PM   #6
Aleluja
Big Clucker
 
Join Date: Jul 2010
Location: Croatia
Posts: 98
Reputation: 0
Default Re: [TUT]How to Create A INPUT Dialog

Good TuT
Aleluja is offline   Reply With Quote
Old 12/07/2010, 09:44 PM   #7
ToPhrESH
Gangsta
 
ToPhrESH's Avatar
 
Join Date: Jun 2010
Posts: 517
Reputation: 3
Default Re: [TUT]How to Create A INPUT Dialog

Awesome tutorial. I will use and give u credits :P
ToPhrESH is offline   Reply With Quote
Old 13/07/2010, 11:45 AM   #8
Aleluja
Big Clucker
 
Join Date: Jul 2010
Location: Croatia
Posts: 98
Reputation: 0
Default Re: [TUT]How to Create A INPUT Dialog

Quote:
Originally Posted by tanush View Post
how i create more dialogs in one pawno
YOu can use other dialogs like :
Code:
ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"AFK","You are now AFK","Thanks","Thanks");
And you have
Code:
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
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
Code:
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
Code:
DIALOG_STYLE_MSGBOX
you dont need to put
Code:
OnDIalogResponse
Because that is mesage
Code:
DIALOG_STYLE_LIST
You NEED to put
Code:
OnDialogResponse
because that is list and you chose what yyou want
Code:
DIALOG_STYLE_INPUT
You NEED to put
Code:
OnDialogResponse
because you wrote in this like little box

I hope that you understand this my TuT
BTW Sorry For My Bad English xD
Aleluja is offline   Reply With Quote
Old 13/07/2010, 04:34 PM   #9
tanush
Huge Clucker
 
Join Date: Feb 2010
Posts: 490
Reputation: 2
Default Re: [TUT]How to Create A INPUT Dialog

Quote:
Originally Posted by Aleluja View Post
YOu can use other dialogs like :
Code:
ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"AFK","You are now AFK","Thanks","Thanks");
And you have
Code:
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
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
Code:
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
Code:
DIALOG_STYLE_MSGBOX
you dont need to put
Code:
OnDIalogResponse
Because that is mesage
Code:
DIALOG_STYLE_LIST
You NEED to put
Code:
OnDialogResponse
because that is list and you chose what yyou want
Code:
DIALOG_STYLE_INPUT
You NEED to put
Code:
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
tanush is offline   Reply With Quote
Old 13/07/2010, 06:31 PM   #10
felipex
Big Clucker
 
felipex's Avatar
 
Join Date: Jul 2010
Location: Brazil - Fortaleza - CE
Posts: 105
Reputation: 0
Default Re: [TUT]How to Create A INPUT Dialog

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
felipex 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



All times are GMT. The time now is 11:04 PM.


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