01.04.2010, 22:49
Hello evryone
I had my old register system and i managed to create a dialog login and register and it worked perfectly
Altho that system had a bug in stats save
So i had to code a new one
So can anyone tell me how to turn this strcmp into dialog
I have tried it
I tried making login and yes it appeared but it doesent login me
LOGIN
REGISTER
And please dont tell me to search because tbh i tried and didnt find anything
I had my old register system and i managed to create a dialog login and register and it worked perfectly
Altho that system had a bug in stats save
So i had to code a new one
So can anyone tell me how to turn this strcmp into dialog
I have tried it
I tried making login and yes it appeared but it doesent login me
LOGIN
pawn Код:
if(strcmp(cmd, "/login", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_GREY, " USAGE: /login [password]");
new name[MAX_PLAYER_NAME];
if(IsLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "You are already logged in.");
return 1;
}
else
{
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"Users/%s.ini",name);
if(fexist(file))
{
tmp2 = dini_Get(file, "Password");
if(udb_hash(tmp) != strval(tmp2))
{
SendClientMessage(playerid, COLOR_RED, "This password does not match any account in the database.");
}
else
{
IsLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "Admin Level");
PlayerInfo[playerid][pVIPMember] = dini_Int(file, "VIP Member");
PlayerInfo[playerid][pArmy] = dini_Int(file, "Army Rank");
SetPlayerMoney(playerid, dini_Int(file, "Cash"));
PlayerInfo[playerid][pBans] = dini_Int(file, "Bans");
PlayerInfo[playerid][pKicks] = dini_Int(file, "Kicks");
PlayerInfo[playerid][pWarns] = dini_Int(file, "Warns");
PlayerInfo[playerid][pMuted] = dini_Int(file, "Muted");
SendClientMessage(playerid, COLOR_WHITE, "You have successfully logged into your account.");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
TogglePlayerControllable(playerid, 1);
}
}
}
return 1;
}
pawn Код:
if(strcmp(cmd, "/register", true) == 0)
{
new name[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);
GetPlayerName(playerid, name, sizeof(name));
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_GREY, " USAGE: /register [password]");
format(file,sizeof(file),"Users/%s.ini",name);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(tmp));
dini_IntSet(file,"Admin Level", 0);
dini_IntSet(file,"VIP Member", 0);
dini_IntSet(file,"Army Rank", 0);
dini_IntSet(file,"Cash", 0);
dini_IntSet(file,"Bank", 0);
dini_IntSet(file,"Bans", 0);
dini_IntSet(file,"Kicks", 0);
dini_IntSet(file,"Warns", 0);
dini_IntSet(file,"Muted", 0);
SendClientMessage(playerid, COLOR_WHITE, "You have successfully registered a account, you can now login by typing /login.");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
else
{
SendClientMessage(playerid, COLOR_RED, "This account is already in the database.");
}
return 1;
}