A problem in Registing
#1

I use a dialog of register as in the code
PHP код:
if(dialogid == DIALOG_REGISTER)
    {
        if (
response == 0)
        {
            
SendClientMessage(playerid,COLOR_ERROR,"You must register before playing on this server.");
            
ShowRegisterScreen(playerid);
            return 
1;
        }
        if (
response == 1)
        {
            if (
udb_Exists(PlayerName(playerid)))
            {
                
SendClientMessage(playerid,COLOR_ERROR,"This account already exists, please choose a different player name.");
                return 
1;
            }
            if (
strlen(inputtext)==0)
            {
                
SendClientMessage(playerid,COLOR_ERROR,"Please enter your password in the box to register in this server.");
                
ShowRegisterScreen(playerid);
                return 
1;
            }
            if (
udb_Create(PlayerName(playerid),inputtext))
            {
                
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have registered, now please enter your password in the box to login.");
                
ShowLoginScreen(playerid);
                
PLAYERLIST_authed[playerid]=true;
                
dUserSetINT(PlayerName(playerid)).("Money",7500);
                
dUserSetINT(PlayerName(playerid)).("Bankcash",5000);
                
dUserSetINT(PlayerName(playerid)).("Score",0);
                
dUserSetINT(PlayerName(playerid)).("Adminlevel",0);
                
dUserSetINT(PlayerName(playerid)).("Nameban",0);
                
dUserSetINT(PlayerName(playerid)).("Army",0);
                
dUserSetINT(PlayerName(playerid)).("CIA",0);
                
dUserSetINT(PlayerName(playerid)).("RegularPlayer",0);
                
dUserSetINT(PlayerName(playerid)).("Nameban",0);
                
dUserSetINT(PlayerName(playerid)).("DrugHouseOwner",0);
                
dUserSetINT(PlayerName(playerid)).("OttoOwner",0);
                
dUserSetINT(PlayerName(playerid)).("TSkill",0);
                
dUserSetINT(PlayerName(playerid)).("RobSkill",0);
                
dUserSetINT(PlayerName(playerid)).("CopRank",0);
                
dUserSetINT(PlayerName(playerid)).("HasPackC4",0);
                
dUserSetINT(PlayerName(playerid)).("HasPackRope",0);
                
dUserSetINT(PlayerName(playerid)).("HasPackMoney",0);
                 
dUserSetINT(PlayerName(playerid)).("SavedJailTime",0);
                
dUserSetINT(PlayerName(playerid)).("SavedWantedLevel",0);
                new 
pIp[16];
                
GetPlayerIp(playeridpIpsizeof(pIp));
                
dUserSet(PlayerName(playerid)).("IP"pIp);
            }
            return 
true;
        }
        return 
1;
    } 
An in the log in
PHP код:
if(dialogid == DIALOG_LOGIN)
    {
        if (
response == 0)
        {
            
SendClientMessage(playerid,COLOR_ERROR,"You must login before playing on this server.");
            
ShowLoginScreen(playerid);
            return 
1;
        }
        if (
response == 1)
        {
            if (
strlen(inputtext) == 0)
            {
                
SendClientMessage(playerid,COLOR_ERROR,"Please enter your password for your account in the box below.");
                
ShowLoginScreen(playerid);
                return 
1;
            }
            if (
udb_CheckLogin(PlayerName(playerid),inputtext))
            {
                
GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("Money")-GetPlayerMoney(playerid));
                
BankCash[playerid] =dUserINT(PlayerName(playerid)).("Bankcash");
                
SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("Score")-GetPlayerScore(playerid));
                
AdminLevel[playerid] =dUserINT(PlayerName(playerid)).("Adminlevel");
                
NameBanned[playerid] =dUserINT(PlayerName(playerid)).("Nameban");
                
CanUseArmy[playerid] =dUserINT(PlayerName(playerid)).("Army");
                
CanUseCIA[playerid] =dUserINT(PlayerName(playerid)).("CIA");
                
IsRegularPlayer[playerid] =dUserINT(PlayerName(playerid)).("RegularPlayer");
                
DrugHouseOwner[playerid] =dUserINT(PlayerName(playerid)).("DrugHouseOwner");
                
OttoOwner[playerid] =dUserINT(PlayerName(playerid)).("OttoOwner");
                
TerroristSkill[playerid] =dUserINT(PlayerName(playerid)).("TSkill");
                
RobSkill[playerid] =dUserINT(PlayerName(playerid)).("RobSkill");
                
CopRank[playerid] =dUserINT(PlayerName(playerid)).("CopRank");
                
HasPackC4[playerid] =dUserINT(PlayerName(playerid)).("HasPackC4");
                
HasPackRope[playerid] =dUserINT(PlayerName(playerid)).("HasPackRope");
                
HasPackMoney[playerid] =dUserINT(PlayerName(playerid)).("HasPackMoney");
                
SavedJailTime[playerid] =dUserINT(PlayerName(playerid)).("SavedJailTime");
                
SavedWantedLevel[playerid] =dUserINT(PlayerName(playerid)).("SavedWantedLevel");
                   new 
pIp[16];
                
GetPlayerIp(playeridpIpsizeof(pIp));
                
dUserSet(PlayerName(playerid)).("IP"pIp);
                   
PLAYERLIST_authed[playerid]=true;
                  return 
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have successfully logged in! Your previous stats have been restored.");
            }
            
ShowLoginScreen(playerid);
            
CheckPasswordAttempts(playerid);
        }
        return 
1;
    } 
But when i host that gamemode , I regist but when I log in it says wrong password and i noticed that no file created in the scriptfiles folder , need your help
Reply
#2

Are you using dini include? I am not so sure, I am pretty new to scripting.

Just add this before all the settings when he has successfuly registered.


PHP код:
new, name[MAX_PLAYER_NAME], strin[256];
GetPlayerName(playeridnamesizeof(name));
format(strinsizeof(strin), "%s.ini"name);
if(
fexist(strin))
{
ShowPlayerDialog(DIALOG_LOGIN)
}
else
{
dini_Create(strin);
all your sets here

Make sure to create the file before setting all the settings..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)