Register and Login - Dialog
#1

Can someone help me to create a register system in Dialogs with this commands?:

Код:
command(register, playerid, params[])
{
	if (PLAYERLIST_authed[playerid]) return SendClientMessage(playerid, Red, "You are already logged in.");
	
	if (udb_Exists(PlayerName(playerid))) return SendClientMessage(playerid, Orange, "This name is already taken.");
	
	if (strlen(params)==0) return SendClientMessage(playerid, Red, "Usage: /register [pass]");
	
	if (udb_Create(PlayerName(playerid),params))
	{
	    dUserSetINT(PlayerName(playerid)).("Score", 0);
	    dUserSetINT(PlayerName(playerid)).("AdminLevel", 0);
	    dUserSetINT(PlayerName(playerid)).("PlayerLevel", 0);
	    dUserSetINT(PlayerName(playerid)).("Kills", 0);
	    dUserSetINT(PlayerName(playerid)).("Deaths", 0);
	    new string[128]; new pname[24];
	    GetPlayerName(playerid, pname, 24);
	    format(string, sizeof(string), "%s(%d) has created a player file.", pname, playerid);
	    IRC_Say(gGroupID, IRC_CHANNEL, string);
	    return SendClientMessage(playerid, Red, "Your account has been created.");
	}
	return true;
}
Код:
command(login, playerid, params[])
{
	if (PLAYERLIST_authed[playerid]) return SendClientMessage(playerid, Orange, "You are already logged in");
	
	
	if (!udb_Exists(PlayerName(playerid))) return SendClientMessage(playerid, Orange, "That account is not yet registerd.");
	
	if (strlen(params)==0) return SendClientMessage(playerid, Red, "Usage: /login password");
	
	if (udb_CheckLogin(PlayerName(playerid), params))
	{
	    SetPlayerScore(playerid, dUserINT(PlayerName(playerid)).("Score")-GetPlayerScore(playerid));
	    AdminLevel[playerid] = dUserINT(PlayerName(playerid)).("AdminLevel");
	    PlayerLevel[playerid] = dUserINT(PlayerName(playerid)).("PlayerLevel");
	    AdminLevel[playerid] = dUserINT(PlayerName(playerid)).("AdminLevel");
	    Deaths[playerid] = dUserINT(PlayerName(playerid)).("Deaths");
	    Kills[playerid] = dUserINT(PlayerName(playerid)).("Kills");
	    PLAYERLIST_authed[playerid]=true;
	    Logged[playerid] =1;
	    new string[128];
	    new pname[24];
	    GetPlayerName(playerid, pname, 24);
	    format(string, sizeof(string), "%s(%d) has logged into their player file.", pname, playerid);
	    IRC_Say(gGroupID, IRC_CHANNEL, string);
	    
	    return SendClientMessage(playerid, Red, "You are now logged in.");
	}
	new string[128];
	new pname[24];
	GetPlayerName(playerid, pname, 24);
	format(string, sizeof(string), "%s(%d) has failed to login to the player file.", pname, playerid);
	IRC_Say(gGroupID, IRC_CHANNEL, string);
	return SendClientMessage(playerid, Red, "Login Failed.");
}
Reply
#2

What seems to be the problem?
Reply
#3

How to "convert" it to dialogs?
Reply
#4

someone?
Reply
#5

Just move your command into OnDialogResponse and change params to inputtext.
I hope you will be able to do more than I just said or it will error the crap out of you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)