SA-MP Forums Archive
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: Dialog (/showthread.php?tid=630059)



Dialog - SpaceRP - 08.03.2017

Код:
CMD:changepass(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
		ShowPlayerDialog(playerid, 335, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", Eexit");
	}
	return 1;
}
Код:
fDialog(335)
{
	if(response)
	{
		if(PlayerInfo[playerid][pPassword] == udb_hash(inputtext)) { ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write new password", "Ok", "Exit"); }
		else { ShowPlayerDialog(playerid, 335, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", Eexit"); }
	}
	return 1;
}
Код:
fDialog(342)
{
	if(response)
	{
		new string[69];
		if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", Eexit");
		if(strlen(inputtext) < 6 || strlen(inputtext) > 20) return ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", Eexit");
		if(strfind(inputtext, "%") != -1) return ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", Eexit");
		PlayerInfo[playerid][pPassword] = udb_hash(inputtext);
		//strmid(PlayerInfo[playerid][pPassword], inputtext, 0, strlen(inputtext), 255);
		format(string, sizeof(string), "New password is %s", inputtext);
		SCM(playerid, COLOR_WHITE,string);
	}
	return 1;
}
Код:
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", Eexit");

Not functioning, press empty dialog it accepts 



Re: Dialog - SyS - 08.03.2017

try isnull


Re: Dialog - SpaceRP - 08.03.2017

Not functioning, my password is 123123 and enter password current 123123 and asks for a new password, I press empty dialog with out New password is 23123


Re: Dialog - DutchBoy - 08.03.2017

i also have some trouble with dialogs. ( Not the same but post it here because i don't think its needed to create a new topic)

I'm trying to get a dialog triggerd on an other player when using iam using a command.
Example. type /Showrules 1
and it opens the rules dialog for Player with ID 1.

any one have any idea?


Re: Dialog - JessThompson - 08.03.2017

Quote:
Originally Posted by DutchBoy
Посмотреть сообщение
i also have some trouble with dialogs. ( Not the same but post it here because i don't think its needed to create a new topic)

I'm trying to get a dialog triggerd on an other player when using iam using a command.
Example. type /Showrules 1
and it opens the rules dialog for Player with ID 1.

any one have any idea?
Just use a input box and then ondialogresponse strval the inputtext and display the rules to the player :P

Код:
CMD:showrules(playerid, params[])
{
	Dialog_Show(playerid, RulesOtherPlayer, DIALOG_STYLE_INPUT, ""EMBED_YELLOW"Player Selection:", "Please input player ID!", "Next", "Cancel");
	return 1;
}
Код:
Dialog:RulesOtherPlayer(playerid, response, listitem, inputtext[])
{
	if(response)
	{
		new Player = strval(inputtext);
		SendClientMessage(Player, -1, "Message")
	}
	return 1;
}



Re: Dialog - JessThompson - 08.03.2017

Quote:
Originally Posted by SpaceRP
Посмотреть сообщение
Код:
CMD:changepass(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
		ShowPlayerDialog(playerid, 335, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", Eexit");
	}
	return 1;
}
Код:
fDialog(335)
{
	if(response)
	{
		if(PlayerInfo[playerid][pPassword] == udb_hash(inputtext)) { ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write new password", "Ok", "Exit"); }
		else { ShowPlayerDialog(playerid, 335, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", Eexit"); }
	}
	return 1;
}
Код:
fDialog(342)
{
	if(response)
	{
		new string[69];
		if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", Eexit");
		if(strlen(inputtext) < 6 || strlen(inputtext) > 20) return ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", Eexit");
		if(strfind(inputtext, "%") != -1) return ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", Eexit");
		PlayerInfo[playerid][pPassword] = udb_hash(inputtext);
		//strmid(PlayerInfo[playerid][pPassword], inputtext, 0, strlen(inputtext), 255);
		format(string, sizeof(string), "New password is %s", inputtext);
		SCM(playerid, COLOR_WHITE,string);
	}
	return 1;
}
Код:
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", Eexit");

Not functioning, press empty dialog it accepts 
Try this

Код:
fDialog(342)
{
    if(response)
    {
        new newpass = strlen(inputtext),string[69];
        if(!strlen(inputtext))
        {
            ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", "Exit");
            return 1;
        }
        else if(!(6 <= newpass <= 20))
        {
            ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", "Exit");
            return 1;
        }
        else if(strfind(inputtext, "%") != -1)
        {
            ShowPlayerDialog(playerid, 342, DIALOG_STYLE_PASSWORD, "Password", "Write current password", "Ok", "Exit");
            return 1;
        }
        PlayerInfo[playerid][pPassword] = udb_hash(inputtext);
        //strmid(PlayerInfo[playerid][pPassword], inputtext, 0, strlen(inputtext), 255);
        format(string, sizeof(string), "New password is %s", inputtext);
        SCM(playerid, COLOR_WHITE,string);
    }
    return 1
}



Re: Dialog - SpaceRP - 08.03.2017

No function


Re: Dialog - SpaceRP - 18.03.2017

Bump