[AJUDA]LoginBox -
RockFire - 12.03.2011
Estou com uns problemas para por os comandos /login e /register do ladmin em dialog, por exemplo /logar e aparece a dialog e o player digita a senha.
Codigo do /register
pawn Код:
dcmd_register(playerid,params[])
{
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"ACCOUNT: You are already registered and logged in.");
if (udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"ACCOUNT: This account already exists, please use '/login [password]'.");
if (strlen(params) == 0) return SendClientMessage(playerid,red,"ACCOUNT: Correct usage: '/register [password]'");
if (strlen(params) < 4 || strlen(params) > 20) return SendClientMessage(playerid,red,"ACCOUNT: Password length must be greater than three characters");
if (udb_Create(PlayerName2(playerid),params))
{
new file[256],name[MAX_PLAYER_NAME], tmp3[100];
new strdate[20], year,month,day; getdate(year, month, day);
GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(name));
GetPlayerIp(playerid,tmp3,100); dini_Set(file,"ip",tmp3);
// dini_Set(file,"password",params);
dUserSetINT(PlayerName2(playerid)).("registered",1);
format(strdate, sizeof(strdate), "%d/%d/%d",day,month,year);
dini_Set(file,"RegisteredDate",strdate);
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
dUserSetINT(PlayerName2(playerid)).("banned",0);
dUserSetINT(PlayerName2(playerid)).("level",0);
dUserSetINT(PlayerName2(playerid)).("LastOn",0);
dUserSetINT(PlayerName2(playerid)).("money",0);
dUserSetINT(PlayerName2(playerid)).("kills",0);
dUserSetINT(PlayerName2(playerid)).("deaths",0);
dUserSetINT(PlayerName2(playerid)).("hours",0);
dUserSetINT(PlayerName2(playerid)).("minutes",0);
dUserSetINT(PlayerName2(playerid)).("seconds",0);
PlayerInfo[playerid][LoggedIn] = 1;
PlayerInfo[playerid][Registered] = 1;
SendClientMessage(playerid, green, "ACCOUNT: You are now registered, and have been automaticaly logged in");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
return 1;
}
return 1;
}
Cуdigo do /login
pawn Код:
dcmd_login(playerid,params[])
{
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"ACCOUNT: You are already logged in.");
if (!udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"ACCOUNT: Account doesn't exist, please use '/register [password]'.");
if (strlen(params)==0) return SendClientMessage(playerid,red,"ACCOUNT: Correct usage: '/login [password]'");
if (udb_CheckLogin(PlayerName2(playerid),params))
{
new file[256], tmp3[100], string[128];
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(PlayerName2(playerid)) );
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"ip",tmp3);
LoginPlayer(playerid);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
if(PlayerInfo[playerid][Level] > 0) {
format(string,sizeof(string),"ACCOUNT: Successfully Logged In. (Level %d)", PlayerInfo[playerid][Level] );
return SendClientMessage(playerid,green,string);
} else return SendClientMessage(playerid,green,"ACCOUNT: Successfully Logged In");
}
else {
PlayerInfo[playerid][FailLogin]++;
printf("LOGIN: %s has failed to login, Wrong password (%s) Attempt (%d)", PlayerName2(playerid), params, PlayerInfo[playerid][FailLogin] );
if(PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
{
new string[128]; format(string, sizeof(string), "%s has been kicked (Failed Logins)", PlayerName2(playerid) );
SendClientMessageToAll(grey, string);
print(string);
Kick(playerid);
}
return SendClientMessage(playerid,red,"ACCOUNT: Login failed! Incorrect Password");
}
}
Sу queria mudar isso.
Re: [AJUDA]LoginBox -
DartakousLien - 12.03.2011
pawn Код:
dcmd_login(playerid,params[])
{
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"ACCOUNT: You are already logged in.");
if (!udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"ACCOUNT: Account doesn't exist, please use '/register [password]'.");
if (strlen(params)==0) return SendClientMessage(playerid,red,"ACCOUNT: Correct usage: '/login [password]'");
if (udb_CheckLogin(PlayerName2(playerid),params))
{
new file[256], tmp3[100], string[128];
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(PlayerName2(playerid)) );
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"ip",tmp3);
LoginPlayer(playerid);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
if(PlayerInfo[playerid][Level] > 0) {
format(string,sizeof(string),"ACCOUNT: Successfully Logged In. (Level %d)", PlayerInfo[playerid][Level] );
return SendClientMessage(playerid,green,string);
} else return SendClientMessage(playerid,green,"ACCOUNT: Successfully Logged In");
}
else {
PlayerInfo[playerid][FailLogin]++;
printf("LOGIN: %s has failed to login, Wrong password (%s) Attempt (%d)", PlayerName2(playerid), params, PlayerInfo[playerid][FailLogin] );
if(PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
{
new string[128]; format(string, sizeof(string), "%s has been kicked (Failed Logins)", PlayerName2(playerid) );
SendClientMessageToAll(grey, string);
print(string);
Kick(playerid);
}
return SendClientMessage(playerid,red,"ACCOUNT: Login failed! Incorrect Password");
}
}
so vou fazer para o logar...e й melhor voce testar pq eu nao sei se vai dar...
pawn Код:
dcmd_login(playerid,params[])
{
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"ACCOUNT: You are already logged in.");
if (!udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"ACCOUNT: Account doesn't exist, please use '/register [password]'.");
ShowPlayerDialog(playerid,LOGIN,DIALOG_STYLE_INPUT,"Logar","Digite a sua senha","Logar","");
return 1;
}
no OnDialogResponse
pawn Код:
if(dialogid == LOGIN)
{
if(response)
{
if (udb_CheckLogin(PlayerName2(playerid),inputtext))
{
new file[256], tmp3[100], string[128];
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(PlayerName2(playerid)) );
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"ip",tmp3);
LoginPlayer(playerid);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
if(PlayerInfo[playerid][Level] > 0) {
format(string,sizeof(string),"ACCOUNT: Successfully Logged In. (Level %d)", PlayerInfo[playerid][Level] );
return SendClientMessage(playerid,green,string);
} else return SendClientMessage(playerid,green,"ACCOUNT: Successfully Logged In");
}
else {
PlayerInfo[playerid][FailLogin]++;
printf("LOGIN: %s has failed to login, Wrong password (%s) Attempt (%d)", PlayerName2(playerid), inputtext, PlayerInfo[playerid][FailLogin] );
if(PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
{
new string[128]; format(string, sizeof(string), "%s has been kicked (Failed Logins)", PlayerName2(playerid) );
SendClientMessageToAll(grey, string);
print(string);
Kick(playerid);
}
return SendClientMessage(playerid,red,"ACCOUNT: Login failed! Incorrect Password");
}
} else { }
}
se nao funcionar fala...
Re: [AJUDA]LoginBox -
RockFire - 12.03.2011
funcionou sim, vlw
Re: [AJUDA]LoginBox -
vitorhnn - 12.03.2011
pawn Код:
dcmd_register(playerid,params[])
{
#pragma unused params
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"ACCOUNT: You are already registered and logged in.");
if (udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"ACCOUNT: This account already exists, please use '/login [password]'.");
ShowPlayerDialog(playerid,registro, DIALOG_STYLE_INPUT,"Registrar","Digite uma senha para registrar", "Ok,"Cancelar");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == registro)
{
if(response)
{
if(strlen(inputtext) < 4 || strlen(inputtext) > 20) return SendClientMessage(playerid,red,"ACCOUNT:Password lenght must be greater than three characters");
if(udb_Create(PlayerName2(playerid),inputtext))
{
new file[256],name[MAX_PLAYER_NAME, tmp3[100];
new strdate[20], year, month, day; getdate(year, month, day);
GetPlayerName(playerid,name,sizeof(name)); format(file(sizeof(file),"/ladmin/users/%s.sav",udb_encode(name));
GetPlayerIp(playerid,tmp3,100); dini_Set(file,"ip",tmp3);
// dini_Set(file,"password",params);
dUserSetINT(PlayerName2(playerid)).("registered",1);
format(strdate, sizeof(strdate), "%d/%d/%d",day,month,year);
dini_Set(file,"RegisteredDate",strdate);
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
dUserSetINT(PlayerName2(playerid)).("banned",0);
dUserSetINT(PlayerName2(playerid)).("level",0);
dUserSetINT(PlayerName2(playerid)).("LastOn",0);
dUserSetINT(PlayerName2(playerid)).("money",0);
dUserSetINT(PlayerName2(playerid)).("kills",0);
dUserSetINT(PlayerName2(playerid)).("deaths",0);
dUserSetINT(PlayerName2(playerid)).("hours",0);
dUserSetINT(PlayerName2(playerid)).("minutes",0);
dUserSetINT(PlayerName2(playerid)).("seconds",0);
PlayerInfo[playerid][LoggedIn] = 1;
PlayerInfo[playerid][Registered] = 1;
SendClientMessage(playerid, green, "ACCOUNT: You are now registered, and have been automaticaly logged in");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
return 1;
}
return 1;
}
Vк se funciona, se nгo, posta os erros e eu debugo.
~r0n4ld0