10.12.2011, 15:49
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
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.
If this is correct, how would I implement the information into a dialog? I only did strings before with SendClientMessage 
Thanks in advance!
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!"); }
Код:
#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."); }

Thanks in advance!
