Register and Login - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Register and Login - Dialog (
/showthread.php?tid=268508)
Register and Login - Dialog -
zxc1 - 12.07.2011
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.");
}
Re: Register and Login - Dialog -
[HiC]TheKiller - 12.07.2011
What seems to be the problem?
Re: Register and Login - Dialog -
zxc1 - 12.07.2011
How to "convert" it to dialogs?
Re: Register and Login - Dialog -
zxc1 - 12.07.2011
someone?
Re: Register and Login - Dialog -
Daren_Jacobson - 12.07.2011
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.