Login In Dialog
#1

Hi,
There Are Problem With Login When I Made It Work In Dialog
When I Login It Say Wrong Password And The Password That I Wrote Is Correct!
pawn Код:
if(dialogid == 100 && response == 1) {
        {
            new file[256];
            new pass[256];
            pass = dini_Get(file,"Password");
            if(!response) return Kick(playerid);
            if( response )
            {
                    if(strcmp(inputtext,pass,false) != 0)
                    {
                    dini_IntSet(file,"Logged",1);
                    PInfo[playerid][Logged] = 1;
                    PInfo[playerid][Level] = dini_Int(file,"Level");
                    PInfo[playerid][Money] = dini_Int(file, "Money");
                    PInfo[playerid][Score] = dini_Int(file, "Score");
                    SetPlayerScore(playerid,dini_Int(file,"Score"));
                    GivePlayerMoney(playerid,dini_Int(file,"Money"));
                    SendClientMessage(playerid,GREEN,"You Have Successfully Logged In!");
                }
                else
                {
                    ShowPlayerDialog(playerid, 100, DIALOG_STYLE_PASSWORD,"Login","{FF0000}Wrong Password, If Not Your Account Use Another Name","Login","Quit");
                }
                return 1;
            }
        }
    }
rep+ For Who Will Fix This Problem
Reply
#2

i don't use dini but i think you need to set the file path.

pawn Код:
new file[256];
// set file path?
            new pass[256];
            pass = dini_Get(file,"Password");
also
pawn Код:
if(!response) return Kick(playerid);
will never be called because of this code
pawn Код:
if(dialogid == 100 && response == 1) {
Reply
#3

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
i don't use dini but i think you need to set the file path.

pawn Код:
new file[256];
// set file path?
            new pass[256];
            pass = dini_Get(file,"Password");
Sry But I Don't Know How To Use Dini, I Just Get The Admin FS From Tutorial
Can You Do It For me
And If U Don't How To Do It In Dini I am Going To Send To U My Gamemode

Quote:

also
pawn Код:
if(!response) return Kick(playerid);
will never be called because of this code
pawn Код:
if(dialogid == 100 && response == 1) {
Then What I Must Add Instead Of This?
Reply
#4

Read this tutorial on how to use dini. If you don't get it post a reply here.
WISH YOU LUCK!
Reply
#5

Hope this helps


Код:
if (dialogid == 100)
{
      new name[MAX_PLAYER_NAME];
      GetPlayerName(playerid, name, sizeof(name));
      format(file, sizeof(file), "%s.ini", name);
      if(!response) return Kick(playerid);
      if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "You are registred, please login.", "Login", "Leave");
      new tmp;
      tmp = dini_Int(file, "Password");
      if(inputtext != tmp) {
      ShowPlayerDialog(playerid, 100, DIALOG_STYLE_PASSWORD,"Login","{FF0000}Wrong Password, If Not Your Account Use Another Name","Login","Quit");
      }
      else
      {
	dini_IntSet(file,"Logged",1);
     	PInfo[playerid][Logged] = 1;
        PInfo[playerid][Level] = dini_Int(file,"Level");
        PInfo[playerid][Money] = dini_Int(file, "Money");
        PInfo[playerid][Score] = dini_Int(file, "Score");
        SetPlayerScore(playerid,dini_Int(file,"Score"));
        GivePlayerMoney(playerid,dini_Int(file,"Money"));
        SendClientMessage(playerid,GREEN,"You Have Successfully Logged In!");		
      }
return 1;
}
Reply
#6

pawn Код:
if(inputtext != tmp) {
Код:
D:\ЗбЪЗИ\Freeroam World\gamemodes\Freeroam.pwn(2566) : error 033: array must be indexed (variable "inputtext")
How To Fix This?
Reply
#7

Give tmp a value:
pawn Код:
new tmp[128];
Your moded code:
pawn Код:
if (dialogid == 100)
{
      new name[MAX_PLAYER_NAME];
      GetPlayerName(playerid, name, sizeof(name));
      format(file, sizeof(file), "%s.ini", name);
      if(!response) return Kick(playerid);
      if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "You are registred, please login.", "Login", "Leave");
      new tmp[128];
      tmp = dini_Int(file, "Password");
      if(inputtext != tmp)
      {
        ShowPlayerDialog(playerid, 100, DIALOG_STYLE_PASSWORD,"Login","{FF0000}Wrong Password, If Not Your Account Use Another Name","Login","Quit");
      }
      else
      {
        dini_IntSet(file,"Logged",1);
        PInfo[playerid][Logged] = 1;
        PInfo[playerid][Level] = dini_Int(file,"Level");
        PInfo[playerid][Money] = dini_Int(file, "Money");
        PInfo[playerid][Score] = dini_Int(file, "Score");
        SetPlayerScore(playerid,dini_Int(file,"Score"));
        GivePlayerMoney(playerid,dini_Int(file,"Money"));
        SendClientMessage(playerid,GREEN,"You Have Successfully Logged In!");
      }
return 1;
}
Reply
#8

I Got This:
Код:
D:\ЗбЪЗИ\Freeroam World\gamemodes\Freeroam.pwn(2566) : error 033: array must be indexed (variable "inputtext")
D:\ЗбЪЗИ\Freeroam World\gamemodes\Freeroam.pwn(2566) : error 033: array must be indexed (variable "tmp")
Reply
#9

Then What I Must Do??
Reply
#10

pawn Код:
if(dialogid == 100 && response == 1) {
        {
            new file[256];
            new pass[256];
            format(file,sizeof(file),PlayerFile,Name);//Replace Player File with the location maybe "/Users/%s.ini"
            pass = dini_Get(file,"Password");
            if(!response) return Kick(playerid);
            if( response )
            {
                    if(strcmp(inputtext,pass,false) != 0)
                    {
                    dini_IntSet(file,"Logged",1);
                    PInfo[playerid][Logged] = 1;
                    PInfo[playerid][Level] = dini_Int(file,"Level");
                    PInfo[playerid][Money] = dini_Int(file, "Money");
                    PInfo[playerid][Score] = dini_Int(file, "Score");
                    SetPlayerScore(playerid,dini_Int(file,"Score"));
                    GivePlayerMoney(playerid,dini_Int(file,"Money"));
                    SendClientMessage(playerid,GREEN,"You Have Successfully Logged In!");
                }
                else
                {
                    ShowPlayerDialog(playerid, 100, DIALOG_STYLE_PASSWORD,"Login","{FF0000}Wrong Password, If Not Your Account Use Another Name","Login","Quit");
                }
                return 1;
            }
        }
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)