27.08.2011, 21:34
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 201)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"{B8860B}Register","You didn't Type any password, Type again Below:","Register","Cancel");
ForcePlayerToRS(playerid);
new playerfile[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(playerfile, sizeof(playerfile), "Users/%s.ini",pname);
if(dini_Exists(playerfile)) return SendClientMessage(playerid, White, "SERVER: You are already Logged in.");
new playerip[20];
GetPlayerIp(playerid, playerip, sizeof(playerip));
dini_Create(playerfile);
dini_IntSet(playerfile, "Password", udb_hash(inputtext));
dini_Set(playerfile, "Ip", playerip);
dini_IntSet(playerfile, "Level", 0);
dini_IntSet(playerfile, "Cash", 0);
logged[playerid] = 1;
SendClientMessage(playerid, White, "SERVER: You have Registered Successful, And Logged in.");
return 1;
}
if(dialogid == 200)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"{B8860B}Log-In","You didn't Type any password, Type again Below:","Log-In","Cancel");
new playerfile[100], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(playerfile, sizeof(playerfile), "Users/%s.ini",pname);
if(!dini_Exists(playerfile)) return SendClientMessage(playerid, White, "SERVER: This Account Isn't Registered. Register Before Logging-In. (( Use /register ))");
new tmp[256];
tmp = dini_Get(playerfile, "Password");
if(udb_hash(inputtext) == strval(tmp))
{
new playerip[20];
GetPlayerIp(playerid, playerip, sizeof(playerip));
level[playerid] = dini_Int(playerfile, "Level");
logged[playerid] = 1;
SpawnPlayer(playerid);
dini_Set(playerfile, "Ip", playerip);
GivePlayerMoney(playerid, dini_Int(playerfile, "Cash"));
logged[playerid] = 1;
if(Bcon[playerid] == 1)
{
SetPlayerInterior(playerid, dini_Int(playerfile, "Interior"));
SetPlayerVirtualWorld(playerid, dini_Int(playerfile, "VW"));
SetPlayerPos(playerid, dini_Float(playerfile, "PosX"), dini_Float(playerfile, "PosY"), dini_Float(playerfile, "PosZ"));
SetPlayerFacingAngle(playerid, dini_Float(playerfile, "RotZ"));
Bcon[playerid] = 0;
}
}
else return ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"{B8860B}Log-In","Invalid Password!\nType Your Account Password To Join The Server","Log-In","Cancel");
}
return 1;
}