Register script into dialogs - 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: Register script into dialogs (
/showthread.php?tid=302790)
Register script into dialogs -
HighFlyer - 10.12.2011
Hey there,
I made this register and login system but I am not exactly sure how to turn such a system into a dialog-based one? Any help would be appreciated
Код:
dcmd_register(playerid,params[])
{
if(PlayerData[playerid][Logged])
return SendClientMessage(playerid,COLOR_WHITE,"Already logged in.");
if(udb_Exists(PlayerName(playerid)))
return SendClientMessage(playerid,COLOR_WHITE,"Account already exists, please use /login [password].");
if(strlen(params)==0)
return SendClientMessage(playerid,COLOR_GREY,"Usage: /register [password]");
if(udb_Create(PlayerName(playerid),params))
return SendClientMessage(playerid,COLOR_WHITE,"Succesfully register. Please login now, using /login [password]");
return true;
}
dcmd_login(playerid,params[])
{
if(PlayerData[playerid][Logged])
{
SendClientMessage(playerid,COLOR_WHITE,"Already logged in.");
return true;
}
if(!udb_Exists(PlayerName(playerid)))
{
SendClientMessage(playerid,COLOR_WHITE,"Account doesn't exist, please use /register [password].");
return true;
}
if(!strlen(params))
{
SendClientMessage(playerid,COLOR_GREY,"Usage: /login password");
return true;
}
if(udb_CheckLogin(PlayerName(playerid),params))
{
PlayerData[playerid][Logged] = 1;
PlayerData[playerid][Kicks] = (dUserINT(PlayerName(playerid)).("PlayerKicks"));
PlayerData[playerid][Bans] = (dUserINT(PlayerName(playerid)).("PlayerBans"));
PlayerData[playerid][AdminLevel] = (dUserINT(PlayerName(playerid)).("AdminLevel"));
PlayerData[playerid][Score] = (dUserINT(PlayerName(playerid)).("PlayerScore"));
SendClientMessage(playerid,COLOR_WHITE,"Successfully logged in!");
return true;
}
else return SendClientMessage(playerid,COLOR_WHITE,"Incorrect password!");
}
And if I am to create a stats command in a dialog, would the information in a dialog needed to be display in the same way as above? I tried this command, but untested it and not sure whether it would work.
Код:
#define SCORE_DIALOG 300
if(strcmp(cmdtext,"/score", true) == 0)
{
if(PlayerData[playerid][Logged])
{
ShowPlayerDialog(playerid,SCORE_DIALOG,DIALOG_STYLE_MSGBOX,"Personal Statistics",
"\n \nScore: \nAdmin Level:","OK","");
return true;
}
else return SendClientMessage(playerid,COLOR_RED,">> You are not logged in. Please login to retrieve your statistics.");
}
If this is correct, how would I implement the information into a dialog? I only did strings before with SendClientMessage
Thanks in advance!
Re: Register script into dialogs -
Nodroz - 10.12.2011
So you should like to see a dialog showing up when a player connects where he can put in his password? Right?
Re: Register script into dialogs -
HighFlyer - 10.12.2011
Yeah. And hai Nod. x)
I'm sure your question had an obvious answer, but yeah.
Re: Register script into dialogs -
iTorran - 11.02.2012
EDIT: Wee i failed so hard on the date