DIALOG_STYLE_INPUT - 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: DIALOG_STYLE_INPUT (
/showthread.php?tid=465814)
DIALOG_STYLE_INPUT -
CesarLT - 24.09.2013
Hello everyone, I am trying to make a basic system with dialog style input, but I am failing to understand how to exactly use that, I am willing to make something similar to a clothes system, like "enter the clothes id below to get them", but all I am seeing in SAMP Wiki is that:
pawn Код:
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please enter your password:", "Login", "Cancel");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_LOGIN)
{
if(!response) // If they clicked 'Cancel' or pressed esc
{
KickWithMessage(playerid, COLOR_RED, "You MUST login to play here. Please change your name.");
//For info & code of this function please refer to the bottom of this article.
}
else // Pressed ENTER or clicked 'Login' button
{
if(CheckPassword(playerid, inputtext))
{
SendClientMessage(playerid, COLOR_RED, "You are now logged in!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "LOGIN FAILED.");
// Re-show the login dialog
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Please enter your password:", "Login", "Cancel");
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
I don't really understand it, neither how to do the thing I want.
If anyone could help me taht would be great. Thanks in advance.
Re: DIALOG_STYLE_INPUT -
Konstantinos - 24.09.2013
When you use DIALOG_STYLE_INPUT, whatever you input (if you respond the dialog) will be in
inputtext.
What's the problem with it?
Re: DIALOG_STYLE_INPUT -
CesarLT - 24.09.2013
Quote:
Originally Posted by Konstantinos
When you use DIALOG_STYLE_INPUT, whatever you input (if you respond the dialog) will be in inputtext.
What's the problem with it?
|
I don't understand how to use that, it's the problem lol, could you give me a small example?
Thanks in advance.
Re: DIALOG_STYLE_INPUT -
Konstantinos - 24.09.2013
pawn Код:
// Somewhere:
ShowPlayerDialog(playerid, 789, DIALOG_STYLE_INPUT, "Skin", "Input the skin you want:", "Change!", "Cancel");
// OnDialogResponse: if the dialogid is 789 and response is 1.
if(IsNumeric(inputtext)) SetPlayerSkin(playerid, strval(inputtext));
You can change your skin via a dialog (input).
pawn Код:
stock IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
Re: DIALOG_STYLE_INPUT -
CesarLT - 24.09.2013
Quote:
Originally Posted by Konstantinos
pawn Код:
// Somewhere: ShowPlayerDialog(playerid, 789, DIALOG_STYLE_INPUT, "Skin", "Input the skin you want:", "Change!", "Cancel");
// OnDialogResponse: if the dialogid is 789 and response is 1. if(IsNumeric(inputtext)) SetPlayerSkin(playerid, strval(inputtext));
You can change your skin via a dialog (input).
pawn Код:
stock IsNumeric(const string[]) { for (new i = 0, j = strlen(string); i < j; i++) { if (string[i] > '9' || string[i] < '0') return 0; } return 1; }
|
Ow, well that made things a bit more clearer, lol thank you again.