PDA

View Full Version : Register + Login Dialog?


JimmyNeonHD
22/03/2013, 12:16 PM
Im trying to convert this to Dialog i can't i try all things possible to do it and nothing

dcmd_register(playerid,params[]) {
if(!strlen(params)) { new string[256]; format(string,256,"Syntax Error: \"/REGISTER <PASSWORD>\" [Password must be %d+].",Config[MinimumPasswordLength]); return SendClientMessage(playerid,red,string); }
new index = 0,Password[256],string[256],PlayerFile[256]; Password = strtok(params,index); PlayerFile = GetPlayerFile(playerid);
new filename[256];
new pname[256];
GetPlayerName(playerid, pname, 24);
format(filename, 256, "/xadmin/Users/%s.ini", udb_encode(pname));
//This is the name check-up
if(dini_Int(filename, "Registered") == 1)return SendClientMessage(playerid, red, "Error: That playername is already registered. Try another one");
if(!(Variables[playerid][Registered] && Variables[playerid][LoggedIn])) {
if(strlen(Password) >= Config[MinimumPasswordLength]) {
format(string,sizeof(string),"You have registered your account with the password \"%s\" and automatically been logged in.",Password);
SetUserInt(playerid,"Password",udb_hash(Password));
SetUserInt(playerid,"Registered",1);
SetUserInt(playerid,"LoggedIn",1);
Variables[playerid][LoggedIn] = true, Variables[playerid][Registered] = true;
SendClientMessage(playerid,blue,string);
SetUserInt(playerid,"Level", 0);
GivePlayerMoney(playerid, 10000);
new tmp3[100]; GetPlayerIp(playerid,tmp3,100); SetUserString(playerid,"IP",tmp3); OnPlayerRegister(playerid);
} else SendClientMessage(playerid,red,"Syntax Error: \"/REGISTER <PASSWORD>\" [Password must be 3+].");
} else SendClientMessage(playerid,red,"Error: Make sure that you have not registered and are logged out.");
return 1;
}



dcmd_login(playerid,params[]) {
if(!strlen(params)) { SendClientMessage(playerid,red,"Syntax Error: \"/LOGIN <PASSWORD>\"."); return 1; }
new index = 0;
new Password[256], string[256]; Password = strtok(params,index);
new PlayerFile[256]; PlayerFile = GetPlayerFile(playerid);
if(Variables[playerid][Registered] && !Variables[playerid][LoggedIn]) {
if(udb_hash(Password) == dini_Int(PlayerFile,"Password")) {
switch(Variables[playerid][Level]) {
case 0: format(string,sizeof(string),"You have logged into your account. [Status Level: Member]");
default: format(string,sizeof(string),"You have logged into your account. [Status Level: Administrator Lv. %d]",Variables[playerid][Level]);
}
SendClientMessage(playerid,blue,string);
SetUserInt(playerid,"LoggedIn",1); Variables[playerid][LoggedIn] = true;
new tmp3[100]; GetPlayerIp(playerid,tmp3,100); SetUserString(playerid,"IP",tmp3);
OnPlayerLogin(playerid,true);
} else { OnPlayerLogin(playerid,false); SendClientMessage(playerid,red,"Syntax Error: \"/LOGIN <PASSWORD>\"."); }
} else SendClientMessage(playerid,red,"Error: You must be registered to log in; if you have make sure you haven't already logged in.");
return 1;
}



I want it like this


http://img6.imagebanana.com/img/s6p4kw72/reg.png

Gamer_007
22/03/2013, 02:43 PM
Looks like you are using MellAdmin but it has already the Dialogs? why u need?

JimmyNeonHD
22/03/2013, 02:52 PM
I use Xtremeadmin and im adding somethings new so i want to make them dialogs not sendcilentmessage